Skip to content

setreuid16

Intro

setreuid16() - sets real and effective user ids of the current process to given values

Description

setreuid16() sets the real and effective user ids of the current process to the given values. It is the equivalent of setreuid(2) that uses 16 bit user identifiers, which is the same as the setuid(2) system call on 16 bit ids. This allows programs which use the 16 bit user identifiers to switch the user id of the current process. To change the user ids of another process use setreuid(2).

Edge cases: * If the effective user id is equal to the process's real user id and the effective user id is changed, then the saved set-user-ID of the executable will be set to the new effective user id. * If either of the new IDs matches the saved set-user-ID, then the saved set-user-ID will be cleared and the set-user-ID bit in the process's set of file mode creation flags will be cleared.

Arguments

  • ruid:old_uid_t - real user ID.
  • euid:old_uid_t - effective user ID.

Available Tags

  • K - Originated from kernel-space.
  • U - Originated from user space (for example, pointer to user space memory used to get it)
  • TOCTOU - Vulnerable to TOCTOU (time of check, time of use)
  • OPT - Optional argument - might not always be available (passed with null value)

Hooks

setreuid16

Type

Kprobe.

Purpose

In order to trace the setreuid16 system call execution for debugging purpose.

Example Use Case

setreuid16() can be used to switch the user id of the current process with the given real and effective user ids. This may be useful in situations where a process needs to gain extra privileges while still running under a different user.

Issues

Changing the user id of the process is a powerful action, and care needs to be taken to make sure that the effective user id is the same as the real user id. This is because if the effective user id is different from the real user id, then the saved set-user-ID of the executable will also be set to the effective user id.

setuid16(), seteuid16(), setfsuid16(), setreuid(), setuid(), seteuid(), setfsuid(), setresuid(), setresuid16(), chroot()

This document was automatically generated by OpenAI and needs review. It might not be accurate and might contain errors. The authors of Tracee recommend that the user reads the "events.go" source file to understand the events and their arguments better.