VAITP Dataset

← Back to the dataset

CVE-2023-49277

Reflected XSS vulnerability in dpaste API expires parameter

  • CVSS 6.1
  • CWE-79 Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
  • Configuration Issues
  • Remote

dpaste is an open source pastebin application written in Python using the Django framework. A security vulnerability has been identified in the expires parameter of the dpaste API, allowing for a POST Reflected XSS attack. This vulnerability can be exploited by an attacker to execute arbitrary JavaScript code in the context of a user's browser, potentially leading to unauthorized access, data theft, or other malicious activities. Users are strongly advised to upgrade to dpaste release v3.8 or later versions, as dpaste versions older than v3.8 are susceptible to the identified security vulnerability. No known workarounds have been identified, and applying the patch is the most effective way to remediate the vulnerability.

CVSS base score
6.1
Published
2023-12-01
OWASP
A03 Injection
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Configuration Issues
Subcategory
Cross-Site Scripting (XSS)
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Fixed by upgrading
Yes

Solution

Upgrade to dpaste release v3.8 or later

Vulnerable code sample

def create_paste(request):
    if request.method == 'POST':
        expires = request.POST.get('expires', '')
        
        paste = Paste.objects.create(content=request.POST['content'], expires=expires)
        return redirect('paste_detail', paste_id=paste.id)

Patched code sample

from django.utils.html import escape

def create_paste(request):
    if request.method == 'POST':
        expires = request.POST.get('expires', '')
        escaped_expires = escape(expires)
        
        paste = Paste.objects.create(content=request.POST['content'], expires=escaped_expires)
        return redirect('paste_detail', paste_id=paste.id)

Cite this entry

@misc{vaitp:cve202349277,
  title        = {{Reflected XSS vulnerability in dpaste API expires parameter}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2023},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2023-49277},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2023-49277/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::