Schwachstellenseite unter Debian einrichten

Aus Xinux Wiki
Version vom 12. Mai 2025, 19:11 Uhr von Thomas.will (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „= Schwachstellenseite unter Debian einrichten = * Apache und PHP installieren: apt update apt install -y apache2 php libapache2-mod-php * PHP aktivieren un…“)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

Schwachstellenseite unter Debian einrichten

  • Apache und PHP installieren:
apt update
apt install -y apache2 php libapache2-mod-php
  • PHP aktivieren und Apache starten:
systemctl enable apache2
systemctl start apache2
  • Verzeichnis für Testseite anlegen:
mkdir -p /var/www/html/vulnsite
cd /var/www/html/vulnsite
  • index.html erstellen:
nano index.html
  • Inhalt einfügen:
<!DOCTYPE html>
<html>
<head><title>VulnSite</title></head>
<body>
  <h1>Schwachstellendemo</h1>

  <h2>Command Injection</h2>
  <form action="cmd.php" method="GET">
    <input name="cmd" placeholder="whoami"><input type="submit">
  </form>

  <h2>SQL Injection</h2>
  <form action="sqli.php" method="GET">
    <input name="id" placeholder="1 OR 1=1"><input type="submit">
  </form>

  <h2>XSS</h2>
  <form action="xss.php" method="GET">
    <input name="q" placeholder="Suchbegriff"><input type="submit">
  </form>

  <h2>LFI</h2>
  <form action="lfi.php" method="GET">
    <input name="file" placeholder="/etc/passwd"><input type="submit">
  </form>

  <h2>Upload</h2>
  <form action="upload.php" method="POST" enctype="multipart/form-data">
    <input type="file" name="upload"><input type="submit">
  </form>

  <h2>Redirect</h2>
  <form action="header.php" method="GET">
    <input name="redirect" placeholder="http://example.com"><input type="submit">
  </form>

  <p><a href="info.php">PHP Info</a></p>
  <p><a href="config.txt">Offene Konfigdatei</a></p>
  <p><a href="uploads/">Upload-Verzeichnis</a></p>
</body>
</html>
  • PHP-Dateien erstellen:
touch cmd.php sqli.php xss.php lfi.php upload.php header.php info.php
mkdir uploads
echo "dbpass = admin" > config.txt
chmod 777 uploads
  • Inhalt für cmd.php:
<?php
if (isset($_GET['cmd'])) {
  system($_GET['cmd']);
}
?>
  • Inhalt für sqli.php:
<?php
$id = $_GET['id'] ?? '';
echo "Sie haben Benutzer-ID: $id eingegeben.";
?>
  • Inhalt für xss.php:
<?php
$q = $_GET['q'] ?? '';
echo "<p>Ergebnis für: $q</p>";
?>
  • Inhalt für lfi.php:
<?php
$file = $_GET['file'] ?? '';
if ($file) {
  include($file);
}
?>
  • Inhalt für upload.php:
<?php
if (!empty($_FILES['upload'])) {
  move_uploaded_file($_FILES['upload']['tmp_name'], "uploads/" . basename($_FILES['upload']['name']));
  echo "Datei hochgeladen.";
}
?>
  • Inhalt für header.php:
<?php
$redirect = $_GET['redirect'] ?? '';
header("Location: $redirect");
?>
  • Inhalt für info.php:
<?php
phpinfo();
?>