May062020
DVWA-12.2 XSS (Stored)(存储型跨站脚本)-Medium
Medium Level
查看代码
<?php
if( isset( $_POST[ 'btnSign' ] ) ) {
// Get input
$message = trim( $_POST[ 'mtxMessage' ] );
$name = trim( $_POST[ 'txtName' ] );
// Sanitize message input
$message = strip_tags( addslashes( $message ) );
$message = ((isset($GLOBALS["___mysqli_ston"]) && is_object($GLOBALS["___mysqli_ston"])...阅读全文
抢沙发
May062020
DVWA-12.1 XSS (Stored)(存储型跨站脚本)-Low
Low Level
查看代码
<?php
if( isset( $_POST[ 'btnSign' ] ) ) {
// Get input
$message = trim( $_POST[ 'mtxMessage' ] );
$name = trim( $_POST[ 'txtName' ] );
// Sanitize message input
$message = stripslashes( $message );
$message = ((isset($GLOBALS["___mysqli_ston"]) && is_object($GLOBALS["___mysqli_ston"])) ? mysqli_real...阅读全文
May062020
DVWA-11.4 XSS (Reflected)(反射型跨站脚本)-Impossible
Impossible Level
查看源码
<?php
// Is there any input?
if( array_key_exists( "name", $_GET ) && $_GET[ 'name' ] != NULL ) {
// Check Anti-CSRF token
checkToken( $_REQUEST[ 'user_token' ], $_SESSION[ 'session_token' ], 'index.php' );
// Get input
$name = htmlspecialchars( $_GET[ 'name' ] );
// Feedback for end user
$html ...阅读全文
May062020
DVWA-11.3 XSS (Reflected)(反射型跨站脚本)-High
High Level
查看源码
<?php
header ("X-XSS-Protection: 0");
// Is there any input?
if( array_key_exists( "name", $_GET ) && $_GET[ 'name' ] != NULL ) {
// Get input
$name = preg_replace( '/<(.*)s(.*)c(.*)r(.*)i(.*)p(.*)t/i', '', $_GET[ 'name' ] );
// Feedback for end user
$html .= "<pre>Hello ${name}</pre>";
}
?>...阅读全文
May062020
DVWA-11.2 XSS (Reflected)(反射型跨站脚本)-Medium
Medium Level
查看代码
<?php
header ("X-XSS-Protection: 0");
// Is there any input?
if( array_key_exists( "name", $_GET ) && $_GET[ 'name' ] != NULL ) {
// Get input
$name = str_replace( '<script>', '', $_GET[ 'name' ] );
// Feedback for end user
$html .= "<pre>Hello ${name}</pre>";
}
?>
可以看到,服务器端...阅读全文
May062020
DVWA-11.1 XSS (Reflected)(反射型跨站脚本)-Low
Low Level
查看代码
<?php
header ("X-XSS-Protection: 0");
// Is there any input?
if( array_key_exists( "name", $_GET ) && $_GET[ 'name' ] != NULL ) {
// Feedback for end user
$html .= '<pre>Hello ' . $_GET[ 'name' ] . '</pre>';
}
?>
array_key_exists() 函数检查某个数组中是否存在指定的键名,如果键名存在则返回 true,如果键名...阅读全文
May062020
DVWA-10.4 XSS (DOM)(DOM型跨站脚本攻击)-Impossible
Impossible Level
服务器端核心代码
<?php
# Don't need to do anything, protction handled on the client side
?>
客户端核心代码
由于大多数浏览器默认将从URL中获取的内容进行编码,而客户端的源代码中直接将编码后的输入插入到了动态页面中(可以与low级别的客户端代码进行比较),从而阻止了执行任何注入的JavaScript。
实践
尝试访问链接
http://127.0.0.1/dvwa/vulnera...阅读全文
May062020
DVWA-10.3 XSS (DOM)(DOM型跨站脚本攻击)-High-锚的使用
High Level
查看源码
<?php
// Is there any input?
if ( array_key_exists( "default", $_GET ) && !is_null ($_GET[ 'default' ]) ) {
# White list the allowable languages
switch ($_GET['default']) {
case "French":
case "English":
case "German":
case "Spanish":
# ok
break;
default:...阅读全文
May062020
DVWA-10.2 XSS (DOM)(DOM型跨站脚本攻击)-Medium
Medium Level
查看代码
<?php
// Is there any input?
if ( array_key_exists( "default", $_GET ) && !is_null ($_GET[ 'default' ]) ) {
$default = $_GET['default'];
# Do not allow script tags
if (stripos ($default, "<script") !== false) {
header ("location: ?default=English");
exit;
}
}
?>
相关函数说明
strip...阅读全文
May062020
DVWA-10.1 XSS (DOM)(DOM型跨站脚本攻击)-Low
XSS
XSS,全称Cross Site Scripting,即跨站脚本攻击,某种意义上也是一种注入攻击,是指攻击者在页面中注入恶意的脚本代码,当受害者访问该页面时,恶意代码会在其浏览器上执行,需要强调的是,XSS不仅仅限于JavaScript,还包括flash等其它脚本语言。根据恶意代码是否存储在服务器中,XSS可以分为存储型的XSS与反射型的XSS。
DOM型的XSS由于其特殊性,常常被分为第三种,这是一种基于DOM...阅读全文