π―Skills Assessment
π― Final Assessment: Comprehensive practical scenario integrating all command injection techniques
Overview
This Skills Assessment represents a real-world penetration testing scenario that requires students to apply all the techniques learned throughout the Command Injection module. The challenge involves a web-based file manager application with command injection vulnerabilities that must be identified and exploited using advanced bypass techniques.
Skills Tested:
Web application reconnaissance
Command injection detection
GET parameter manipulation
Filter identification and bypass
Multiple payload construction methods
Tool integration (Burp Suite)
Challenge Description
Target Application: Web File Manager
Question: What is the content of '/flag.txt'?
Initial Access:
URL: Target machine web interface
Credentials:
guest:guestApplication Type: Web-based file management system
Step-by-Step Walkthrough
Phase 1: Initial Access and Reconnaissance
Step 1: Login to Application
After spawning the target machine, navigate to the website's root webpage and login with the provided credentials:
Step 2: Application Analysis
Once signed in to the web-based file manager, observe the available functionality:
File listing - Multiple files and folders visible
File operations - Four clickable buttons per file:
Preview
Copy to...
Direct link
Download
Step 3: Identify Attack Vector
The "Copy to..." button appears most promising for command injection because:
Backend likely uses system commands (
mv,move,cp)File operations typically involve OS-level commands
Parameters are likely passed to shell commands
Phase 2: Vulnerability Discovery
Step 4: Test Copy Functionality
Clicking "Copy to..." redirects to a new page with:
Two main options: Copy and Move
Destination selection: Folder chooser
URL parameters: Visible in address bar
Step 5: Initial Injection Testing
Testing the Copy function with character injection in URL shows no command execution indicators.
Step 6: Focus on Move Functionality
Testing the Move function without selecting destination folder produces error:
Error Message Example:
Key Insight: This error reveals:
Backend uses
mvcommandError messages are displayed to user
We can capture command output through error messages
Phase 3: Injection Vector Identification
Step 7: Analyze Request Parameters
Using Burp Suite to intercept the Move request reveals two GET parameters:
to- Destination pathfrom- Source file
Example Request:
Step 8: Test Injection Operators
Testing various injection operators in both parameters:
;
"Malicious request denied!"
|
"Malicious request denied!"
&&
"Malicious request denied!"
&
β Request passes
Key Discovery: The & operator is whitelisted because developers assumed it's required for URL structure.
Phase 4: Exploitation Development
Step 9: Parameter Selection
Both to and from parameters can be used for injection since they both constitute the command being executed by the backend.
Step 10: Payload Construction Requirements
To successfully read /flag.txt, we need to bypass:
Space filter - Use
$IFSor%09Slash filter - Use
${PATH:0:1}Command detection - Use quote obfuscation
Step 11: Payload Development
Method 1: Direct Command with Obfuscation
Method 2: Base64 Encoded Command
Phase 5: Exploitation Execution
Step 12: Burp Suite Setup
Configure Proxy: Set FoxyProxy to "BURP" profile
Intercept Request: Click Move with no destination folder
Send to Repeater: Use Ctrl+R to send intercepted request
Step 13: Execute Method 1 (Direct Command)
Modified Request:
Step 14: Execute Method 2 (Base64 Encoded)
Modified Request:
Phase 6: Flag Extraction
Step 15: Analyze Response
Both payloads will return the flag in the error message section of the HTTP response.
Expected Flag:
Technical Analysis
Vulnerability Details
Injection Point: GET parameters in web file manager
Root Cause:
Insufficient input validation
Direct parameter interpolation into system commands
Error message disclosure
Filter Analysis
Implemented Filters:
β Semicolon (
;) blockedβ Pipe (
|) blockedβ AND (
&&) blockedβ Ampersand (
&) whitelisted
Filter Bypass Strategy:
Space bypass:
$IFSenvironment variableSlash bypass:
${PATH:0:1}character extractionCommand obfuscation: Quote injection (
c"a"t)Encoding: Base64 for complex commands
Alternative Exploitation Methods
Method 3: Environment Variable Techniques
Using Multiple Environment Variables:
Payload Example:
Method 4: Advanced Obfuscation Combinations
Multi-layer Obfuscation:
Method 5: Windows Alternative (If Applicable)
Windows Environment Variables:
Defense Analysis
Identified Security Weaknesses
Input Validation Failure
No sanitization of user input
Direct parameter interpolation
Filter Implementation Flaws
Incomplete blacklist approach
URL context assumptions (& whitelisting)
Error Information Disclosure
System error messages exposed
Command output visible to users
Command Execution Design
Direct shell command execution
No command isolation
Recommended Mitigations
1. Input Validation
2. Parameterized Operations
3. Error Handling
Learning Outcomes
Skills Demonstrated
β Technical Skills:
Web application analysis
HTTP parameter manipulation
Command injection exploitation
Filter identification and bypass
Multiple payload construction
Tool integration (Burp Suite)
β Methodology:
Systematic vulnerability assessment
Incremental exploitation development
Alternative approach consideration
Defense-aware testing
β Real-world Application:
Professional penetration testing workflow
Documentation and reporting
Risk assessment and mitigation
Attack Chain Summary
Key Takeaways
Critical Success Factors
Systematic Approach - Methodical testing of all functions
Filter Analysis - Understanding what's blocked vs. allowed
Multiple Techniques - Having backup exploitation methods
Tool Proficiency - Effective use of Burp Suite
Bypass Creativity - Combining multiple evasion techniques
Professional Applications
Web Application Security Testing
File Manager Vulnerability Assessment
GET Parameter Security Analysis
Error-based Information Disclosure Testing
This comprehensive Skills Assessment demonstrates mastery of command injection techniques in a realistic web application environment, preparing students for professional penetration testing scenarios.
Last updated