验证码绕过漏洞原理:
1、利用NULL和空字符串比较的结果是TRUE从而绕过验证码检查逻辑
2、正常留言输入验证码进行BurpSuite抓包
3、将PHPSESSID修改成随意一个值,目的是让其$_SESSION不存在,再将imgcode修改成空。
4、发送数据包,可见没有提示失败(302跳转了),说明评论成功。
5、载入一个字典,即可刷评论。
6、可利用 *** IP多线程即可实现无拦截评论恶意灌水轰炸
1.开启session并且将是否为空的行为进行判断
2.违规词拦截(emlog用户免费提供emlog违规词拦截魔改插件和极猫云WAF防护)
3.添加第三方滑块验证
1、打开程序路径/include/lib/checkcode.php文件,把下面代码全部替换到checkcode.php里面即可
<?php/** * Emlog验证码防干扰 * 梦城博客: https://www.dcqzz.cn/ */ session_start(); $randCode = ''; $chars = 'abcdefghijkmnpqrstuvwxyzABCDEFGHIJKLMNPRSTUVWXYZ23456789'; for ( $i = 0; $i < 5; $i++ ){ $randCode .= substr($chars, mt_rand(0, strlen($chars) - 1), 1); } $_SESSION['code'] = strtoupper($randCode); $img = imagecreate(75,25) or die("创建图像资源失败,请刷新页面"); $bgColor = isset($_GET['mode']) && $_GET['mode'] == 't' ? imagecolorallocate($img,245,245,245) : imagecolorallocate($img,255,255,255); $pixColor = imagecolorallocate($img,mt_rand(88, 245), mt_rand(55, 240), mt_rand(99, 200)); //画字符、大小 for($i = 0; $i < 5; $i++){ $x = $i * 13 + mt_rand(3, 7) - 2; $y = mt_rand(0, 3); $text_color = imagecolorallocate($img, mt_rand(100, 250), mt_rand(80, 180), mt_rand(90, 220)); imagechar($img, 5, $x + 5, $y + 3, $randCode[$i], $text_color); } //画干扰点 for($j = 0; $j < 240; $j++){ $x = mt_rand(0,500); $y = mt_rand(0,100); imagesetpixel($img,$x,$y,$pixColor); } //4条横斜线 for ($i=0; $i < 5; $i++) { $lineColor = imagecolorallocate($img, rand(50, 150), rand(50, 150), rand(50, 150)); $lineX1 = 0; $lineX2 = 90; $lineY1 = ($i + 1) * 8; $lineY2 = ($i + 1) * 15; imageline($img, $lineX1, $lineY1, $lineX2, $lineY2, $lineColor); } //4条竖斜线 for ($i=0; $i < 5; $i++) { $lineColor = imagecolorallocate($img, rand(50, 150), rand(50, 150), rand(50, 150)); $lineY1 = 0; $lineY2 = 90; $lineX1 = ($i + 1) * 8; $lineX2 = ($i + 1) * 15; imageline($img, $lineX1, $lineY1, $lineX2, $lineY2, $lineColor); } header('Content-Type: image/png'); imagepng($img); imagedestroy($img);
原文地址:https://www.dcqzz.cn/post/959
EMLOG的缓存说明Emlog程序以其轻巧简单的特点受到不少人的青睐,但是对于一个网站数据量比较大的EMLOG网站来说,EMLOG程序自带的缓存功能就有一点鸡肋了。所以这里分享一下如何给EMLOG...
Emlog博客程序的分类页、搜索页、归档页、作者页等列表页的显示数量是后台统一设置的,有时需要单独自定义分类页的显示数量,以下代码为参考默认函数修改而来,具体如下: <?php foreach...
boostrap后台登录页面,响应式简单美观集成到emlog 使用说明:上传到 admin/views 文件目录解压即可 下载地址 ...
文章内容功能三合一就是1.文章内容添加文章索引,我这里是调用H2的2.文章内容有含有标签的添加链接3.文章内容有外链的添加nofollow 关键代码添加到Module.php文件中 <?...
本文是介绍:Emlog如何实现主分类以及子分类显示该分类全部分类和分类高亮 我们知道要查询子分类很简单,只需要写一下sql查询一下哪个分类的pid是主分类ID 但是此方法到了子分类就会不显示或者出错,...
文章时间美化如几天前等等 本站专用的 <?php function sydate($datetemp, $dstr = 'Y-m-d H:i',$mdstr = 'm月d日') { $tim...