VDB
Sign up
MEDIUM5.3

GHSA-4vj7-5mj6-jm8m

morgan vulnerable to Log Forging via unneutralized control characters in :remote-user

Quick fix

GHSA-4vj7-5mj6-jm8m — morgan: upgrade to the fixed version with the command below.

npm install morgan@1.11.0

Details

### Impact

Morgan's `:remote-user` token extracts the Basic auth username from the `Authorization` header and writes it to the log stream without neutralizing control characters. An attacker can send a crafted `Authorization: Basic` header containing CR/LF characters to inject forged log lines, corrupting the one-request-per-line structure of access logs.

The built-in `combined`, `common`, `default`, and `short` formats are affected, as well as any custom format that includes `:remote-user`.

### Patches

Users should upgrade to version 1.11.0.

### Workarounds

Use a custom format string that does not include `:remote-user`.

Are you affected?

Enter the version of the package you're using.

Affected packages

npm/morgan
Introduced in: 1.2.0Fixed in: 1.11.0
Fixnpm install morgan@1.11.0

References

Check it before you install it

One call answers whether to add this package: known advisories, CISA KEV, and whether the name is a hallucinated or freshly squatted one. No key needed to try it.

curl -s https://vdb.ai.kr/v1/ai/check-packages \
  -H 'Content-Type: application/json' \
  -d '{"packages":["pkg:npm/morgan"]}'