Skip to content
XSS Disclosed report Intermediate

XSS Vulnerability on Pressable/Atomic Hosting Platform via unescaped admin notices leads to code execution

Admin notices in the atomic-platform.php plugin are echoed without HTML escaping, so a crafted value stored in the options table is rendered as markup. An attacker who can write that option could run script in an administrator's browser when they open the plugins page.

georgestephanis Follow

Originally disclosed on HackerOne

  • Fixed in 20 days
  • Disclosed after 3 months

Summary:

XSS Vulnerability: Unescaped text output in admin notice on atomic-platform.php

Platform(s) Affected:

Pressable / Atomic Hosting Platform

Steps To Reproduce:

  1. Update or set the atomic_single_option_limiter_notices option on a site to a:1:{s:34:"<script>alert('test')</script>test";a:1:{s:7:"expires";i:1893456000;}}
  2. Visit /wp-admin/plugins.php
  3. The XSS payload will execute in the admin notice area

This vulnerability is contingent on getting the XSS payload into the options table first. Once injected, it will be executed when other users view the affected admin page.

Supporting Material/References:

Vulnerable code in atomic-platform.php:

PHP
function add_admin_notice( $message, $class = 'notice notice-error is-dismissible' ) {
    $this->admin_notices[] = array( $message, $class );
}

function print_admin_notices() {
    foreach ( $this->admin_notices as $notice ) {
        ?>
        <div class="<?php echo esc_attr( $notice[1] ); ?>">
            <p><?php echo $notice[0]; ?></p>
        </div>
        <?php
    }
}

The notices are echoed without any escaping -- missing esc_html() around the $notice[0]. This is likely done because there can be some markup in the notice -- <strong> tags, for example:

PHP
function single_option_limiter_notices() {
    $admin_notices = get_option( $this->single_option_limiter_notices_key );

    if ( empty( $admin_notices ) || ! is_array( $admin_notices ) ) {
        return;
    }

    $changed = false;
    foreach ( $admin_notices as $option => $data ) {
        if ( $data['expires'] > time() ) {
            $this->add_admin_notice(
                "Excess updates to option <strong>$option</strong> blocked."
            );
        } else {
            unset( $admin_notices[ $option ] );
            $changed = true;
        }
    }

    if ( $changed ) {
        update_option( $this->single_option_limiter_notices_key, $admin_notices );
    }
}

However, even here, when they are set from being pulled in from the options table, they aren't escaped when interpolated into the string.

Recommended fix: Escape the output in the print_admin_notices() method, or earlier using something like:

PHP
$this->add_admin_notice(
    sprintf( 'Excess updates to option <strong>%s</strong> blocked.', esc_html( $option ) );
);

Note: The admin notice comes with is-dismissible class, but dismissing it does nothing as it reappears on page refresh.

The original report as published on HackerOne, by georgestephanis. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The plugin outputs stored notice messages without HTML-escaping them, so any markup in the stored option value is rendered as HTML.

Impact

Script could run in an administrator's browser, but only after the attacker has already managed to write the crafted value into the options table.

What the attacker needed

Ability to write the plugin's notice option; admin views the plugins page

The fix

The output should be escaped in the notice printing method, or the option name should be escaped before it is placed into the notice string.

How it was found

  1. Set the plugin's notice option to a crafted serialised value containing script markup
  2. Open the plugins administration page
  3. The script runs in the admin notice area

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A web page can include small programs called scripts that run in the visitor's browser. If a site shows text from its database without cleaning it first, an attacker can hide a script in that text so it runs when an admin views the page. Here the plugin printed stored notice text as raw HTML instead of plain text.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More from Automattic

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.