usd-2019-0002 | feeling4design Super Forms – Drag & Drop Form Builder/1.0.0 – 4.4.8

Advisory ID: usd-2019-0002
Affected Version: 1.0.0 – 4.4.8
Vulnerability Type: Path Traversal
Impact: Critical
First Pubslished: 2019-07-31
Last Update: 2019-05-20

Details

Security Risk: Critical
Vendor URL: https://github.com/RensTillmann/super-forms, http://codecanyon.net/user/feeling4design
Vendor Status: Not fixed
Advisory Status: Published

Introduction

The attacker can upload files to arbitrary locations by manipulating the [userid] stored in the session cookie. This vulnerability when combined with the vulnerability „Arbitrary File Upload“ described in usd20190003 can lead to Remote Code Execution.

PoC

he upload of arbitrary file extension was tested on a customers instance of wordpress + super forms.

To reproduce:
1) Setup wordpress with super forms and create a form containing an upload form
2) Before submitting this form, set a cookie PHPSESSID to the path relative to the upload directory, e.g. PHPSESSID=../

As a consequence, we used the generation of the [userid] for the subfolder to upload the file to a
different path. The source code in /uploads/php/UploadHandler.php:

protected function get_user_id() {
@session_start();
	return session_id();
}

The session_id() can be changed by the PHPSESSID cookie. We set it to value ../ which changes
the upload path to: uploads/php.

File execution:
Usually, the uploaded files were copied to a subfolder with a random [userid] on the server: wpcontent/
plugins/super-forms/uploads/php/files/[userid]/[filename]. In the folder php/files/ there is
a .htaccess file that denies the execution of php files:

Since the directory uploads/php is not restricted in php code execution by the
mentioned .htaccess file, a php reverse shell is possible.

Fix

Disclaimer
The suggested fix is just a temporary workaround and not a final fix that ensures the full security of
this wordpress plugin. It is intended to support the developers to close this vulnerability.

The vulnerabilities we found are not yet fixed by the latest version of this plugin. One option is to
turn it off.

Another option is to apply the following temporary fixes:
In /uploads/php/UploadHandler.php
Replace the function get_user_id() to return a value an attacker cannot tamper with.

Timeline

  • 2019-01-25 First Contact request via contact form to: https://codecanyon.net/item/super-forms-drag-drop-form-builder/13979866/support
  • 2019-02-05 Vendor releases version 4.5.3 with a supposed fix. We could still exploit the vulnerability. (related: Changelog on https://codecanyon.net/item/super-forms-drag-drop-form-builder/13979866)

Credits

This security vulnerabilities were found by Tim Kranz and Matthias Goehring of usd AG.

ABOUT usd SECURITY ADVISORIES

In order to protect businesses against hackers and criminals, we always have to keep our skills and knowledge up to date. Thus, security research is just as important for our work as is building up a security community to promote the exchange of knowledge. After all, more security can only be achieved if many individuals take on the task.

Our CST Academy and our usd HeroLab are essential parts of our security mission. We share the knowledge we gain in our practical work and our research through training courses and publications. In this context, the usd HeroLab publishes a series of papers
on new vulnerabilities and current security issues.

Always for the sake of our mission: „more security.“

to usd AG


In accordance with usd AG’s Responsible Disclosure Policy, all vendors have been notified of the existence of these vulnerabilities.

Disclaimer

The information provided in this security advisory is provided „as is“ and without warranty of any kind. Details of this security advisory may be updated in order to provide as accurate information as possible.