网络安全 DVWA通关指南 DVWA File Upload(文件上传)
DVWA File Upload(文件上传) 参考文献 WEB 安全靶场通关指南 修复建议 1、使用白名单限制可以上传的文件扩展名 2、注意0x00截断攻击(PHP更新到最新版本) ...
DVWA File Upload(文件上传) 参考文献 WEB 安全靶场通关指南 修复建议 1、使用白名单限制可以上传的文件扩展名 2、注意0x00截断攻击(PHP更新到最新版本) ...
DVWAReflected Cross Site Scripting (反射型 XSS) 参考文献 WEB 安全靶场通关指南 XSS跨站原理 当应用程序发送给浏览器的页面中包含用户提交的数据,但没有经过适当验证或转义时,就会导致跨站脚本漏洞。这个“跨”实际上属于浏览器的特性,而不是缺陷; ...
DVWASQLInjection (Blind) 参考文献 WEB 安全靶场通关指南 Low 0、分析网页源代码 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 <?php if( isset( $_GET[ 'Submit' ] ) ) { // Get input $id = $_GET[ 'id' ]; // Check database $getid = "SELECT first_name, last_name FROM users WHERE user_id = '$id';"; $result = mysqli_query($GLOBALS["___mysqli_ston"], $getid ); // Removed 'or die' to suppress mysql errors // Get results $num = @mysqli_num_rows( $result ); // The '@' character suppresses errors if( $num > 0 ) { // Feedback for end user $html .= '<pre>User ID exists in the database.</pre>'; } else { // User wasn't found, so the page wasn't! header( $_SERVER[ 'SERVER_PROTOCOL' ] . ' 404 Not Found' ); // Feedback for end user $html .= '<pre>User ID is MISSING from the database.</pre>'; } ((is_null($___mysqli_res = mysqli_close($GLOBALS["___mysqli_ston"]))) ? false : $___mysqli_res); } ?> <?php // 检查是否点击了提交按钮(例如,表单提交) if( isset( $_GET[ 'Submit' ] ) ) { // 获取用户通过GET方式传递的ID值 $id = $_GET[ 'id' ]; // 创建SQL查询语句:根据$user_id查询users表中的first_name和last_name字段 $getid = "SELECT first_name, last_name FROM users WHERE user_id = '$id';"; // 执行SQL查询(假设$___mysqli_ston是全局的数据库连接对象) // 使用@字符抑制可能出现的MySQL错误信息 $result = mysqli_query($GLOBALS["___mysqli_ston"], $getid ); // 获取查询结果中记录的数量 $num = @mysqli_num_rows( $result ); // 判断查询结果中是否存在记录 if( $num > 0 ) { // 如果查询到至少一条记录,则输出反馈信息表示用户ID存在于数据库中 $html .= '<pre>User ID exists in the database.</pre>'; } else { // 若未查询到任何记录,则发送HTTP 404状态码(页面未找到) header( $_SERVER[ 'SERVER_PROTOCOL' ] . ' 404 Not Found' ); // 同时输出反馈信息表示用户ID在数据库中不存在 $html .= '<pre>User ID is MISSING from the database.</pre>'; } // 关闭数据库连接 ((is_null($___mysqli_res = mysqli_close($GLOBALS["___mysqli_ston"]))) ? false : $___mysqli_res); } ?> // 从URL参数中获取一个id,然后查询数据库中是否存在对应这个id的用户。如果存在,它会在页面上显示"User ID exists in the database.";如果不存在,则发送HTTP 404状态码并显示"User ID is MISSING from the database."。 网页不会直接返回数据,而是返回特定信息。比如输入1,页面返回“User ID exists in the database.”,查询内容没有回显。 ...
DVWAStored Cross Site Scripting (存储型 XSS) 参考文献 WEB 安全靶场通关指南 XSS跨站原理 当应用程序发送给浏览器的页面中包含用户提交的数据,但没有经过适当验证或转义时,就会导致跨站脚本漏洞。这个“跨”实际上属于浏览器的特性,而不是缺陷; ...
DVWA WeakSessionIDs(弱会话) 参考文献 WEB 安全靶场通关指南 Low Level 1、分析网页源代码 1 2 3 4 5 6 7 8 9 10 11 12 13 <?php $html = ""; if ($_SERVER['REQUEST_METHOD'] == "POST") { if (!isset ($_SESSION['last_session_id'])) { $_SESSION['last_session_id'] = 0; } $_SESSION['last_session_id']++; $cookie_value = $_SESSION['last_session_id']; setcookie("dvwaSession", $cookie_value); } ?> Low级别的cookie生成方式:如果 $cookie_value不存在就设为0,存在则$ cookie_value加1,最后以dvwaSession=$cookie_value呈现。 ...