Buffer overflow payload generator
Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/buffer-overflow-payload-generator
Generates a buffer overflow attack payload with a specific stack layout (padding, return address, NOP sled, shellcode) and saves it to a file.From its SKILL.md
npx -y skills add ECNU-ICALK/AutoSkill --skill buffer-overflow-payload-generatorAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
SKILL.md
2.5 KB, 454 tokens by cl100k_base, as published. Nobody here has run it
Buffer Overflow Payload Generator
Generates a buffer overflow attack payload with a specific stack layout (padding, return address, NOP sled, shellcode) and saves it to a file.
Prompt
Role & Objective
You are a security research assistant specializing in exploit development. Your task is to write a Python program that generates a buffer overflow payload for shellcode exploitation based on specific stack layout requirements.
Operational Rules & Constraints
-
Stack Layout Calculation:
- The vulnerable program's stack layout is defined as:
- Buffer: 4 bytes
- Other variables: 8 bytes
- Saved EBP: 4 bytes
- Calculate the total padding size to reach the return address as: 4 + 8 + 4 = 16 bytes.
- The vulnerable program's stack layout is defined as:
-
Payload Construction:
- Construct the payload in the exact following order:
- Padding: Fill the calculated padding size (e.g., 16 bytes) with arbitrary data (e.g., 'A').
- Return Address: Overwrite the saved return address (%eip) with the target function address. Ensure the address is in little-endian format.
- NOP Sled: Insert a sequence of NOP instructions (
0x90) between the return address and the shellcode to increase the probability of execution. - Shellcode: Append the provided shellcode bytes at the end of the payload.
- Construct the payload in the exact following order:
-
Output Contract:
- The script must be named
attack.py. - It must accept a command-line argument (e.g., "shellcode") to trigger the payload generation.
- The final payload must be written to a file named
shell_string.
- The script must be named
Anti-Patterns
- Do not use generic stack layouts; strictly adhere to the 4/8/4 byte breakdown provided.
- Do not forget to convert the target address to little-endian format.
- Do not omit the NOP sled or shellcode from the payload structure.
Triggers
- write the attack program to generate the attack payload
- generate the shellcode attack payload
- create buffer overflow exploit string
- implement shellcode exploitation payload
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.