# GHSA-FFW9-W85G-F2VH: Secret key base exposed in stack trace arguments on wrong-typed Plug.Crypto arguments

- Database: GitHub
- Severity: CVSS 5.1 (Medium)
- Published: 2026-10-23
- Modified: 2026-10-23

## Tracked as

- [CVE-2026-105963](https://cve.now/CVE-2026-105963.md): Secret key base exposed in stack trace arguments on wrong-typed Plug.Crypto arguments

## Affected versions

- plug\_crypto (Hex): from 1.0.0, fixed in 2.2.1
- plug (Hex): from 1.6.3, fixed in 1.7.0

## Description

Every public function in Plug.Crypto checks its argument types in a function-head guard. When a guard fails, the VM raises FunctionClauseError with the actual argument values in the top stack frame. The library's `rescue ... reraise` blocks and
`prune_args_from_stacktrace/1` only apply to exceptions raised inside a function body, so they never see these. Both Plug.Cowboy and Bandit write that frame, arguments included, to error logs. If logs are sent to external systems or are stored without encryption, then they may have access to the application's secret key base.

The following functions are reachable with request data:

- `Plug.Crypto.verify/4` with a non-binary, non-nil token prints the secret key base.
  `Phoenix.Token.verify/4` and `decrypt/4` (v1.7.21, v1.8.x, main) forward the token
  argument with only `is_binary(salt)` guarded, and Plug.Parsers yields a list for
  `token[]=x` in a query string and an integer or map for a JSON body, so a
  controller that passes `params["token"]` is enough.
- `Plug.Crypto.decrypt/4` with a non-binary token prints the derived 32-byte key: the
  main clause has no `is_binary(token)` guard, so the key is derived first and the
  guard that fails is `MessageEncryptor.decrypt/4`'s.
- `Plug.Crypto.secure_compare/2` with a non-binary operand prints the other operand.
  Comparing `List.first(get_req_header(conn, "x-api-key"))` or a param against a
  configured secret is a common pattern; a request without the header passes `nil`
  and the configured secret is logged.

## Impact

A reader of application logs or of the error tracker obtains the secret key base
(sufficient to mint session cookies and tokens under any salt) or the server-side
value an API key is compared against. Triggering it needs one unauthenticated request
with a wrong-typed parameter or a missing header. Log and error-tracker access is a
second step, but those systems are routinely less protected than application config.

## References

- https://github.com/elixir-plug/plug/security/advisories/GHSA-ffw9-w85g-f2vh

Page: https://cve.now/GHSA-FFW9-W85G-F2VH

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
