Code Injection Vulnerability in discord-markdown

discord-markdown Updated 02 Oct 2025

Summary

24/02/2020
HIGH
Yes i
High
Not published

GHSA-9r27-994c-4xch: discord-html not escaping HTML code blocks when lacking a language identifier. Affects discord-markdown versions < 2.3.1. Fixed in 2.3.1. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

discord-markdown is an npm package that provides a markdown parser for Discord. It allows users to format their messages using markdown syntax. However, a vulnerability has been discovered in versions prior to 2.3.1 that allows for code injection. When user-generated markdown is displayed on a website, code can be injected into the page if the markdown contains code blocks without a language identifier.

Vulnerability Detail

The vulnerability in discord-markdown allows for code injection into websites that use user-generated markdown. This can lead to various security issues, such as executing arbitrary code or stealing sensitive information. The vulnerability has been assigned a severity rating of HIGH. It has been patched in version 2.3.1 of the package.

How To Fix

Minimum fixed version

2.3.1

This is the first release that contains the fix.

npm install discord-markdown@2.3.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If updating to the latest version is not possible, a workaround is to escape the characters '<', '>', and '&' before sending plain code blocks to discord-markdown. This can be done using HTML entities: '<', '>', and '&'.

Conclusion

The code injection vulnerability in discord-markdown can have serious security implications for websites using user-generated markdown. It is crucial to update to version 2.3.1 or later to mitigate the risk. If you have any further questions or need assistance with vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for discord-markdown →

Share this vulnerability

FAQ

The vulnerability allows for code injection into websites using user-generated markdown. This can lead to various security issues, such as executing arbitrary code or stealing sensitive information.

To fix the vulnerability, update discord-markdown to version 2.3.1 or later.

If updating to the latest version is not possible, you can escape the characters '<', '>', and '&' before sending plain code blocks to discord-markdown.

Yes, the vulnerability has been patched in version 2.3.1 of discord-markdown.

The vulnerability has been assigned a severity rating of HIGH.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

2.3.1

This is the first release that contains the fix.

npm install discord-markdown@2.3.1

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback