Skip to content
vetkitChecksChangelogDocumentation

vetkit.c.privilege.chroot-without-chdir

chroot() is called without a following chdir("/"); the current directory stays outside the jail, so it can be escaped.

Last updated:

Suite: Security

c, cpp

chroot() is called without a following chdir("/"); the current directory stays outside the jail, so it can be escaped.

Category: SECURITY · Engine rule severity: WARNING

How to fix it

Call chdir("/") immediately after chroot() succeeds (or chdir into the new root first and chroot(".")), and drop root privileges afterwards.

References

Source: packages/engine/rules/sast/c.yml.

Generated from shipped rule definitions at build time. Matching is a review signal, not proof of exploitability. “generic” denotes text matching, not complete language or framework coverage. Runtime configuration and available tools affect whether a rule runs.