大横幅1
大横幅2
到期时间:永久 到期时间:推广
小横幅3 小横幅4
  1. 当前位置:网站首页 > 实用工具

EMLOG评论验证码修复教程



emlog被恶意评论灌水解决方法,关于emlog验证码机制问题,用emlog程序都知道,它已经不存在更新了,所以emlog评论验证码代码年久失修了,可以无视验证码评论,因此咱也不说是谁的刷灌水机了。因为咱也不知道这个程序出来为的是什么?引流?哎。。。


其实我感觉我博客也不出名,我居然也无一幸免,哎。。。真宠幸我呀

验证码绕过漏洞原理:

1、利用NULL和空字符串比较的结果是TRUE从而绕过验证码检查逻辑
2、正常留言输入验证码进行BurpSuite抓包
3、将PHPSESSID修改成随意一个值,目的是让其$_SESSION不存在,再将imgcode修改成空。
4、发送数据包,可见没有提示失败(302跳转了),说明评论成功。
5、载入一个字典,即可刷评论。
6、可利用代理IP多线程即可实现无拦截评论恶意灌水轰炸

处理方案一:

1.开启session并且将是否为空的行为进行判断
2.违规词拦截(emlog用户免费提供emlog违规词拦截魔改插件和极猫云WAF防护)
3.添加第三方滑块验证

修复方案二:修改Emlog验证码机制

<?php
/**
 * Emlog验证码防干扰
 * Kirin博客: http://www.dufengvip.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);

 



本文最后更新于2021-2-15,已超过 3个月没有更新,如果文章内容或图片资源失效,请留言反馈,我们会及时处理,谢谢!
获取更多资讯请加入交流群

    协助本站SEO优化一下,谢谢!
    关键词不能为空
版权说明

本文地址:http://kirinbk.cn/post-500.html
免责声明:本站文章仅用于科普及教育用途,远离犯罪!

发表评论

联系我们

在线咨询:点击这里给我发消息

QQ交流群:KirinBlog

工作日:8:00-23:00,节假日休息

扫码关注