View Single Post
Old 09-21-2010, 03:26 AM   #42
ecostin
Enthusiast
ecostin is a good role modelecostin is a good role modelecostin is a good role modelecostin is a good role modelecostin is a good role modelecostin is a good role modelecostin is a good role modelecostin is a good role modelecostin is a good role modelecostin is a good role modelecostin is a good role model
 
Posts: 37
Karma: 160968
Join Date: Sep 2010
Location: Germany
Device: PRS-500-505-700, Kindle3, KT, KPW, KPW2, KV, KOA
Quote:
Originally Posted by clarknova View Post
This is standard behavior for all POSIX compliant tar implementations. Unless amazon was to rewrite their busybox tar program (or simply roll their own from scratch) this should always work.

But if they move the mntroot command back below the initial unpack, then we're back to square one.
The usual tar implementations do follow symlinks, but, in order to prevent this type of exploit, they create the symlinks at the end of extraction. This means that the symlinks creation will be delayed until all the files have been extracted and there will be no directory to create the PEM file into (although the symlink will be created). It is a known issue and this is the intended functionality. This does not affect the tar archive creation. One would need a two step approach - first "extract" a tar file to create the symlink, then extract a second one to plant the file in the location pointed by the link (the ota update script does nothing like that).

The normal error tar should give is:
tar xfvz update_jailbreak_k3g_install.bin.tgz
1
1/pubhackkey01.pem
tar: 1/pubhackkey01.pem: Cannot open: Not a directory
tar: Exiting with failure status due to previous errors

And, of course, if the filesystem is read-only, there's nothing to write to
ecostin is offline   Reply With Quote