Skip to content

Audit · 8 min

Two lines, and one order is a vulnerability

Generated when asked for a helper that drops root before doing untrusted work.

c
void drop_privilege(uid_t uid, gid_t gid) {
    if (setuid(uid) != 0) {
        _exit(1);
    }
    if (setgid(gid) != 0) {
        _exit(1);
    }
}

Before it runs

What is wrong with this?

Nothing has run

Read it first. Answer, and the same calls run here.