freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

軟件安全開發(fā)生命周期概述(編輯修改稿)

2024-11-19 22:19 本頁面
 

【文章內(nèi)容簡介】 ring safeOutput = ESAPI.encoder().encodeForHTML( cleanComment )。 實例2——URL編碼 //performing input validation String cleanUserName = ESAPI.validator().getValidInput(“userName“, request.getParameter(“userName“), “userNameRegex“, 50, false, errorList)。 //check the errorList here . . //performing output encoding for the url context String safeOutput = “/admin/findUser.do?name=“ + ESAPI.encoder().encodeForURL(cleanUserName)。,注入漏洞(Injection Flaws),定義 簡單來說,注入往往是應(yīng)用程序缺少對輸入進行安全性檢查 所引起的,攻擊者把一些包含指令的數(shù)據(jù)發(fā)送給解釋器,解釋器會把收到的數(shù)據(jù)轉(zhuǎn)換成指令執(zhí)行,注入漏洞十分普遍,通常能在SQL查詢、LDAP查詢、Xpath查詢、OS命令、程序參數(shù)等中出現(xiàn)。 危害 注入能導(dǎo)致數(shù)據(jù)丟失或數(shù)據(jù)破壞、缺乏可審計性或是拒絕服務(wù)。注入漏洞有時甚至能導(dǎo)致完全接管主機。 種類 SQL注入、XPATH注入、LDAP注入、OS命令注入等。,解決之道 SQL注入實例 String sqlString = “SELECT * FROM users WHERE fullname = 39?!?+ form.getFullName() + “39。 AND password = 39?!?+ form.getPassword() + “39?!啊?正常:username=tony,password=123456 SELECT * FROM users WHERE username = tony39。 AND password = 39。12345639。 攻擊: username=tony,password= 39。 OR 39。139。 = 39。1 SELECT * FROM users WHERE username = tony39。 AND password = 39。 39。 OR 39。139。 = 39。139。 參數(shù)化查詢預(yù)處理,使用PreparedStatement()綁定變量 下面的代碼示例使用一個PreparedStatement,Java的一個參數(shù)化查詢的執(zhí)行情況,執(zhí)行相同的數(shù)據(jù) 庫查詢。 String custname = request.getParameter(“customerName“)。 // This should REALLY be validated too // perform input validation to detect attacks String query = “SELECT account_balance FROM user_data WHERE user_name = ? “。 PreparedStatement pstmt = connection.prepareStatement( query )。 pstmt.setString( 1, custname)。 ResultSet results = pstmt.executeQuery( )。 使用存儲過程,String custname = request.getParameter(“customerName“)。 // This should REALLY be validated try { CallableStatement cs = connection.prepareCall(“{call sp_getAccountBalance(?)}“)。 cs.setString(1, custname)。 ResultSet results = cs.executeQuery()。 // … result set handling } catch (SQLException se) { // … logging and error handling },使用ESAPI //ESAPI version of query Codec ORACLE_CODEC = new OracleCodec()。 //we39。re using oracle String query = “SELECT name FROM users WHERE id = “ + ESAPI.encoder().encodeForSQL( ORACLE_CODEC, validatedUserId) + “ AND date_created = 39。“ + ESAPI.encoder().encodeForSQL( ORACLE_CODEC, validatedStartDate) +“39。“。 myStmt = conn.createStatement(query)。 . //execute statement and get results,惡意文件執(zhí)行,定義 惡意文件執(zhí)行是一種能夠威脅任何網(wǎng)站形式的漏洞,只要攻擊者在具有引入(include)功能程式的參數(shù)中修改參數(shù)內(nèi)容,WEB服務(wù)器便會引入惡意程序內(nèi)容從而受到惡意文件執(zhí)行漏洞攻擊。 危害 攻擊者可利用惡意文件執(zhí)行漏洞進行攻擊取得WEB服務(wù)器控制權(quán),進行不法利益或獲取經(jīng)濟利益。 解決之道 實例1 驗證輸入,使用ESAPI驗證上傳文件名,if (!ESAPI.validator().isValidFileName(“upload“, filename, allowedExtensions, false)) { throw new ValidationUploadException(“Upload only simple filenames with the following extensions “ + allowedExtensions, “Upload failed isValidFileName check“)。 } 實例2 使用ESAPI檢查上傳文件大小 ServletFileUpload upload = new ServletFileUpload(factory)。 upload.setSizeMax(maxBytes)。,不安全的直接對象引用,定義 所謂“不安全的對象直接引用”,即Insecure direct object references,意指一個已經(jīng)授權(quán)的用戶,通過更改 訪問時的一個參數(shù),從而訪問到了原本其并沒有得到授權(quán)的對象。Web應(yīng) 用往往在生成Web頁面時會用它的真實名字,且并不會對所有的目標對象訪問時來檢查用戶權(quán)限,所以這就造成了不安全的 對象直接引用的漏洞。 我們看如下的一個示例,也許這樣就更容易理解什么是不安 全的對象直接引用。 攻擊者發(fā)現(xiàn)他自己的參數(shù)是6065, 即?acct=6065; 他可以直接更改參數(shù)為6066, 即?acct=6066; 這樣他就可以直接看到6066用 戶的賬戶信息了。,危害 這種漏洞能損害參數(shù)所引用的所有數(shù)據(jù)。除非名字空間很稀疏,否則攻擊者很容易訪問該類型的所有數(shù)據(jù)。 解決之道 案例1 使用ESAPI的AccessReferenceMap實現(xiàn)使用非直接的對象引用 MyObject obj。 // generate your object Collection coll。 // holds objects for display in UI //creat
點擊復(fù)制文檔內(nèi)容
公司管理相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1