Skip to content

kernel/erl_boot_server: harden binary_to_term against unknown atoms#11233

Open
maennchen wants to merge 1 commit into
erlang:masterfrom
maennchen:jm/erl_boot_server_atoms
Open

kernel/erl_boot_server: harden binary_to_term against unknown atoms#11233
maennchen wants to merge 1 commit into
erlang:masterfrom
maennchen:jm/erl_boot_server_atoms

Conversation

@maennchen

Copy link
Copy Markdown
Contributor

handle_command/3 decoded raw TCP data from whitelisted clients with binary_to_term/1. Even though boot clients are fully trusted, decoding untrusted-shaped payloads with the default options is unnecessary: any atoms embedded in a payload are permanently interned before pattern matching, so a malformed message could grow the atom table.

As a precaution, this switches to binary_to_term(Msg, [safe]), which raises badarg instead of interning unknown atoms or creating new funs. The existing catch wraps this as {'EXIT', badarg}, now replied to the client as {error, bad_command}.

This is a defence-in-depth hardening change, not a security fix; the module already assumes a complete trust relationship with its clients.

handle_command/3 decoded raw TCP data from whitelisted clients with
binary_to_term/1. Even though boot clients are fully trusted, decoding
untrusted-shaped payloads with the default options is unnecessary: any
atoms embedded in a payload are permanently interned before pattern
matching, so a malformed message could grow the atom table.

As a precaution, switch to binary_to_term(Msg, [safe]), which raises
badarg instead of interning unknown atoms or creating new funs. The
existing catch wraps this as {'EXIT', badarg}, now replied to the client
as {error, bad_command}.

This is a defence-in-depth hardening change, not a security fix; the
module already assumes a complete trust relationship with its clients.
@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

CT Test Results

    2 files     74 suites   1h 11m 5s ⏱️
1 803 tests 1 382 ✅ 420 💤 1 ❌
2 055 runs  1 576 ✅ 478 💤 1 ❌

For more details on these failures, see this check.

Results for commit bad018c.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@jhogberg jhogberg self-assigned this Jun 15, 2026
@jhogberg jhogberg added team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI labels Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants