乌云puzzle3 思路记录总结
0x00 线性同余算法计算随机数看懂这篇文章:http://www.mscs.dal.ca/~selinger/random/ 关键点在: 源码中先生成6位secret_key,再生成的随机token。我们可以逆向算一算: 1o[i] = o[i+31] - o[i+28] 于是我们只要生成一个超过32位的随机数连续序列,就可以计算出前面的随机数token了。由于可能存在需要加1的情况,需要简单的爆破。 首先用同一个session生成一段随机数序列: 观察看到下列源码,发现每次csrf_token 用掉之后,会再次生成一个,于是可以多生成几个随机数序列。 123456789function check_csrf_token(){ if(empty($_SESSION['CS ...
阅读更多
调试S2-033到S2-037分析体会
0x00 背景最近出了两个Struts漏洞,S2-032和S2-037。 都是官方插件REST出了问题,zone里面讨论也很热烈。我只代表个人观点和理解,如果理解有误,请批评指正。顺便聊聊里面的技术。 首先,看两个漏洞的描述: S2-033(CVE-2016-3087): Remote Code Execution can be performed when using REST Plugin with ! operator when Dynamic Method Invocation is enabled. S2-037: Remote Code Execution can be performed when using REST Plugin.It is possible to p ...
阅读更多
SSRF利用gopher协议攻击 fcgi
0x00 环境配置 安装Net_Gopher 在pecl下载Net_Gopher,然后改36行: 1function_entry ======> zend_function_entry 原因: 新版php将类型接口改变了,需要改下源码。 https://bugs.php.net/bug.php?id=61479 curl版本重新安装 倒腾半天,在SSRF测试时,对curl版本有所限制。所以需要重新编译安装。参考: http://pavelpolyakov.com/2014/11/17/updating-php-curl-on-ubuntu/: 1234apt-get remove -y curl && apt-get autoremove -y./config ...
阅读更多
phpinfo lfi 上传shell
0x00 基本原理建议阅读参考文章1的pdf,基本都是根据那篇文章进行分析的,这里单纯记录下我实验过程。 任意php文件都会处理一个上传请求,上传文件都会被暂时存储在一个临时目录下面。直到php页面完全处理完请求。 In particular he notes that if file_uploads = on is set in the PHP configuration file, then PHP will accept a file upload post to any PHP file. He also notes that the upload file will be stored in the tmp location, until the requested PHP pa ...
阅读更多
docker remote api 未授权访问
0x00 前言学习下这个Docker remote api漏洞,具体细节请参考http://drops.wooyun.org/papers/15892。 这里记录下我的实验过程,值得学习~~ 0x01 环境配置先关闭docker,然后开启: 12sudo service docker stopsudo docker daemon -H tcp://0.0.0.0:2375 -H unix:///var/run/docker.sock 绑定Docker Remote Api在指定端口(这里是2375),可以自行测试。 参考API规范进行渗透:https://docs.docker.com/engine/reference/api/docker-remote-api-v1.23/ 操作Dock ...
阅读更多
wechall writeup(1)
order by query PHP看关键代码: 1234567if (!in_array($orderby, $whitelist)) { return htmlDisplayError('Error 1010101: Not in whitelist.');}$orderby = $db->escape($orderby);$query = "SELECT * FROM users ORDER BY $orderby $dir LIMIT 10"; 这里有个php trick: 12345$names = array(1 => 'Username', 3 => 'Apples', 4 => 'Bananas', 5 => ' ...
阅读更多
近期CTF相关总结
记录下最近CTF题目中的相关技术,CTF比赛越来越多了。 HCTF2016injection (xpath injection)xpath注入题目,源码之后得到是这样的: 1234567891011121314if(file_exists('t3stt3st.xml')) { $xml = simplexml_load_file('t3stt3st.xml'); $user=$_GET['user']; $user=str_replace($re, ' ', $user); // $user=str_replace("'", "&apos", $user); $query="user/username[@name='".$user."']"; ...
阅读更多
Docker搭建nginx php mysql环境
0x00 准备工作下载所需要的镜像,推荐注册daocloud,配置下可以加速下载Docker Hub上的镜像。 123dao pull nginx:1.8dao pull php:5.6.19-fpmdao pull mysql:5.5.48 下载完后,sudo docker images: 1234REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZEmysql 5.5.48 2805299e41bf 3 days ...
阅读更多
XStream反序列化组件攻击分析
0x00 XStream组件功能 XStream可以轻易的将Java对象和xml文档相互转换,而且可以修改某个特定的属性和节点名称,而且也支持json的转换。 值得注意的是: 它转换对象时,不需要对象继承Serializable接口。 这极大的方便了反序列化攻击。 XStream简单序列化代码如下: 12345678910111213141516171819202122232425@Testpublic void testWriter(){ Person person = new Person(); //Set the properties using the setter methods //Note: This can also be done w ...
阅读更多
SSCTF2016总结writeup
crypt01思路: 解密,python 源码: 123456789101112131415161718192021222324252627282930313233343536373839404142434445def LShift(t, k): k %= 8 return ((t << k) | (t >> (8 - k))) & 0xffdef encode(p): ret = "" for i in range(8): ret = ('|' if (p >> i) & 1 else 'O') + ret return retA = [85, 128, 177, 163, 7, 242, 23 ...
阅读更多