trilogy is vulnerable to SQL Injection
93
CVE Score
Critical
SQL Injection
Affected versions of this package are vulnerable to SQL injection because Trilogy#escape produces unsafe output for Strings in multibyte encodings such as Shift_JIS, Windows-31J, Big5, GBK or GB18030. In these encodings the continuation byte of a multibyte character can fall in the ASCII range, but escape assumed a strict ASCII superset and did not handle this correctly. An unauthenticated attacker who can influence the encoding or content of a String that is escaped can break out of the quoted string and inject arbitrary SQL. The fix additionally makes connections configured with sjis, cp932, big5, gbk or gb18030 raise an ArgumentError, as those connection encodings never worked correctly.
Upgrade the trilogy library to the patch version. If you cannot upgrade, enforce the encoding of all Strings passed to Trilogy#escape and Trilogy#query.
You are affected if you are using a version that falls within the vulnerable range and you pass attacker-influenced Strings to Trilogy#escape (including via Ruby on Rails or Rack applications using the Trilogy adapter), where the attacker can control the String's encoding, or if the connection is configured with encoding: sjis, cp932, big5, gbk or gb18030.
0.0.1 - 2.13.1
Fixed in 2.13.2trilogy is vulnerable to SQL Injection in versions 0.0.1 - 2.13.1.
Secure your code, cloud, and runtime in one central system. Connect a repo to discover what the reasoning agents find in your codebase.
No credit card required | Scan results in 32 seconds.
I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant
ISO 42001Compliant© All Intel data is openly available and commercially licensed.