Commit afef59a
fix(tee): reject invalid session in invoke to close NULL-deref DoS (#247)
tee_ioctl_invoke() did not check the result of tee_ta_get_session().
A non-secure caller could send TEE_IOC_INVOKE with an invalid, zero, or
stale session id; find_session() returns NULL and tee_ta_invoke_command()
then dereferences it (sess->ctx->ops->enter_invoke_cmd, the original
guards are commented out), faulting in the secure world -> DoS reachable
through the live cmse_nonsecure_entry ioctl veneer.
Reject a NULL session with TEEC_ERROR_BAD_PARAMETERS in tee_ioctl_invoke
before the session is used, and add a defense-in-depth NULL guard at the
top of tee_ta_invoke_command() so no caller can trigger the dereference.
close_session is unaffected: tee_ta_close_session() already handles NULL.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 371b0ac commit afef59a
2 files changed
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
406 | 406 | | |
407 | 407 | | |
408 | 408 | | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
409 | 422 | | |
410 | 423 | | |
411 | 424 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
637 | 637 | | |
638 | 638 | | |
639 | 639 | | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
640 | 649 | | |
641 | 650 | | |
642 | 651 | | |
| |||
0 commit comments