Skip to content

Race condition in sys_open with O_CREAT allowing for privilege escalation #312

Open
@disconnect3d

Description

@disconnect3d

Hi,

There is a race condition in the sys_open syscall with the O_CREAT flag which allows for privilege escalation.

int result = create_file_fs((char *)file, mode);
if (!result) {
node = kopen((char *)file, flags);

The tl;dr is that since there is no locking here, an unprivileged process can create two threads. One will do a call to create a file, and another will remove the file immediately after it is created by the create_file_fs call, then symlink it to another file - owned by root - and then the kopen will just happily open the symlink. At this point, the unprivileged process can open any file owned by root.

I can share a proof of concept of exploiting that vulnerability if you want.

This bug was found during HXP 38C3 CTF competition (which contained a challenge with TaoruOS).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions