summaryrefslogtreecommitdiff
path: root/util/libreboot-utils/lib/mkhtemp.c
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-03-24 20:18:15 +0000
committerLeah Rowe <leah@libreboot.org>2026-03-24 20:18:15 +0000
commit715723c7ceb35be1b6a592e51c70f54f3fc00bdb (patch)
tree7c810fc7b0e1b192166a40dd64ed3e8415a5e5bc /util/libreboot-utils/lib/mkhtemp.c
parentb16bb6c445a41d82b3c7dc9b7d297b9a0facb99f (diff)
mkhtemp: harden tmpdir access control
faccessat used this way respects uid/gid, handles ACLs (where used), and matches whatt many real security tools might do. Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/libreboot-utils/lib/mkhtemp.c')
-rw-r--r--util/libreboot-utils/lib/mkhtemp.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/util/libreboot-utils/lib/mkhtemp.c b/util/libreboot-utils/lib/mkhtemp.c
index 56d2bf74..cd4a9cde 100644
--- a/util/libreboot-utils/lib/mkhtemp.c
+++ b/util/libreboot-utils/lib/mkhtemp.c
@@ -475,6 +475,12 @@ world_writeable_and_sticky(
goto sticky_hell; /* not sticky */
}
+ /* if anyone even looks at you funny, drop
+ * everything on the floor and refuse to function
+ */
+ if (faccessat(dirfd, ".", X_OK, AT_EACCESS) < 0)
+ goto sticky_hell;
+
/* non-world-writeable, so
* stickiness is do-not-care
*/