usd-2020-0049 | Gophish v0.10.1


Advisory ID: usd-2020-0049
CVE Number: CVE-2020-24709
Affected Product: Gophish
Affected Version: v0.10.1
Vulnerability Type: Stored Cross-Site Scripting
Security Risk: Medium
Vendor URL: https://getgophish.com/
Vendor Status: Fixed

Description

The preview feature of the HTML editor in Landing Pages > New Landing Page allows for execution of XSS payloads that are injected into the source text area. The XSS gets stored when saving a page. A rogue user could exploit an admin by asking him to impersonate him and preview his broken Landing Page.

Additionally, the preview feature of the HTML editor in Email Templates > New Template allows for execution of XSS payloads that are injected into the source text area. The XSS gets stored when saving a template. A rogue user could exploit an admin by asking him to impersonate him and preview his broken email template.

Proof of Concept (PoC)

On the landing page

As a user, create a new landing page (/landing_pages) include a XSS payload. Click the editor’s „preview“ button and observe that the JavaScript is executed

Email template

As a user, create a new email template (/template) include a XSS payload.
Click the editor’s „preview“ button and observe that the JavaScript is executed

An XSS vulnerability can be exploited in various ways. A common attack is to steal sensitive information
from the user and secretly transmit it to the attacker. The gophish session cookie is protected with the
HttpOnly flag and the page does not accept TRACE or TRACK requests. However it might be possible
for an attacker to perform actions with the rights of the user.

Fix

It is recommended to treat all input on the website as potentially dangerous. Hence, all output that is dynamically generated based on user-controlled data should be encoded according to its context. The majority of programming languages support standard procedures for encoding meta characters. For example, PHP has the built-in function htmlspecialchars().
Additionally, all input should be validated on the server-side. Where possible, whitelist filters should be used. The more restrictive a filter can be specified, the better the protection it provides. Whitelisting is especially recommended if input values have a well defined format or a list of valid input values exists. Invalid values should not be sanitized and forwarded to the application. Instead, requests with invalid values should be rejected.

Timeline

  • 2020-06-18 First contact request via security@getgophish.com
  • 2020-06-22 Vendor responds to initial contact
  • 2020-08-07 Vendor publishes a fix
  • 2020-09-29 Security advisory released

Credits

This security vulnerability was found by Marcus Nilsson of usd AG