[Red safety] Web Security Day6 - business logic vulnerabilities offensive and defensive combat

This article from the red Security Members: write Orion, if inappropriate, but also look treatise.

Hello everyone, we are red safety -Web security offensive and defensive team . This project is a series of articles about Web security share, HTB also contains a shooting range for your practice, we give this project has a name called Web security real  , hope to help friends who want to learn Web security. Each article is based on the vulnerability Introduction - Principle vulnerability - vulnerability harm - test method (manual testing, test tools) - Test Range (range into PHP, JAVA range, Python range covers all basically three kinds of range) - Real walkthrough (mainly select the appropriate CMS or Vulnhub practical exercise) , if you please help Star encourages us to create a better article. If you would like to join us, complete with the project, welcomed by e-mail ( [email protected] contact us). 

Business logic of offensive and defensive combat

1.1 Overview of the logical flaw

逻辑漏洞,之所以称为逻辑漏洞,是由于代码逻辑是通过人的逻辑去判断,每个人都有自己的思维,自己的思维容易产生不同想法,导致编写完程序后随着人的思维逻辑产生的不足,大多数逻辑漏洞无法通过防火墙,waf等设备进行有效的安全防护,在我们所测试过的平台中基本都有发现,包括任意查询用户信息、任意删除等行为;最严重的漏洞出现在账号安全,包括验证码暴力破解、任意用户密码重置、交易支付、越权访问等等。

1.2 Common logic vulnerabilities

Payment transactions, password changes, password recovery, unauthorized modification, unauthorized queries, breaking the limit, and other logical flaw. The figure is the simple logic loopholes summary, of course, certainly more than these, logical loopholes often need brain-hole wide open:

1.3 How mining logic vulnerabilities

确定业务流程--->寻找流程中可以被操控的环节--->分析可被操控环节中可能产生的逻辑问题--->尝试修改参数触发逻辑问题

1.4 Examples

以下实例不针对任何cms,只做演示用,有些代码进行修改后演示

首先我们看二个实例,我们知道很多网站都存在个人注册功能,设置个人权限,访问个人的功能页面,下面我们看下由于注册功能导致的逻辑漏洞

1.4.1 bulk registration

我们把注册功能填写相关信息,然后抓包

将数据包发送到repeater,每次修改username值,发现,只需要修改username值就可以注册成功用户,图形验证码无效,并且未对电话,邮箱等信息校验,可批量注册

1.4.2 registration function, batch guess user

同样是注册功能,在输入用户名时,发现会提示用户名是否存在,猜测该位置可以猜测哪些用户注册过该网站

抓取该位置数据包发现,会对用户名id进行判断,是否存在,是否符合规则

批量探测用户,发现可以批量探测已注册过的用户

建议在提交用户注册信息时判断用户是否存在,避免批量猜解注册用户

既然有注册功能,肯定不可或缺的就是忘记密码功能,忘记密码不可或缺的就是手机验证码或邮箱验证码进行找回,但在找回中会存在验证码回显、验证码不失效、验证码太短可爆破、验证码js校验等等多种漏洞情况,下面为其中一种情况。

1.4.3 any password reset

在忘记密码功能,我们输入用户名正确后会进行短信验证码,通过手机验证码或者邮箱验证码

在验证码功能中输入验证码进行验证,发现返回包中存在验证码是否成功情况“yes”或者“no”

我们将“no”修改为“yes”

点击下一步,发现,跳转到了设置新密码功能,输入新的密码,并登录,发现登录成功

越权漏洞,越权又可分为平行越权(相同用户)、垂直越权(低权限用户和高权限用户)、未授权访问(无需用户直接操作),我们看两个实例,平行越权和垂直越权。

1.4.4 parallel ultra vires

登录普通用户test2,查看用户敏感的页面

发送到repteater数据包中,看到cookie中存在username参数,修改为已存在的用户名,发现返回包中可查看其他用户敏感信息

Vertical override 1.4.5

在管理员中可创建普通权限用户,发现test用户为编辑用户

使用test用户登录,发现和admin用户有很大差别

抓取admin管理员修改test用户数据包,将该数据包在test用户浏览器进行访问

在test用户下访问,可访问,并且可修改,但所属组只允许修改为edit、publicer、member

在test用户下修改当前用户权限,level共分5个级别,1为管理员权限

将level值改为1

成功修改test用户权限

使用test登录,发现可操作功能已改变,说明普通用户可越权操作

Repair recommendations

Using IP number of access restrictions, if an IP frequently visit a page, such as password recovery and other functions, can be IP access restrictions.

Verification code identification protection, increase the number of voice verification codes, special fonts code, puzzles drop-down verification code, people need to manually code, SMS verification code can only get one minute once the verification code. Effective time limit security code, regardless of whether the correct verification code expires after every one minute, can not be reused. All user login and registration, must interact with back-end servers, including database servers.

Guess you like

Origin www.cnblogs.com/hongrisec/p/12408122.html
Recommended