Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL Injection Vulnerability on Security Bot #4

Open
delusko22 opened this issue May 5, 2022 · 2 comments
Open

SQL Injection Vulnerability on Security Bot #4

delusko22 opened this issue May 5, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@delusko22
Copy link

Vulnerable code is on the following line:

client.db.query(`UPDATE server SET prefix = '${args[1]}' WHERE serverID = '${message.guildID}'`)

By passing raw values into your SQL statements, people can perform SQL injections easily.
You need to escape the input or use parameters as in the examples below.

client.db.query(`UPDATE server SET prefix = ? WHERE serverID = '${message.guildID}'`, [args[1]]) 
client.db.query(`UPDATE server SET prefix = '${client.db.escape(args[1])}' WHERE serverID = '${message.guildID}'`) 
@AdamT20054
Copy link

I'll make a fork for the fix if I get some time later, dont know if the owner is still active on this repo?

@Logipek
Copy link
Owner

Logipek commented May 8, 2022

Hello
of course I'm still active on github it's true that it was one of my first bot and that there were some errors

it's with pleasure I'm waiting for your fork

@Logipek Logipek added the bug Something isn't working label May 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

3 participants