aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/fsu/main.go
diff options
context:
space:
mode:
authorOphestra Umiker <cat@ophivana.moe>2024-12-17 13:01:36 +0900
committerOphestra Umiker <cat@ophivana.moe>2024-12-17 13:01:36 +0900
commitb453f70ca2016d8ab791968a3f2bc9ba2425bd2f (patch)
tree07ce3ed92ab21b4bc0853a4546330c3a9ac6b842 /cmd/fsu/main.go
parentc2b178e626ed18955aeada3180e9e4cb9bf2694b (diff)
cmd/fsu: check uid range before syscall
This limits potential exploits to the fortify uid range. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'cmd/fsu/main.go')
-rw-r--r--cmd/fsu/main.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/cmd/fsu/main.go b/cmd/fsu/main.go
index 1ec3a4bc..d232818a 100644
--- a/cmd/fsu/main.go
+++ b/cmd/fsu/main.go
@@ -123,6 +123,11 @@ func main() {
suppGroups = []int{uid}
}
+ // final bounds check to catch any bugs
+ if uid < 1000000 || uid >= 2000000 {
+ panic("uid out of bounds")
+ }
+
// careful! users in the allowlist is effectively allowed to drop groups via fsu
if err := syscall.Setresgid(uid, uid, uid); err != nil {