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/Usable access/Execution troubleshooting
← All execution troubleshooting tasks

Distinguish PowerShell policy, language mode and protected execution layers

CommandsIf → thenExplanation & examples

Needs: Actual host policy/language context and a supported allowed execution route; required runtime features remain available

Read-only checks

ControlWhat it changesUseful evidence
Execution policyConditions for loading/running scriptsGet-ExecutionPolicy -List and exact error
Language modeAvailable PowerShell language features$ExecutionContext.SessionState.LanguageMode
AMSISubmits supported script/content to antimalwareExplicit block/error plus Defender/PowerShell events
AppLocker/WDACApplication/script allow policyEffective policy and application-control events
Defender/other AVFile, memory, behavior and network decisionsStatus, detection history, quarantine/events
PermissionsFile/process/service/token rightsAccess-denied result under named identity

Read-only checks:

# Read-only checks
Get-ExecutionPolicy -List
$ExecutionContext.SessionState.LanguageMode

Get-MpComputerStatus |
  Select-Object AntivirusEnabled,RealTimeProtectionEnabled,
    BehaviorMonitorEnabled,IoavProtectionEnabled,AntivirusSignatureVersion

Get-MpThreatDetection |
  Select-Object InitialDetectionTime,ThreatID,ActionSuccess,Resources

Get-AppLockerPolicy -Effective -Xml

Get-WinEvent -LogName 'Microsoft-Windows-Windows Defender/Operational' `
  -MaxEvents 50 -ErrorAction SilentlyContinue |
  Select-Object TimeCreated,Id,LevelDisplayName,Message

Get-WinEvent -LogName 'Microsoft-Windows-AppLocker/EXE and DLL' `
  -MaxEvents 50 -ErrorAction SilentlyContinue |
  Select-Object TimeCreated,Id,Message

Get-WinEvent -LogName 'Microsoft-Windows-AppLocker/MSI and Script' `
  -MaxEvents 50 -ErrorAction SilentlyContinue |
  Select-Object TimeCreated,Id,Message

Windows commands

REM Baseline
powershell.exe -NoProfile -ExecutionPolicy Bypass -File C:\PATH\SCRIPT.ps1

Verify → Record the exact failing layer and demonstrate the chosen permitted operation's actual effect.

If it fails → A language-mode error, antimalware block and script policy message require different next decisions. More detail ↓

If → then

  • An artifact disappears, a process is blocked, or execution is stopped with a policy/security event → Interpret endpoint-control evidence and select a justified alternative

    Needs: Observable evidence at the relevant boundary and a compatible alternative whose own prerequisites hold

  • Windows execution or valid credentials with an available remote service → Use Windows authenticated access or a PowerShell command channel

    Needs: Accepted remote-service rights or compatible PowerShell execution; correct encoding, policy context and callback route

  • A new Windows session or claimed administrator/SYSTEM transition → Establish Windows token, host and process context

    Needs: A functioning command channel and the actual effective token/process context

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

Explanation & examples

Distinguish PowerShell policy, language mode and protected execution layers

USE WHEN
PowerShell reports scripts disabled, constrained syntax or an execution-control error
STARTING ACCESS
A recorded delivery/execution chain with the expected consumer and effect
RESULT
An evidence-based diagnosis and compatible execution choice

Recognize the clue

Use the failing PowerShell error to inspect execution policy, language mode and actual runtime before choosing an allowed execution form.

Get-ExecutionPolicy -List
$ExecutionContext.SessionState.LanguageMode
$PSVersionTable
SYNTHETIC EXAMPLE OUTPUT
Error: script execution is disabled
LanguageMode: FullLanguage
Effective policy scope: inspect

Means: A script policy gate is distinct from language-mode restrictions or an antimalware verdict.

Confirm: Identify the actual controlling policy and permitted execution path; encoding/policy arguments do not remove unrelated controls.

After validation
The supported allowed operation executes in the verified context: choose it.
Ruled out in this context
The required feature is unavailable under the effective enforced policy/language context: reject that implementation.
Still inconclusive
Unknown policy precedence or no detailed error leaves the exact layer unresolved.

Troubleshooting: A language-mode error, antimalware block and script policy message require different next decisions.

Do not merge these different controls:

ControlWhat it changesUseful evidence
Execution policyConditions for loading/running scriptsGet-ExecutionPolicy -List and exact error
Language modeAvailable PowerShell language features$ExecutionContext.SessionState.LanguageMode
AMSISubmits supported script/content to antimalwareExplicit block/error plus Defender/PowerShell events
AppLocker/WDACApplication/script allow policyEffective policy and application-control events
Defender/other AVFile, memory, behavior and network decisionsStatus, detection history, quarantine/events
PermissionsFile/process/service/token rightsAccess-denied result under named identity

Read-only checks:

Cmdlets, logs and fields vary by edition, installed modules, permissions and control product. Missing output is inconclusive.

Execution policy is defense in depth, not a Windows security boundary. A process-scoped policy setting may change script-loading behavior when GPO does not override it:

This does not disable AMSI, application control, antimalware, permissions or network controls. Do not change persistent machine/user policy merely to test a payload.

Why it works

Execution policy, Constrained Language Mode, AMSI and WDAC/AppLocker operate at different boundaries. A command-line policy option does not remove every control or grant privileges.

Worked example · hypothetical

Observation: an unsigned script is blocked. Test: inspect policy and language mode. Illustrative output: a signed-script rule is active while simple allowed commands work. Interpretation: choose an allowed mechanism without claiming a universal bypass.

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