Living in Memory: Why OffSec PEN-300 (OSEP) Completely Changes How You See AV & EDR
Almost everyone in the offensive security world knows OSCP. Itβs the baptism by fire where you learn to find a service, search for an exploit, and get a shell.
And then you start PEN-300 (OSEP), and your entire world gets turned upside down. π€―
You quickly learn that downloading an .exe from GitHub and running it on a Windows 10/11 enterprise endpoint with Defender, AMSI, and AppLocker enabled will get you exactly one thing: your payload killed in 0.2 seconds and your IP flagged by the SOC.
OSEP is all about the art of Evasion, Custom Tooling, and Living in Memory. It teaches you not just how to use exploits, but how code executes in Windows at the API level.
Here is why OSEP is such an exhilarating course, the concepts that make it so addictive, and why it permanently levels up your skills.
π οΈ 1. Building Your Own Custom Loaders in C# and C/C++
The biggest revelation in OSEP is that pre-packaged binaries are dead. If you want a reverse shell or a C2 agent to run reliably on modern endpoints, you have to build your own custom loader:
- Encrypting your shellcode with AES, XOR, or Caesar ciphers so static signatures on disk find nothing.
- Dynamically resolving Windows APIs at runtime instead of importing them statically.
- Crafting initial delivery vehicles: malicious Office macros with VBA, JScript/VBScript files wrapped in
.hta, and compiled C# binaries.
Writing a 50-line C# loader that effortlessly bypasses Windows Defender and drops an interactive beacon into memory is one of the most rewarding feelings in offensive security! π»
ποΈ 2. Blinding the Watchers: AMSI Bypasses & API Unhooking
Antimalware Scan Interface (AMSI) acts as an in-memory buffer scanner. Whenever PowerShell, JScript, or VBA executes a command, Windows feeds the script buffer to AMSI before running it.
OSEP teaches you the elegance of in-memory patching:
- Finding the address of
AmsiScanBufferinsideamsi.dllin your process's memory space. - Overwriting the entry bytes with assembly instructions (
retor setting the return code toAMSI_RESULT_CLEAN). - Once patched, AMSI simply returns "Nothing to see here!" for every single malicious script you run.
Understanding how to manipulate the virtual memory of your own process using VirtualProtect shifts your perspective from being a "script user" to a "memory mechanic."
π 3. Process Injection Tradecraft
Executing your payload in its own isolated process is a red flag for behavioral EDRs. OSEP dives deep into stealthy process injection:
-
Process Hollowing: Spawning a legitimate system process (like
svchost.exe), unmapping its memory, injecting your shellcode, and pointing the instruction pointer to your payload. - Process Injection via APC (Asynchronous Procedure Calls): Queueing a thread to execute shellcode when an alertable thread wakes up.
- Avoiding noisy API call chains like
VirtualAllocExβWriteProcessMemoryβCreateRemoteThreadthat modern security sensors are specifically trained to intercept.
π’ 4. Living Off the Land & Escaping Constraints
Enterprise environments are locked down with AppLocker and Constrained Language Mode (CLM), preventing unapproved .exe files and raw PowerShell scripts from running.
OSEP teaches you to use the system against itself:
- Abusing Microsoft-signed binaries (LOLBins) like
InstallUtil.exeandMSBuild.exeto execute custom C# code while completely bypassing AppLocker rules. - PowerShell runspace bypasses: creating a custom C# console application that instantiates an unconstrained PowerShell runspace in memory, effectively ignoring CLM restrictions.
- Lateral movement via MSSQL Linked Servers, traversing multiple SQL databases across air-gapped network tiers to execute OS commands via
xp_cmdshell.
π€ Preparing for OSEP or Leveling Up Evasion Tradecraft?
Whether you are deep in the PEN-300 / OSEP labs, preparing for CRTO, CRTE, CRTM, CARTP, or CARTE, or looking for structured command runbooks and evasion guides:
At SecLabs Guides, we build full interactive walkthroughs, complete network diagrams, and unredacted master command runbooks for top-tier red team certifications.
π¬ Connect with us:
- π Interactive Guides Portal: https://seclabs-guides.pages.dev
- π Instant Access & Serials Store: https://seclabs-guides.myshoppex.io
- π¬ Direct Telegram Support & Inquiries: Reach out directly to
@seclabs_storeon Telegram for study bundles, troubleshooting tips, or technical inquiries!
What was your favorite evasion technique in OSEP? Drop a comment below! π
Top comments (0)