Unsafe Escape with Express JS / mysqljs @0xdf
Unsafe Escape with Express JS / mysqljs  @0xdf
Uploaded March 2023 | Updated November 2026, 3 hours ago
There's a really interesting bug in mysqljs where it doesn't return safe code even when the developer goes out of their way to use escape functions when querying MySQL. This came up recently in the Vessel box from HackTheBox, and I wanted to dive into it a bit more deeply here. We'll look at a 2014 GitHub issue, the docs for the package, explore the vulenrability, and fix the vulnerable code.

Vulnerability Blog Post: flattsecurity.medium.com/finding-an-unseen-sql-injection-by-bypassing-escape-functions-in-mysqljs-mysql-90b27f6542b4
Issue on mysqljs: github.com/mysqljs/mysql/issues/731
mysqljs docs: github.com/mysqljs/mysql#escaping-query-values
My Vessel Solution: 0xdf.gitlab.io/2023/03/25/htb-vessel.html#bypass-login
Vessel on HackTheBox: hackthebox.com/machines/vessel

☕ Buy Me A Coffee: buymeacoffee.com/0xdf

[00:00] Introduction
[00:58] Blog post review
[02:48] Review code from Vessel
[03:10] Review issue raised in 2014
[03:52] mysqljs docs on escape functions
[04:22] Pseudocode of vulnerability
[05:34] Example on Vessel
[07:26] Understanding the payload in more detail
[08:46] Fixing the vulnerability
[11:38] Conclusion
Unsafe Escape with Express JS / mysqljsMalicious Lnk and JavaScript AnalysisDay 24 - Air Duct Spelunking [Revival of Code 2023 - Advent of Code 2016]Garden Groups [Day 12 - Advent of Code 2024 - Python]Debofuscate JavaScript with webcrack [Meme Maker 3000 - Flare-On 2024]Day 3 - Squares With Three Sides [Revival of Code 2023 - Advent of Code 2016]awk Injection via JWT Forgery [HackTheBox - Awkward]SpeedNet - HackTheSystem CTFsudo chroot Tech Details [CVE-2025-32463]Threat Index [HackTheBox - Coding Challenge]Day 23: Long Walk [AOC2023 Python]Day 8 - Two-Factor Authentication [Revival of Code 2023 - Advent of Code 2016]
0xdf |

Unsafe Escape with Express JS / mysqljs

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER