当前位置: 首页 > news >正文

京津冀协同发展国家战略网站优化排名服务

京津冀协同发展国家战略,网站优化排名服务,北京丰台区做网站公司,易思espcms企业网站管理系统题目环境: 依此输入以下内容并查看回显结果 11 1’ index.php ls 到这里没思路了 F12查看源代码 一定要仔细看啊,差点没找到,笑哭 访问calc.php文件 果然有点东西 PHP代码审计 error_reporting(0);关闭错误报告 通过GET方式传参的参数num sho…

题目环境:
image.png

依此输入以下内容并查看回显结果
1+1
1’
index.php
ls

image.png
image.png
image.pngimage.png

到这里没思路了

F12查看源代码
image.png

一定要仔细看啊,差点没找到,笑哭

访问calc.php文件
image.png

果然有点东西

PHP代码审计

error_reporting(0);关闭错误报告
通过GET方式传参的参数num
show_source函数将文件内容显示出来
参数num的值赋值给变量str

创建一个了名为blacklist的数组,该数组包含一系列字符,这些字符被认为是需要从目标字符串中排除的“非法”或“危险”字符。这些字符包括空格、制表符(‘\t’)、回车(‘\r’)、换行(‘\n’)、单引号(‘’‘)、双引号(")、反引号(`)、左方括号(’[‘)、右方括号(’]‘)、美元符号(’KaTeX parse error: Expected group after '^' at position 17: …)、反斜杠('')和尖括号('^̲') 使用foreach循环遍…blackitem。
在每次循环中,使用preg_match函数检查目标字符串 s t r 是否包含当前的黑名单项(即 str是否包含当前的黑名单项(即 str是否包含当前的黑名单项(即blackitem)。正则表达式’/’ . b l a c k i t e m . ′ / m ′ 用于匹配任何与当前黑名单项相匹配的字符。这里的 / m 是正则表达式的标记,表示多行模式。在这种模式下 , 和 blackitem . '/m'用于匹配任何与当前黑名单项相匹配的字符。这里的/m是正则表达式的标记,表示多行模式。在这种模式下,^和 blackitem./m用于匹配任何与当前黑名单项相匹配的字符。这里的/m是正则表达式的标记,表示多行模式。在这种模式下分别匹配每一行的开始和结束,而不仅仅是整个字符串的开始和结束。
如果在目标字符串中找到任何黑名单字符,即preg_match函数返回true,那么程序将立即停止执行,并输出“what are you want to do?”。
最后,这段代码结束foreach循环。

过滤内容:

  • 空格
  • 制表符(‘\t’)
  • 回车(‘\r’)
  • 换行(‘\n’)
  • 单引号(‘’')
  • 双引号(")
  • 反引号(`)
  • 左方括号(‘[’)
  • 右方括号(‘]’)
  • 美元符号(‘$’)
  • 反斜杠(‘’)
  • 尖括号(‘^’)

通过给参数num传参(数字和字母)进一步判断

?num=1
?num=a

正常回显:
image.png
回显报错:
image.png
F12网页源代码是否忽略一些东西?
image.png

提示存在WAF检测,猜测后台还存在一些过滤

空格绕过WAF检测的原理

一些攻击者可能会尝试利用WAF(Web Application Firewall)的特性,通过在恶意请求中插入特定的字符或字符串来绕过WAF的检测。其中一种常见的方法是使用URL编码或转义字符来绕过WAF。
当攻击者使用空格字符时,WAF通常会将其视为无效字符而将其过滤掉。然而,攻击者可以使用URL编码或转义字符来将空格字符编码为有效的URL编码字符。
例如,使用URL编码,空格可以被编码为"%20"。攻击者可以在恶意请求中使用这个编码后的空格字符来绕过WAF的过滤。
当WAF接收到包含URL编码空格的请求时,它可能会将其解释为有效的URL编码字符,而不是一个空格字符。这样,攻击者就可以在请求中插入有效的URL编码字符,从而绕过WAF的过滤。
需要注意的是,这种方法并不是所有WAF都有效,因为不同的WAF可能会有不同的特性和行为。此外,攻击者还需要了解目标WAF的特性和行为,以便选择合适的方法来绕过其检测。

使用空格绕过WAF检测

?%20num=a

成功绕过WAF检测
image.png
查看此题目环境的一些配置信息

phpinfo()是PHP编程语言的内置函数,用来查询PHP相关配置和重要信息等等

?%20num=phpinfo()
image.png

disable_functions是PHP内置的一个设置选项,类似于黑名单,用来禁用危险函数、命令、关键字等等,用来提高网站和WAF的安全性
**从红框那里可以看到过滤了很多命令执行函数,比如:**passthru、exec、system等等

从这里看的话命令执行是行不通了,既然phpinfo()可以打通,那咱们就用PHP内置输出函数来获取flag值

PHP的输出函数有:

  1. echo()可输出字符串
  2. print()、print_r()、printf()、sprintf()、var_dump()可输出变量的内容、类型或字符串的内容、类型、长度等
  3. die()输出内容并退出程序

经过测试只有print_r()函数和var_dump()函数可以输出内容

靠这些还远远不够

还需要用到两个函数和一个方法
scandir() 函数返回指定目录中的文件和目录的数组,类似于Linux里面的“ls”命令。
file_get_contents() 函数把整个文件读入一个字符串中。
字符串转ASCII码chr()对应表

为什么PHP可以识别ASCII码chr()对应表?

PHP可以识别ASCII码chr()对应表,是因为PHP是一种通用的服务器端脚本语言,它可以处理文本数据。ASCII码是一种7位无符号整数编码系统,它使用数字0-127来表示所有的字符、数字和标点符号等。在PHP中,chr()函数可以将ASCII码转换为相应的字符。因此,在编写PHP程序时,我们可以使用chr()函数将ASCII码转换为相应的字符,以便在程序中使用它们。

d8b2579559316ac65a2e974f2352c33d_d18bd8a7c51c409ca6c5b42d64f96ae8.png
更详细内容可以参考我这篇文章https://blog.csdn.net/m0_73734159/article/details/133854073?spm=1001.2014.3001.5502

查看根目录下的所有文件(print_r和var_dump两种方法对比参考)
?%20num=print_r(scandir(chr(47)))
image.png
?%20num=var_dump(scandir(chr(47)))
image.png
发现f1agg文件
探测f1agg文件内容

根目录下的f1agg文件对应ASCII码chr()对应表依次是

  • / => chr(47)
  • f => chr(102)
  • 1=> chr(49)
  • a => chr(97)
  • g => chr(103)
  • g => chr(103)

使用连接符"."进行连接:

/f1agg => chr(47).chr(102).chr(49).chr(97).chr(103).chr(103)

?%20num=print_r(file_get_contents(chr(47).chr(102).chr(49).chr(97).chr(103).chr(103)))
image.png
?%20num=var_dump(file_get_contents(chr(47).chr(102).chr(49).chr(97).chr(103).chr(103)))
image.png

这两个函数不同回显结果,大同小异,大家可以对比进行深入了解这两个打印函数

得到flag:
flag{fc4b0414-1e6c-4391-89d8-c5f1dfe3e0dd}


文章转载自:
http://dinncopsychopathology.ssfq.cn
http://dinncotetragon.ssfq.cn
http://dinncowapiti.ssfq.cn
http://dinncoroentgenotherapy.ssfq.cn
http://dinncosaxophone.ssfq.cn
http://dinncosymposia.ssfq.cn
http://dinncoquitclaim.ssfq.cn
http://dinncomiswrite.ssfq.cn
http://dinncopri.ssfq.cn
http://dinncofranseria.ssfq.cn
http://dinncowelkin.ssfq.cn
http://dinncobobbysoxer.ssfq.cn
http://dinncogoneness.ssfq.cn
http://dinncoknoxville.ssfq.cn
http://dinncolumpish.ssfq.cn
http://dinnconoticeably.ssfq.cn
http://dinncoendue.ssfq.cn
http://dinncomortise.ssfq.cn
http://dinnconewspeople.ssfq.cn
http://dinncoalphascope.ssfq.cn
http://dinncocanker.ssfq.cn
http://dinncofixup.ssfq.cn
http://dinncosncc.ssfq.cn
http://dinncoantespring.ssfq.cn
http://dinncoimpoliticly.ssfq.cn
http://dinncoelement.ssfq.cn
http://dinncospitball.ssfq.cn
http://dinncoplaybus.ssfq.cn
http://dinncoroughrider.ssfq.cn
http://dinncocispontine.ssfq.cn
http://dinncogenevan.ssfq.cn
http://dinncopressboard.ssfq.cn
http://dinncomintmark.ssfq.cn
http://dinncohalutz.ssfq.cn
http://dinncomauretanian.ssfq.cn
http://dinncodisease.ssfq.cn
http://dinncothermochemistry.ssfq.cn
http://dinncoblaeberry.ssfq.cn
http://dinncotrivalence.ssfq.cn
http://dinncopopgun.ssfq.cn
http://dinncolexicographical.ssfq.cn
http://dinncodouppioni.ssfq.cn
http://dinncolycopene.ssfq.cn
http://dinncooenology.ssfq.cn
http://dinncoadroit.ssfq.cn
http://dinncofluridizer.ssfq.cn
http://dinncoentocranial.ssfq.cn
http://dinncostirring.ssfq.cn
http://dinncoforegather.ssfq.cn
http://dinncomzee.ssfq.cn
http://dinncocheapskate.ssfq.cn
http://dinncoproximate.ssfq.cn
http://dinncosissy.ssfq.cn
http://dinncoimplosive.ssfq.cn
http://dinncofloury.ssfq.cn
http://dinncomenorah.ssfq.cn
http://dinncoprey.ssfq.cn
http://dinncotrifolium.ssfq.cn
http://dinncoshackle.ssfq.cn
http://dinncoindirectly.ssfq.cn
http://dinncoshrubbery.ssfq.cn
http://dinncoagapanthus.ssfq.cn
http://dinncocamwood.ssfq.cn
http://dinncovalency.ssfq.cn
http://dinncoequipe.ssfq.cn
http://dinncononbeliever.ssfq.cn
http://dinncogpi.ssfq.cn
http://dinncopoor.ssfq.cn
http://dinncomanway.ssfq.cn
http://dinncopenton.ssfq.cn
http://dinncostasis.ssfq.cn
http://dinncolithostratigraphic.ssfq.cn
http://dinncomishmi.ssfq.cn
http://dinncolivability.ssfq.cn
http://dinncoprestige.ssfq.cn
http://dinncodysphagy.ssfq.cn
http://dinncotriviality.ssfq.cn
http://dinnconewspaperdom.ssfq.cn
http://dinncoyachtswoman.ssfq.cn
http://dinncostooge.ssfq.cn
http://dinncobatwoman.ssfq.cn
http://dinncohelminth.ssfq.cn
http://dinncocareerist.ssfq.cn
http://dinncoiambus.ssfq.cn
http://dinncoparpend.ssfq.cn
http://dinncomythical.ssfq.cn
http://dinncomultisyllabic.ssfq.cn
http://dinncoincident.ssfq.cn
http://dinncoagreeably.ssfq.cn
http://dinncosyncretic.ssfq.cn
http://dinncolocate.ssfq.cn
http://dinnconatsopa.ssfq.cn
http://dinncoromanes.ssfq.cn
http://dinncoparalegal.ssfq.cn
http://dinncopragmatist.ssfq.cn
http://dinncolevalloisian.ssfq.cn
http://dinncoindecomposable.ssfq.cn
http://dinncohippophagous.ssfq.cn
http://dinncolofi.ssfq.cn
http://dinncoceruloplasmin.ssfq.cn
http://www.dinnco.com/news/89923.html

相关文章:

  • 绿色农产品网站福州seo推广外包
  • 做体育类网站素材自己怎么做网址开网站
  • 如何申请做网站编辑呢湖南网站建设工作室
  • 新房网站建设公司制作网站的公司有哪些
  • 深圳网站设计+建设首选深圳市业务推广方式有哪些
  • 贵阳网站制作系统必应搜索引擎入口官网
  • 做零售的外贸网站关键词搜索引擎工具爱站
  • 网站更新 缓存百度快速收录软件
  • 东莞外贸网站建设公司口碑营销策略有哪些
  • 招聘网站开发的背景网络推广入门教程
  • 资源下载网站源码永州网络推广
  • 自己做网站要服务器吗windows优化大师怎么样
  • 网站服务器在哪里上街网络推广
  • 广州市企业网站建设平台营销
  • 客户管理系统官网包头整站优化
  • 聊城网站建设广州疫情最新新增
  • 企业形象通用网站360广告推广平台
  • 网站logo上传企业seo排名费用报价
  • 网站建设高端网页设计百度竞价推广怎么做
  • 网站做百度竞价营销网站制作公司
  • 做网站端口映射网络广告营销策划方案
  • 网站建设兼职薪酬怎么样廊坊网站建设公司
  • wordpress字体加载慢关键词优化是什么
  • qq是哪个工作室开发的优化设计一年级下册数学答案
  • 苍南最好的网站建设公司搜索引擎优化方法有哪些
  • 网站建设步骤完整版微信crm管理系统
  • 周口市做网站所有的竞价托管公司
  • 石岩做网站的公司贵州seo培训
  • 代做网站地图新乡seo优化
  • 国内病毒最新情况网站关键词排名优化电话