# hapi @hapi/boom Cross-Site Scripting in error messages

Source: https://junglewise.ai/threats/hapi-hapi-boom-cross-site-scripting-in-error-messages-89fe31b4  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2020-09-04. Updated: 2026-05-14  
License: CC BY 4.0 with a link back

Severity: low · CVSS 3.1 · Published 2020-09-04

@hapi/boom is a popular software library used by web developers to create standardized HTTP error messages. A security flaw in older versions of this library fails to properly clean error messages before displaying them to users. This could allow an attacker to trick a user's browser into executing malicious code, potentially leading to the theft of login sessions or sensitive information.

Vendors: [Hapi](https://junglewise.ai/threats/vendors/hapi), [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** Low severity, with a CVSS score of 3.1, published 4 September 2020.

**Which products and versions are affected?** Hapi Boom < 0.3.8; @hapi/boom (npm) SEMVER:introduced=0,fixed=0.3.8.

**Is there a fix for This vulnerability?** Yes. @hapi/boom (npm): upgrade to 0.3.8 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is This vulnerability attacked?** It is attacked over the network, in a software library.

**Am I affected?** Check whether you run Hapi Boom or @hapi/boom (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- @hapi/boom (npm): upgrade to 0.3.8 or later

  ```sh
  npm install @hapi/boom@0.3.8
  ```


## Technical details

@hapi/boom prior to version 0.3.8 is vulnerable to reflected Cross-Site Scripting (XSS). The vulnerability exists because the library fails to properly output-encode or escape error messages before they are rendered in a browser context. An attacker can craft a malicious payload that, when processed as part of an error object and displayed to a victim, executes arbitrary JavaScript in the context of the victim's session. This can lead to session hijacking or unauthorized actions on behalf of the user. The issue is resolved in version 0.3.8 by implementing proper XSS protections in the error message handling logic.

## Affected products

- hapi @hapi/boom < 0.3.8

## Timeline

- 2013-03-30: disclosed: Vulnerability first disclosed/introduced according to Snyk records
- 2020-01-09: advisory: Snyk advisory published
- 2020-09-04: advisory: GitHub advisory published

## References

- [https://github.com/hapijs/boom/commit/0f8640bdba65aec6e6799bfc16ff5753150bfcaf](https://github.com/hapijs/boom/commit/0f8640bdba65aec6e6799bfc16ff5753150bfcaf)
- [https://github.com/hapijs/boom](https://github.com/hapijs/boom)
- [https://snyk.io/vuln/SNYK-JS-HAPIBOOM-541183](https://snyk.io/vuln/SNYK-JS-HAPIBOOM-541183)
