Web滲透_手動漏洞挖掘

手動漏洞挖掘

預設安裝

Windows預設安裝漏洞

phpMyAdmin/setup

Ubuntu / Debian預設安裝PHP5-cgi

可直接訪問 /cgi-bin/php5 和 /cgi-bin/php (爬不出來的目錄)

身份認證

常用弱口令 / 基於字典的密碼爆破

鎖定賬號

資訊收集

手機號

密碼錯誤提示資訊

密碼嗅探

會話session ID

Xss / cookie importer

SessionID in URL

嗅探

SessionID 長期不變 / 永久不變

SessionID生成演算法

Sequencer

私有演算法

預判下一次登入時生成的SessionID

登出後返回測試

Web滲透_手動漏洞挖掘

漏洞挖掘原則

所有變數

所有頭

Cookie中的變數

逐個變數刪除

漏洞的本質

資料與指令混淆

對使用者輸入資訊過濾不嚴判斷失誤,誤將指令當資料

命令執行

應用程式開發者直接呼叫作業系統的功能

;&& | || &

檢視原始碼,過濾使用者輸入

對使用者輸入沒有進行篩選區分:

Web滲透_手動漏洞挖掘

這時我們看原始碼可以看到沒有任何過濾措施

<?phpif( isset( $_POST[ ‘submit’ ] ) ) { $target = $_REQUEST[ ‘ip’ ]; // Determine OS and execute the ping command。 if (stristr(php_uname(‘s’), ‘Windows NT’)) { $cmd = shell_exec( ‘ping ’ 。 $target ); echo ‘

’。$cmd。‘
’; } else { $cmd = shell_exec( ‘ping -c 3 ’ 。 $target ); echo ‘
’。$cmd。‘
’; } }?>

如果你把dvwa修改成中級別,發現命令不可用,因為已經對某些特殊符號進行了修改

<?phpif( isset( $_POST[ ‘submit’] ) ) { $target = $_REQUEST[ ‘ip’ ]; // Remove any of the charactars in the array (blacklist)。 $substitutions = array( ‘&&’ => ‘’, ‘;’ => ‘’, ); $target = str_replace( array_keys( $substitutions ), $substitutions, $target ); // Determine OS and execute the ping command。 if (stristr(php_uname(‘s’), ‘Windows NT’)) { $cmd = shell_exec( ‘ping ’ 。 $target ); echo ‘

’。$cmd。‘
’; } else { $cmd = shell_exec( ‘ping -c 3 ’ 。 $target ); echo ‘
’。$cmd。‘
’; }}?>

但是我們看到它只是對;以及&&進行過濾,其他的不行

Web滲透_手動漏洞挖掘

如果改成高級別就很完善了

<?phpif( isset( $_POST[ ‘submit’ ] ) ) { $target = $_REQUEST[“ip”]; $target = stripslashes( $target ); // Split the IP into 4 octects $octet = explode(“。”, $target); // Check IF each octet is an integer if ((is_numeric($octet[0])) && (is_numeric($octet[1])) && (is_numeric($octet[2])) && (is_numeric($octet[3])) && (sizeof($octet) == 4) ) { // If all 4 octets are int‘s put the IP back together。 $target = $octet[0]。’。‘。$octet[1]。’。‘。$octet[2]。’。‘。$octet[3]; // Determine OS and execute the ping command。 if (stristr(php_uname(’s‘), ’Windows NT‘)) { $cmd = shell_exec( ’ping ‘ 。 $target ); echo ’

‘。$cmd。’
‘; } else { $cmd = shell_exec( ’ping -c 3 ‘ 。 $target ); echo ’
‘。$cmd。’
‘; } } else { echo ’
ERROR: You have entered an invalid IP
‘; } }?>

上述程式碼既保證你輸入的肯定是數字,也保證你肯定是xxx。xxx。xxx。xxx格式的