Skip to content

GHSA-76r7-hhxj-r776 CVE-2025-55193

Active Record logging vulnerable to ANSI escape injection

Medium RubyGems
Severity
0.0 / 10
Medium · CVSS 4.0
Exploit chance (EPSS)
0.59%
Chance of exploitation in the next 30 days. Higher than 48.37% of scored vulnerabilities.
Known exploited
No
Not in CISA's catalog
Weakness
CWE-150 Improper Neutralization of Escape, Meta, or Control Sequences
Fix
8.0.2.1
Upgrade activerecord to this version or later

Description

This vulnerability has been assigned the CVE identifier CVE-2025-55193

Impact

The ID passed to find or similar methods may be logged without escaping. If this is directly to the terminal it may include unescaped ANSI sequences.

Releases

The fixed releases are available at the normal locations.

Credits

Thanks to lio346 from Unit 515 of OPSWAT for reporting this vulnerability

Affected versions

RubyGems

PackageVulnerableFixed in
activerecord
>= 8.0, < 8.0.2.1
8.0.2.1
activerecord
>= 7.2, < 7.2.2.2
7.2.2.2
activerecord
< 7.1.5.2
7.1.5.2

How to fix

Move to the fixed version or later with your package manager, update the lockfile, and run your tests. If the package only arrives through another dependency, upgrade that dependency first. If none of its releases pulls a fixed version yet, force the version with your package manager's override.

activerecord RubyGems → 8.0.2.1

bundler
bundle update activerecord # Gemfile: gem "activerecord", ">= 8.0.2.1"

Severity breakdown

CVSS 4.0 0.0

CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N

Attack vector
Network
Attack complexity
Low
Attack requirements
None
Privileges required
None
User interaction
Passive
Confidentiality (vulnerable system)
None
Integrity (vulnerable system)
Low
Availability (vulnerable system)
None
Confidentiality (subsequent systems)
None
Integrity (subsequent systems)
None
Availability (subsequent systems)
None

Weakness

CWE-150: Improper Neutralization of Escape, Meta, or Control Sequences

The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could be interpreted as escape, meta, or control character sequences when they are sent to a downstream component.

How to prevent it
  • Developers should anticipate that escape, meta and control characters/sequences will be injected/removed/manipulated in the input vectors of their product. Use an appropriate combination of denylists and allowlists to ensure only valid, expected and appropriate input is processed by the system.
  • Implementation: Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.
  • Implementation: While it is risky to use dynamically-generated query strings, code, or commands that mix control and data together, sometimes it may be unavoidable. Properly quote arguments and escape any special characters within those arguments. The most conservative approach is to escape or filter all characters that do not pass an extremely strict allowlist (such as everything that is not alphanumeric or white space). If some special characters are still needed, such as white space, wrap each argument in quotes after the escaping/filtering step. Be careful of argument injection (CWE-88).
  • Implementation: Inputs should be decoded and canonicalized to the application's current internal representation before being validated (CWE-180). Make sure that the application does not decode the same input twice (CWE-174). Such errors could be used to bypass allowlist validation schemes by introducing dangerous inputs after they have been checked.
  • Implementation: When using output from an LLM, neutralize or strip escape codes before redirecting output to the terminal or other rendering engine that would process the codes. The neutralization could require that the character be printable and/or allowable whitespace, such as a carriage return or newline. Be deliberate about what to allow.
  • Build and Compilation: When using an LLM: during tokenizer training, suppress escape codes from the tokenizer's vocabulary. Depending on context, this could be accomplished by removing the codes from input to the tokenizer, or removing the map from the string to its token ID. It is generally unlikely that this removal would adversely affect the quality or correctness of what is generated, e.g. advice requests for terminal settings to change colors.

References

Timeline

  1. Published
  2. Last updated by the source
  3. Latest EPSS score
AdvisorySeverityWhy it's related
GHSA-579w-22j4-4749
Denial of Service Vulnerability in ActiveRecord's PostgreSQL adapter
High Also affects activerecord
GHSA-hq7p-j377-6v63
SQL Injection Vulnerability via ActiveRecord comments
High Also affects activerecord
GHSA-3hhc-qp5v-9p2j
Active Record RCE bug with Serialized Columns
Critical Also affects activerecord
GHSA-f57c-hx33-hvh8
Active Record component in Ruby on Rails has a data-type injection vulnerability
Critical Also affects activerecord
GHSA-8hc4-xxm3-5ppp
Active Record subject to Regular Expression Denial-of-Service (ReDoS)
High Also affects activerecord
GHSA-xf96-32q2-9rw2
Rails ActiveRecord gem vulnerable to SQL injection
High Also affects activerecord
GHSA-jmm9-2p29-vh2w
activerecord vulnerable to SQL Injection
High Also affects activerecord
GHSA-h6w6-xmqv-7q78
activerecord vulnerable to SQL Injection
High Also affects activerecord
Is this in your code?

MergeHarbor checks every repository's dependencies against this database, ranks what matters by exploitability and reachability, routes it to the owning team and opens the fix pull request.

Check your repos with MergeHarbor