Skip to content

setregid

Intro

setregid - set real and effective group IDs.

Description

The setregid() system call allows a process to change both its real group ID and its effective group ID.

This capability is similar to setting user IDs but operates on the group level, providing processes the ability to modify their association with user groups. In Unix-like systems, the real group ID identifies the primary group of the user who initiated the process, while the effective group ID influences the group-based permissions for that process.

This mechanism is instrumental for processes that need to alternate between different group-based privileges temporarily, ensuring resource access control and security at the group level.

Arguments

  • rgid:gid_t[K] - The real group ID to be set. If this argument is -1, the real GID is not changed.
  • egid:gid_t[K] - The effective group ID to be set. If this argument is -1, the effective GID is not changed.

Available Tags

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

Hooks

sys_setregid

Type

Tracepoint (through sys_enter).

Purpose

To observe and trace when the setregid() system call is executed, collecting data about the changes to the real and effective group IDs.

Example Use Case

Observing group-level privilege changes is essential in secure environments, especially when monitoring potential group-based privilege escalation or processes frequently transitioning between group contexts.

Issues

Improper usage or vulnerabilities in programs using setregid() can be exploited to gain unauthorized group privileges, leading to potential security lapses.

  • setgid() - Set the effective group ID of the calling process.
  • setresgid() - Set real, effective, and saved group IDs.
  • setegid() - Set effective group ID.

This document was automatically generated by OpenAI and reviewed by a Human.