Skip to content
KitploitKITPLOIT
ToolsBlog
Einreichen
ToolsBlog
Einreichen

Hacking-, PenTest- und Cybersicherheits-Tools für Ihr Sicherheitsarsenal!

Kitploit ist ein Verzeichnis von Hacking-, Cybersicherheits- und Pentesting-Tools. Entdecken Sie die neuesten Projekt-Updates, um Schwachstellen zu finden, Systeme zu analysieren, Tests zu automatisieren und Ihre Sicherheit zu stärken.

··Feeds·Kontakt·Datenschutz·© 2026 Kitploit

Tool-Verzeichnis

Kategorien

Alle Kategorien anzeigen
Loading categories
CVE-2017-5638-Attack-and-Defense — # Docker-basiertes Sicherheitslabor zur Demonstration von Apache Struts2 S2-045 (CVE-2017-5638) Ausnutzung und Verteidigung, mit verwundbaren und gepatchten Anwendungen sowie WAF-Schutz für praxisnahes Training. | Kitploit
Tools/GitHubGitHub/acharaf06/cve-2017-5638-attack-and-defense
DefensivwerkzeugeSchwachstellenanalyseWebanwendungs-ExploitationWAF-UmgehungPenetrationstestsLernen & BildungLabs & Praxis
GitHubacharaf06/cve-2017-5638-attack-and-defense

Beliebteste

Alle anzeigen →

Entdecken Sie die meistgenutzten Tools unserer Community.

Alle Tools erkunden

Durchsuchen Sie unsere Tool-Sammlung

Alle Tools anzeigen →

CVE-2017-5638-Attack-and-Defense

# Docker-basiertes Sicherheitslabor zur Demonstration von Apache Struts2 S2-045 (CVE-2017-5638) Ausnutzung und Verteidigung, mit verwundbaren und gepatchten Anwendungen sowie WAF-Schutz für praxisnahes Training.

Repository anzeigen
15vor 8 MonatenNoch nicht geprüft
Teilen

Apache Struts2 S2-045 Abwehr- und Exploitation-Labor

Ein Docker-basiertes Sicherheitslabor, das sowohl Exploitation als auch Abwehr der Apache Struts2 S2-045-Sicherheitslücke (CVE-2017-5638) demonstriert. Dieses Labor umfasst:

  1. Verwundbare Anwendung: Struts 2.3.31 (anfällig für S2-045) zur Exploitation-Demonstration
  2. Abwehr-Labor: Struts 6.3.x (gepatcht) mit WAF-Schutz für defensive Schulungen

⚠️ Sicherheitswarnung: Dieses Labor enthält funktionsfähige Exploits und verwundbaren Code. Nur in isolierten Umgebungen verwenden. Nicht öffentlichen Netzwerken aussetzen.

Architekturübersicht

root@kitploit:~
┌─────────────────────────────────────────────────────────────┐
│                     Host (127.0.0.1 only)                   │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  ┌─────────────────┐    ┌─────────────────┐              │
│  │   Simulator     │───▶│  Nginx Proxy    │              │
│  │  (curl-based)   │    │  + WAF Rules    │              │
│  └─────────────────┘    └────────┬────────┘              │
│                                  │                        │
│                          ┌───────┴────────┐              │
│                          │                │                │
│                  ┌───────▼──────┐ ┌───────▼──────┐        │
│                  │  Defense App │ │ Vulnerable   │        │
│                  │ (Struts 6.3) │ │ App (2.3.31) │        │
│                  │ Port: 8080  │ │ Port: 8081  │        │
│                  └──────────────┘ └──────────────┘        │
│                                                             │
│  ┌─────────────────┐                                      │
│  │  Exploit        │───▶ Vulnerable App (8081)            │
│  │  Container      │                                      │
│  └─────────────────┘                                      │
│                                                             │
│  Logs mounted to: ./logs/nginx/, ./logs/app/,             │
│                   ./logs/app-vulnerable/                  │
└─────────────────────────────────────────────────────────────┘

Komponenten

ContainerZweckPort
nginxReverse-Proxy mit WAF-Regeln, Ratenbegrenzung127.0.0.1:8080
appTomcat 9 + Struts 6.3.x (gepatcht, Abwehr-Labor)Nur intern
app-vulnerableTomcat 9 + Struts 2.3.31 (verwundbar, für Exploitation)127.0.0.1:8081
exploitContainer zur Exploitation-DemonstrationN/A
simulatorSendet Testanfragen (harmlose + verdächtige Muster)N/A

Erste Schritte

Voraussetzungen

  • Docker (Version 20.10 oder neuer)
  • Docker Compose (Version 2.0 oder neuer)
  • Python 3 (optional, zum direkten Ausführen von Exploit-Skripten)
  • curl (optional, für manuelle Tests)

Installation

1. Repository klonen

root@kitploit:~
# Clone the repository
git clone https://github.com/ACharaf06/cybersec.git
cd cybersec

2. Bauen und Ausführen

root@kitploit:~
# Build all containers (this may take several minutes on first run)
docker compose build

# Start the defense lab (nginx + patched app)
docker compose up -d nginx app

# Start the vulnerable app (for exploitation demo)
docker compose up -d app-vulnerable

# Verify services are running
docker compose ps

# Wait for services to be healthy (about 60 seconds)
sleep 60

# Check health endpoints
curl http://127.0.0.1:8080/struts-lab/health  # Defense lab
curl http://127.0.0.1:8081/struts-lab/health   # Vulnerable app

Erwartete Ausgabe:

  • Abwehr-Labor: JSON-Antwort mit "status":"healthy" und "strutsVersion":"6.3.0.2 (gepatcht – nicht anfällig für S2-045)"
  • Verwundbare App: JSON-Antwort mit "status":"healthy" und "strutsVersion":"2.3.31 (VULNERABLE to S2-045)"

2. Abwehr-Labor-Tests

root@kitploit:~
# Run the simulator container (tests defense mechanisms)
docker-compose run --rm simulator

# Or run individual tests manually:
# Legitimate upload
curl -X POST -F "[email protected]" http://127.0.0.1:8080/struts-lab/upload

# Suspicious Content-Type (will be blocked by WAF)
curl -v -X POST \
  -H "Content-Type: multipart/form-data; boundary=----SUSPICIOUS" \
  http://127.0.0.1:8080/struts-lab/upload

3. Exploitation-Demonstration

root@kitploit:~
# Run the exploit container (demonstrates S2-045 exploitation)
docker-compose --profile exploit run --rm exploit

# Or use the Python exploit script directly
python3 exploit/exploit.py http://127.0.0.1:8081/struts-lab 'whoami'

# Or use the bash script
./exploit/demo_exploit.sh

⚠️ Warnung: Die verwundbare Anwendung ist absichtlich ausnutzbar. Nur in isolierten Umgebungen ausführen.

4. Logs beobachten

root@kitploit:~
# Defense lab logs
tail -f logs/nginx/access.log      # Nginx access logs
tail -f logs/nginx/error.log       # WAF blocks
tail -f logs/app/struts-lab.log    # Defense app logs

# Vulnerable app logs
tail -f logs/app-vulnerable/struts-lab.log  # Vulnerable app logs

# All logs combined
docker-compose logs -f

Was zu beobachten ist

Abwehr-Labor (Port 8080)

Legitime Anfrage:

  • Nginx-Zugriffslog: 200-Antwort
  • App-Log: INFO-Level Upload-Verarbeitungsmeldung
  • Anfrage wird erfolgreich abgeschlossen

Verdächtige/fehlerhafte Anfrage:

  • Nginx-Zugriffslog: 403 Forbidden oder 400 Bad Request
  • Nginx-Fehlerlog: WAF-Regel ausgelöst-Meldung
  • App-Log: Kann Parsing-Fehler zeigen, falls Anfrage die App erreicht
  • Anfrage wird blockiert oder bereinigt

Verwundbare App (Port 8081)

Erfolgreiche Exploitation:

  • HTTP 200- oder 500-Antwort
  • Befehlsausgabe im Antworttext sichtbar
  • OGNL-Ausdrücke ausgewertet
  • Systembefehle ausgeführt

Log-Beispiele:

Nginx blockiert verdächtigen Content-Type (Abwehr-Labor):

root@kitploit:~
[WAF] Blocked suspicious Content-Type pattern - Request ID: abc123

App protokolliert Anfrage-Metadaten (Abwehr-Labor):

root@kitploit:~
[REQUEST] ID=abc123 Content-Type=multipart/form-data Method=POST URI=/upload
[UPLOAD] Processing file upload for request abc123

Erfolgreiche Exploitation (Verwundbare App):

root@kitploit:~
HTTP/1.1 200 OK
...
root
(Command output appears in response body)

Vergleich: Verwundbar vs. Abwehr

MerkmalVerwundbare App (Port 8081)Abwehr-Labor (Port 8080)
Struts Version2.3.31 (verwundbar)6.3.0.2 (gepatcht)
WAF-Schutz❌ Kein✅ Nginx-WAF-Regeln
Ratenbegrenzung❌ Kein✅ 10 Anfragen/s
Anfragegrößenbegrenzungen❌ Kein✅ 10 MB Body, 8 KB Header
Sicherheitsprotokollierung⚠️ Minimal✅ Umfassend
OGNL-Injection✅ Ausnutzbar❌ Blockiert/Gepatcht
RCE möglich✅ Ja❌ Nein
AnwendungsfallExploitation-DemoAbwehr-Schulung

Sicherheitshinweise

Isolation

  • Alle Dienste nur an 127.0.0.1 gebunden (kein externer Zugriff)
  • Internes Docker-Netzwerk für Container-Kommunikation
  • Keine Port-Exposition auf 0.0.0.0
  • Die verwundbare App sollte NIEMALS öffentlichen Netzwerken ausgesetzt werden

Abwehrschichten (Abwehr-Labor)

  1. Nginx-WAF-Regeln: Blockieren verdächtige Content-Type-Muster, bevor sie die App erreichen
  2. Ratenbegrenzung: 10 Anfragen/Sekunde pro IP
  3. Anfragegrößenbegrenzungen: max. 10 MB Body, max. 8 KB Header
  4. Gepatchtes Struts: Verwendet Struts 6.3.x (nicht anfällig für S2-045)
  5. Umfassende Protokollierung: Alle verdächtigen Aktivitäten werden protokolliert

Was S2-045 war

S2-045 (CVE-2017-5638) war eine kritische Sicherheitslücke in Apache Struts2 Versionen 2.3.5 - 2.3.31 und 2.5 - 2.5.10, bei der:

  • Böswillige Content-Type-Header konnten OGNL-Ausdrücke injizieren
  • Der Jakarta Multipart-Parser wertete diese Ausdrücke aus
  • Dies führte zur Remote-Code-Ausführung (RCE)

Die verwundbare App (Port 8081) demonstriert diese Sicherheitslücke. Das Abwehr-Labor (Port 8080) zeigt, wie man sich dagegen schützt.

Dateistruktur

root@kitploit:~
.
├── docker-compose.yml          # Container orchestration
├── README.md                   # This file
├── EXPLOITATION_GUIDE.md      # Detailed exploitation guide
├── TECHNICAL_DETAILS.md        # Technical implementation details
├── GLOSSARY.md                 # Security terms glossary
├── nginx/
│   ├── nginx.conf              # Main nginx configuration
│   └── waf-rules.conf          # WAF rules for S2-045 patterns
├── app/                        # Defense lab (patched)
│   ├── Dockerfile              # Tomcat + Maven build
│   └── struts-app/
│       ├── pom.xml             # Maven project (Struts 6.3.x)
│       └── src/main/
│           ├── java/           # Action classes
│           ├── resources/      # Struts + Log4j config
│           └── webapp/         # JSP views + web.xml
├── app-vulnerable/             # Vulnerable app (for exploitation)
│   ├── Dockerfile              # Tomcat + Maven build
│   └── struts-app/
│       ├── pom.xml             # Maven project (Struts 2.3.31)
│       └── src/main/
│           ├── java/           # Action classes
│           ├── resources/      # Struts + Log4j config
│           └── webapp/         # JSP views + web.xml
├── exploit/                    # Exploitation tools
│   ├── Dockerfile              # Exploit container
│   ├── demo_exploit.sh         # Bash exploit script
│   └── exploit.py              # Python exploit script
├── simulator/
│   ├── Dockerfile              # Alpine + curl
│   └── simulate.sh             # Test script
└── logs/                       # Mounted log directory
    ├── nginx/
    ├── app/                    # Defense lab logs
    └── app-vulnerable/         # Vulnerable app logs

Bereinigung

root@kitploit:~
# Stop all containers
docker compose down

# Remove volumes and logs
docker compose down -v
rm -rf logs/

# Full cleanup (including images)
docker compose down --rmi all -v

Entwicklungseinrichtung

Projektstruktur

Das Projekt ist wie folgt organisiert:

  • app/ - Abwehr-Labor-Anwendung (Struts 6.3.x, gepatcht)
  • app-vulnerable/ - Verwundbare Anwendung (Struts 2.3.31)
  • exploit/ - Exploitation-Tools und -Skripte
  • nginx/ - Nginx-Reverse-Proxy-Konfiguration mit WAF-Regeln
  • simulator/ - Angriffsmuster-Simulator
  • logs/ - Anwendungslogs (gitignoriert)

Individuelle Komponenten bauen

root@kitploit:~
# Rebuild only the vulnerable app
docker compose build app-vulnerable
docker compose up -d app-vulnerable

# Rebuild only the defense app
docker compose build app
docker compose up -d app

# Rebuild exploit container
docker compose build exploit

Dokumentation

  • EXPLOITATION_GUIDE.md: Detaillierte Anleitung zum S2-045-Sicherheitslückenmechanismus und Exploitationsverfahren
  • TECHNICAL_DETAILS.md: Technische Implementierungsdetails des Labors
  • GLOSSARY.md: Glossar der in diesem Labor verwendeten Sicherheitsbegriffe

Bildungsressourcen

  • Apache Struts Sicherheitsbulletins
  • CVE-2017-5638 Details
  • OWASP Injection Prevention
  • Metasploit S2-045 Modul

⚠️ Wichtige Warnungen

  1. Verwundbare Anwendung: Die App auf Port 8081 ist absichtlich verwundbar. Nicht öffentlichen Netzwerken aussetzen.
  2. Funktionsfähige Exploits: Dieses Labor enthält funktionsfähigen Exploit-Code. Nur in isolierten Umgebungen verwenden.
  3. Bildungszweck: Dieses Labor dient nur der Sicherheitsbildung, Forschung und autorisierten Penetrationstests.
  4. Rechtliche Einhaltung: Nur auf Systemen verwenden, die Ihnen gehören oder für die Sie eine ausdrückliche schriftliche Genehmigung zum Testen haben.

Haftungsausschluss: Dieses Labor dient nur zu Bildungszwecken. Verantwortungsvoll und nur in kontrollierten Umgebungen verwenden.

Tool herunterladen