Skip to content

hledger-web: cross-site scripting in the add form, and journal file injection via submitted newlines

High
simonmichael published GHSA-vq7r-8w52-jv84 Aug 27, 2026

Software

hledger-web

Affected versions

>= 1.18, <= 1.52.2

Patched versions

1.52.3

Description

Summary

Two issues in hledger-web's add form and add API:

  1. (#2700, high) The add form's error message was rendered as raw HTML, and it
    echoes the entry that was submitted. A malicious web page can use this to
    run javascript in hledger-web's origin. No authentication, no CSRF token,
    and no user action beyond visiting the page are required.

  2. (#2704, moderate) A newline in a submitted description, code, or account
    name was written into the journal file, where the text after it was read
    back as a journal directive rather than as part of the entry. This requires
    add permission.

Impact

hledger-web has no authentication, so script running in its origin has the
same access as the person who started the server: it can read the whole
journal - every transaction, account and balance - and send it elsewhere, and
can write to the journal files at whatever level --allow permits (appending
by default, rewriting whole files with --allow=edit or all).

The second issue lets a client with add permission add a directive such as an
include to the journal, making hledger read an attacker-chosen file on the
next load, or stopping the journal from loading at all.

Affected versions

hledger-web 1.18 through 1.52.2, and 1.99.1 through 1.99.3 (the 2.x preview
series). Earlier versions are not affected.

Patched versions

hledger-web 1.52.3, and the next 2.x preview release.

Workarounds

Run hledger-web with --allow=view, which refuses both of the affected
requests. Otherwise, avoid leaving hledger-web running while browsing the web,
and do not expose its port to untrusted networks.

References

Credits

Arthur Cinader found and fixed the XSS.
Simon Michael extended the analysis, fixed more, and prepared the release.

Severity

High

CVE ID

No known CVE

Weaknesses

Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')

The product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. Learn more on MITRE.

Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')

The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. Learn more on MITRE.