Skip to content
Disclosed report Intermediate

unchecked unserialize usages in audit-trail-extension/audit-trail-extension.php

The WordPress plugin audit-trail-extension calls PHP's unserialize() on data from the database without restricting allowed classes. If an attacker can control that data, they could trigger PHP object injection (POP chain) or exploit known unserialize bugs in older PHP versions.

e3amn2l Follow

Originally disclosed on HackerOne

Bounty$50 Medium View original
  • Triaged in 15 hours
  • Fixed in 2 days
  • Paid in 2 days
  • Disclosed after 32 days

in: https://github.com/iandunn/audit-trail-extension/blob/master/audit-trail-extension.php#L106 https://github.com/iandunn/audit-trail-extension/blob/master/audit-trail-extension.php#L112 https://github.com/iandunn/audit-trail-extension/blob/master/audit-trail-extension.php#L133 https://github.com/iandunn/audit-trail-extension/blob/master/audit-trail-extension.php#L139

there is usages of unserialize function

					$option = unserialize( $item->data );
					$details = unserialize( $item->data );

without disallowing unneeded classes. thus, if attacker managed to control the value of $item->data he will be able to:

1. conduct PHP POP exploitation, more information:

http://www.slideshare.net/_s_n_t/php-unserialization-vulnerabilities-what-are-we-missing http://www.slideshare.net/MailRuGroup/security-meetup-22-php-unserialize-exploiting

2. unserialize itself has many security bugs in previous PHP versions which can be exploited, more information:

https://www.evonide.com/fuzzing-unserialize/ https://blog.checkpoint.com/wp-content/uploads/2016/08/Exploiting-PHP-7-unserialize-Report-160829.pdf

fix:

1. don't use serialize/unserialize if json_encode/json_decode can be used instead. (fix both 1 & 2 attack vectors) 2. if 1 isn't possible, use safe unserialize invocation, such as:

        if (version_compare(PHP_VERSION, '7.0', 'lt')) {
            return safeUnserialize($data);
        } else {
            return safeUnserialize($data, false);
        }

Implement safeUnserialize function that based on PMA_safeUnserialize: https://github.com/phpmyadmin/phpmyadmin/blob/fb161a7bebe60d902f743227158eca6a9889c472/libraries/core.lib.php#L1080 but with fix for the issue described in: https://hackerone.com/reports/181315#activity-1322058

The original report as published on HackerOne, by e3amn2l. 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

Likely the plugin calls unserialize() on database-sourced data without using the allowed_classes option to restrict which PHP classes can be instantiated.

Impact

If an attacker can control the serialized data, they could achieve PHP object injection or exploit unserialize bugs in older PHP versions.

What the attacker needed

Attacker can control $item->data

The fix

The report recommends replacing serialize/unserialize with JSON encoding/decoding, or if that is not possible, using a safe unserialize wrapper that restricts allowed classes.

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.

PHP's unserialize() turns a stored text string back into live objects. If an attacker can influence that text, they may be able to create objects of classes they choose, which can lead to running code or other harm. The report says the plugin does this without limiting which classes are allowed.

More by e3amn2l

View all

8 more disclosed reports, best first.

More from Ian Dunn

View all

The newest disclosed reports for this program.

Similar reports

Same bug class and techniques, clearest first.