bradtraversy / chatcord

Realtime chat app with rooms
1.16k stars 1.15k forks source link

Security Fix for Stored-XSS on "ChatCord" - huntr.dev #18

Open huntr-helper opened 4 years ago

huntr-helper commented 4 years ago

https://huntr.dev/users/alromh87 has fixed the Stored-XSS on "ChatCord" vulnerability πŸ”¨. alromh87 has been awarded $25 for fixing the vulnerability through the huntr bug bounty program πŸ’΅. Think you could fix a vulnerability like this?

Get involved at https://huntr.dev/

Q | A Version Affected | ALL Bug Fix | YES Original Pull Request | https://github.com/418sec/chatcord/pull/1 Vulnerability README | https://github.com/418sec/huntr/blob/master/bounties/other/chatcord/1/README.md

User Comments:

πŸ“Š Metadata *

Bounty URL: https://www.huntr.dev/bounties/1-other-chatcord

βš™οΈ Description *

There is no proper sanitization of some data received from server making code injection available to malicious user, if traffic is intercepted and modified.

πŸ’» Technical Description *

Fixed by replacing the use of innerHTML() for innerText() efectively treating incoming data as text and not html elements.

πŸ› Proof of Concept (PoC) *

  1. Download the project
  2. Run npm i
  3. Run npm run dev
  4. Go on http://localhost:3000 or on the Repl instance created
  5. Go on https:///chat.html?username=test&room=JavaScript
  6. Start Burp
  7. Send a new message and intercept the WS request
  8. Modify the time parameter in ><img/src=\"x\"/onerror=alert(1)> XSS triggered !!!

Captura de pantalla de 2020-09-08 10-30-26

Proof of Fix (PoF) *

After fix data is treated as text and No code is executed for remote user

Captura de pantalla de 2020-09-08 10-28-32

πŸ‘ User Acceptance Testing (UAT)

After fix functionality is unafected