Skip to contentSkip to conversation

fs/tar: only store numeric uid/gid

PATCH New Yann E. MORIN 2 participants 2 messages Feb 16, 2015 – Feb 19, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs/tar: only store numeric uid/gid

If a target user is asigned a UID (e.g. 1000) that happens to also exist on the build machine, tar will happily store the username for that user.

This can be seen by some as potential information disclosure.

Instruct tar to just store the numeric uid/gid.

---
Yes, there are so many other locations where we may have such information disclosure. But this one is pretty easy to fix.

---
 fs/tar/tar.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/tar/tar.mk +1 -1
index 780827e..28219cf 100644
@@ -7,7 +7,7 @@
 TAR_OPTS := $(call qstrip,$(BR2_TARGET_ROOTFS_TAR_OPTIONS))
 
 define ROOTFS_TAR_CMD
-	tar -c$(TAR_OPTS)f $@ -C $(TARGET_DIR) .
+	tar -c$(TAR_OPTS)f $@ --numeric-owner -C $(TARGET_DIR) .
 endef
 
 $(eval $(call ROOTFS_TARGET,tar))
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 fs/tar: only store numeric uid/gid

Dear Yann E. MORIN,

Quoted 8 lines · Yann E. MORIN

If a target user is asigned a UID (e.g. 1000) that happens to also exist on the build machine, tar will happily store the username for that user.

This can be seen by some as potential information disclosure.

Instruct tar to just store the numeric uid/gid.

I hesitated a bit on this one, but I preferred to err on the safe side, and therefore applied this patch to the 'next' branch.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com