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

正文內容

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

2025-03-16 22:48 本頁面
 

【文章內容簡介】 Dan Haagman, InfoSecurity 2023 Secure Coding Course, 169。 7Safe 2023/11/10 DBAppsecurtiy 2023 36 ? 下圖顯示結合 ESAPI設計你的程序 7Safe Company Overview 2023 Dan Haagman, InfoSecurity 2023 Secure Coding Course, 169。 7Safe 2023/11/10 DBAppsecurtiy 2023 37 ? 下圖簡單呈現(xiàn) ESAPI如何運作 7Safe Company Overview 2023 Dan Haagman, InfoSecurity 2023 Secure Coding Course, 169。 7Safe 2023/11/10 DBAppsecurtiy 2023 38 跨站腳本( XSS) ?定義 跨站腳本是最普遍的 web應用安全漏洞。 當應用程序在發(fā)送給瀏覽器的頁面中包含用戶提供的數(shù)據,但沒有經過適當驗證或 轉譯 那些內容,這就導致跨站腳本漏洞 。 ?危害 攻擊者能在受害者瀏覽器中執(zhí)行腳本以劫持用戶會話、迫害網站、插入惡意內容、重定向用戶、使用惡意軟件劫持用戶瀏覽器等等。 ?種類 已知有三種著名跨站漏洞: 1)存儲式; 2)反射式; 3)基于DOM。 反射式跨站腳本通過測試或代碼分析很容易找到。 7Safe Company Overview 2023 Dan Haagman, InfoSecurity 2023 Secure Coding Course, 169。 7Safe 2023/11/10 DBAppsecurtiy 2023 39 ? 解決之道 ? 驗證輸入 驗證輸入很簡單 檢查每個輸入的有效性。 這可能意味著很多東西,但在典型的和簡單的情況下,這意味著檢查輸入類型和數(shù)據的長度。 例如,如果你是從一個文本框接受一個標準的郵政編碼,你會知道,唯一有效的類型是一個數(shù)字( 09),而長度應該是 6,不能多也不能少。 并非所有 的案件都如此簡單,但很多是相似的。 下圖顯示驗證輸入的架構。 這里的關鍵是,一切都進行驗證,所有的輸入,這并不來自于應用程序(包括用戶輸入,請求頭, Cookie,數(shù)據庫數(shù)據 ...)。 7Safe Company Overview 2023 Dan Haagman, InfoSecurity 2023 Secure Coding Course, 169。 7Safe 2023/11/10 DBAppsecurtiy 2023 40 7Safe Company Overview 2023 Dan Haagman, InfoSecurity 2023 Secure Coding Course, 169。 7Safe 2023/11/10 DBAppsecurtiy 2023 41 ?實例 getValidInput( context, input, type, int maxLength, boolean allowNull, ValidationErrorList errors) isValidInput( context, input, type, int maxLength, boolean allowNull) String validatedFirstName = ().getValidInput(FirstName, (), FirstNameRegex, 255, false, errorList)。 boolean isValidFirstName = ().isValidInput(FirstName, (), FirstNameRegex, 255, false)。 7Safe Company Overview 2023 Dan Haagman, InfoSecurity 2023 Secure Coding Course, 169。 7Safe 2023/11/10 DBAppsecurtiy 2023 42 ? 編碼輸出 對驗證輸入的另一面就是編碼輸出。 編碼輸出,是用來確保字符 被視為數(shù)據,而不是作為 HTML元字符被瀏覽器解析。 這些技術定義一些特殊的“轉義”字符。 沒有正確轉義的數(shù)據它仍然會在瀏覽器中正確解析。 編碼輸出只是讓瀏覽器知道數(shù)據是不是要被解析,達到攻擊無法實現(xiàn)的目的。 需要編碼的部分: HTML實體 HTML屬性 Javascript CSS URL 下圖像顯示編碼輸出的架構。 7Safe Company Overview 2023 Dan Haagman, InfoSecurity 2023 Secure Coding Course, 169。 7Safe 2023/11/10 DBAppsecurtiy 2023 43 7Safe Company Overview 2023 Dan Haagman, InfoSecurity 2023 Secure Coding Course, 169。 7Safe 2023/11/10 DBAppsecurtiy 2023 44 ?實例 1——HTML實體編碼 //performing input validation String cleanComment = ().getValidInput(ment, (ment), CommentRegex, 300, false, errorList)。 //check the errorList here ... ... //performing output encoding for the HTML context String safeOutput = ().encodeForHTML( cleanComment )。 ?實例 2——URL編碼 //performing input validation String cleanUserName = ().getValidInput(userName, (userName), userNameRegex, 50, false, errorList)。 //check the errorList here ... ... //performing output encoding for the url context String safeOutput = /admin/?name= + ().encodeForURL(cleanUserName)。 7Safe Company Overview 2023 Dan Haagman, InfoSecurity 2023 Secure Coding Course, 169。 7Safe 2023/11/10 DBAppsecurtiy 2023 45 注入漏洞( Injection Flaws) ? 定義 簡單來說,注入往往是應用程序缺少對輸入進行安全性檢查 所引起的,攻擊者把一些包含指令的數(shù)據發(fā)送給解釋器,解釋器會把收到的數(shù)據轉換成指令執(zhí)行,注入漏洞十分普遍,通常能在 SQL查詢、 LDAP查詢、 Xpath查詢、 OS命令、程序參數(shù)等中出現(xiàn)。 ? 危害 注入能導致數(shù)據丟失或數(shù)據破壞、缺乏可審計性或是拒絕服務。注入漏洞有時甚至能導致完全接管主機。 ? 種類 SQL注入、 XPATH注入、 LDAP注入、 OS命令注入等。 7Safe Company Overview 2023 Dan Haagman, InfoSecurity 2023 Secure Coding Course, 169。 7Safe 2023/11/10 DBAppsecurtiy 2023 46 ? 解決之道 ? SQL注入實例 String sqlString = SELECT * FROM users WHERE fullname = 39。 + () + 39。 AND password = 39。 + () + 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ù)化查詢預處理 7Safe Company Overview 2023 Dan Haagman, InfoSecurity 2023 Secure Coding Course, 169。 7Safe 2023/11/10 DBAppsecurtiy 2023 47 使用 PreparedStatement()綁定變量 下面的代碼示例使用一個 PreparedStatement, Java的一個參數(shù)化查詢的執(zhí)行情況,執(zhí)行相同的數(shù)據 庫查詢。 String custname = (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 = ( query )。 ( 1, custname)。 ResultSet results = ( )。 ? 使用存儲過程 7Safe Company Overview 2023 Dan Haagman, InfoSecurity 2023 Secure Coding Course, 169。 7Safe 2023/11/10 DBAppsecurtiy 2023 48 String custname = (customerName)。 // This should REALLY be validated try { CallableStatement cs = ({call sp_getAccountBalance(?)})。 (1, custname)。 ResultSet results = ()。 // … result set handling } catch (SQLException se) { // … logging and error handling } 7Safe Company Overview 2023 Dan Haagman, InfoSecurity 2023 Secure Coding Course, 169。 7Safe 2023/11/10 DBAppsecurtiy 2023 49 ? 使用 ESAPI //ESAPI version of query Codec ORACLE_CODEC = new OracleCodec()。 //we39。re using oracle String query = SELECT name FROM users WHERE id = + ().encodeForSQL( ORACLE_CODEC, validatedUserId) + AND date_created = 39。 + ().encodeForSQL( ORACLE_CODEC, validatedStartDate) +39。 myStmt = (query)。 ... //execute statement and get results 7Safe Company Overvi
點擊復制文檔內容
教學課件相關推薦
文庫吧 www.dybbs8.com
備案圖片鄂ICP備17016276號-1