CVE-2022-36024
py-cord 2.0.0 bots vulnerable to remote shutdown with application.commands scope
- CVSS 6.5
- CWE-862
- Design Defects
- Remote
py-cord is a an API wrapper for Discord written in Python. Bots creating using py-cord version 2.0.0 are vulnerable to remote shutdown if they are added to the server with the `application.commands` scope without the `bot` scope. Currently, it appears that all public bots that use slash commands are affected. This issue has been patched in version 2.0.1. There are currently no recommended workarounds – please upgrade to a patched version.
- CWE
- CWE-862
- CVSS base score
- 6.5
- Published
- 2022-08-18
- OWASP
- A05 Security Misconfiguration
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Design Defects
- Subcategory
- Security Misconfigurations
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Fixed by upgrading
- Yes
Solution
Update py-cord to version 2.0.1 or higher.
Vulnerable code sample
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='!', intents=discord.Intents.default())
@bot.slash_command()
async def shutdown(ctx):
await ctx.respond("Shutting down...")
await bot.close()
bot.run('YOUR_TOKEN_HERE')Patched code sample
import discord
from discord.ext import commands
bot = commands.Bot(command_prefix='!', intents=discord.Intents.default())
@bot.slash_command()
async def shutdown(ctx):
authorized_user_ids = [1234567890]
if ctx.author.id not in authorized_user_ids:
await ctx.respond("You do not have permission to use this command.", ephemeral=True)
return
await ctx.respond("Shutting down...")
await bot.close()
bot.run('YOUR_TOKEN_HERE')Cite this entry
@misc{vaitp:cve202236024,
title = {{py-cord 2.0.0 bots vulnerable to remote shutdown with application.commands scope}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2022},
note = {VAITP Python Vulnerability Dataset, entry CVE-2022-36024},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2022-36024/}}
}
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 ::
