Skip to content

scmp_bpf_sim: Don't overread struct seccomp_data - #501

Open
stevegrubb wants to merge 1 commit into
seccomp:mainfrom
stevegrubb:overread
Open

stevegrubb wants to merge 1 commit into
seccomp:mainfrom
stevegrubb:overread

Conversation

@stevegrubb

Copy link
Copy Markdown

In the BPF_LD+BPF_W+BPF_ABS case of bpf_execute, a check is done of k to ensure it is < BPF_SYSCALL_MAX which is 64. The way it is written, passing a value of 63 is legal and passes the check. But it is going to read sizeof(unint32_t) or 4 bytes meaning a read from offset 63 to 66. This is beyond struct seccomp_data's end.

Condition the check by subtracting sizeof(unint32_t) to allow the right size offset. Now if someone passes offset 60, it is equal to the limit and allows reading bytes 60 - 63 which fits within struct seccomp_data.

scmp_bpf_sim doesn't appear to be shipped and I don't think anyone can use this flaw to any effect as it crosses no trust boundaries, there is no demonstrated write, code execution, privilege escalation, or useful information disclosure. Just undefined behavior.

In the BPF_LD+BPF_W+BPF_ABS case of bpf_execute, a check is done of k
to ensure it is < BPF_SYSCALL_MAX which is 64. The way it is written,
passing a value of 63 is legal and passes the check. But it is going to
read sizeof(unint32_t) or 4 bytes meaning a read from offset 63 to 66.
This is beyond struct seccomp_data's end.

Condition the check by subtracting sizeof(unint32_t) to allow the right
size offset. Now if someone passes offset 60, it is equal to the limit
and allows reading bytes 60 - 63 which fits within struct seccomp_data.

scmp_bpf_sim doesn't appear to be shipped and I don't think anyone can
use this flaw to any effect as it crosses no trust boundaries, there is
no demonstrated write, code execution, privilege escalation, or useful
information disclosure. Just undefined behavior.

Signed-off-by: Steve Grubb <ausearch.1@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant