Skip to content

Latest commit

 

History

History
49 lines (20 loc) · 2 KB

CVE-2022-2445.md

File metadata and controls

49 lines (20 loc) · 2 KB

CVE-2022-2445

The sink function is ajax_run_package() in class-admin-upgrade.php

image

This function is bound to "wp_ajax_um_run_package" and will be executed in um_run_upgrade() in class-admin-upgrade.php if admin press the upgrade "Run" button.

image

The 'pack' parameter can be controlled by attacker.

The url is /wp-admin/admin-ajax.php, action and nonce is known, attacker can capture packet or directly send malicious packet whose 'pack' parameter is carefully designed.

Then we turn to the class-admin-upgrade.php

The core part is variable $_POST['pack'] only filtered by sanitize_text_field() which connot filter '.' or '/'

$this->packages_dir . sanitize_text_field( $_POST['pack'] ) . DIRECTORY_SEPARATOR . 'init.php'

in ajax_run_package() has three parts: $this->packages_dir, $_POST['pack'] and /init.php

The variable packages_dir is assigned in __construct() and should be /var/www/html/wordpress/wp-content/plugins/packages/

image

if $_POST['pack'] is "../../.."

$this->packages_dir . sanitize_text_field( $_POST['pack'] ) . DIRECTORY_SEPARATOR . 'init.php'

in ajax_run_package() should be /var/www/html/wordpress/wp-content/plugins/packages/../../../init.php

which is /var/www/html/wordpress/init.php

Of course $_POST['pack'] can be any directory attacker want, which means attacker can include malicious "init.php" in any directory he want and excute malicious PHP code.

That is to say, if attacker create a malicious "init.php", he can use this vulnerability to execute any PHP code he want. If a method could be discovered that allows uploading arbitrary PHP code, this could be used to execute that code.

Thus, there is the Directory Traversal and Local File Inclusion vulnerability.