<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>time to bleed by Joe Damato - Latest Comments in 5 Things You Don&amp;#8217;t Know About User IDs That Will Destroy You</title><link>http://timetobleed.disqus.com/</link><description></description><atom:link href="https://timetobleed.disqus.com/5_things_you_don8217t_know_about_user_ids_that_will_destroy_you/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Wed, 20 Jun 2012 23:18:50 -0000</lastBuildDate><item><title>Re: 5 Things You Don&amp;#8217;t Know About User IDs That Will Destroy You</title><link>http://timetobleed.com/5-things-you-dont-know-about-user-ids-that-will-destroy-you/#comment-563332799</link><description>&lt;p&gt;Without dog piling onto the whys and wherefores of this, thank you for writing it. It's clean, it's concise, and it's saved me a lot of headache and pain. I've actually used what was laid down here to improve code around my organization, and if I ever wind up in the same bar as you then your first pint is on me.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ryan</dc:creator><pubDate>Wed, 20 Jun 2012 23:18:50 -0000</pubDate></item><item><title>Re: 5 Things You Don&amp;#8217;t Know About User IDs That Will Destroy You</title><link>http://timetobleed.com/5-things-you-dont-know-about-user-ids-that-will-destroy-you/#comment-8886466</link><description>&lt;p&gt;Actually, it turns out that the "setuid demystified" paper was seriously flawed, which is why those guys wrote a followup paper titled "revising setuid demystified" [USENIX ;login 2008], see: &lt;a href="http://www.eecs.berkeley.edu/~daw/papers/setuid-login08b.pdf" rel="nofollow noopener" target="_blank" title="http://www.eecs.berkeley.edu/~daw/papers/setuid-login08b.pdf"&gt;http://www.eecs.berkeley.ed...&lt;/a&gt;&lt;/p&gt;&lt;p&gt;They also made the code that supposedly safely manipulates identity available here: &lt;a href="http://code.google.com/p/change-process-identity/" rel="nofollow noopener" target="_blank" title="http://code.google.com/p/change-process-identity/"&gt;http://code.google.com/p/ch...&lt;/a&gt;&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">"setuid demystified" is flawed</dc:creator><pubDate>Fri, 01 May 2009 00:36:08 -0000</pubDate></item><item><title>Re: 5 Things You Don&amp;#8217;t Know About User IDs That Will Destroy You</title><link>http://timetobleed.com/5-things-you-dont-know-about-user-ids-that-will-destroy-you/#comment-8721697</link><description>&lt;p&gt;Bibble,&lt;/p&gt;&lt;p&gt;What you said is true but irrelevant.  People aren't writing insecure code intentionally, they're writing it because they don't know how these things work!&lt;/p&gt;&lt;p&gt;The solution isn't to rant and rave about idiot engineers, it's to design systems and libraries that are easy to understand and do the right thing, and make up the difference by educating people.&lt;/p&gt;&lt;p&gt;That's exactly what Joe is doing.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jesse Farmer</dc:creator><pubDate>Thu, 16 Apr 2009 18:38:37 -0000</pubDate></item><item><title>Re: 5 Things You Don&amp;#8217;t Know About User IDs That Will Destroy You</title><link>http://timetobleed.com/5-things-you-dont-know-about-user-ids-that-will-destroy-you/#comment-8721696</link><description>&lt;p&gt;Stevens was a great author and teacher, but UNIX systems have evolved since then and his books do not apply to many current UNIX systems.  To better understand UIDs and security, I recommend Chen's paper "SetUID Demystified" from USENIX Security 2002.  It can be found at &lt;a href="http://www.eecs.berkeley.edu/~daw/papers/setuid-usenix02.pdf" rel="nofollow noopener" target="_blank" title="http://www.eecs.berkeley.edu/~daw/papers/setuid-usenix02.pdf"&gt;http://www.eecs.berkeley.ed...&lt;/a&gt;.  Matt Bishop's Writing Safe SetUID Programs at &lt;a href="http://nob.cs.ucdavis.edu/bishop/secprog/" rel="nofollow noopener" target="_blank" title="http://nob.cs.ucdavis.edu/bishop/secprog/"&gt;http://nob.cs.ucdavis.edu/b...&lt;/a&gt; is another essential reference.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">James</dc:creator><pubDate>Wed, 15 Apr 2009 14:25:53 -0000</pubDate></item><item><title>Re: 5 Things You Don&amp;#8217;t Know About User IDs That Will Destroy You</title><link>http://timetobleed.com/5-things-you-dont-know-about-user-ids-that-will-destroy-you/#comment-8721695</link><description>&lt;p&gt;Good coverage, although you didn't make any mention of the added file-system permissions that Linux uses.&lt;/p&gt;&lt;p&gt;setfsuid(2) etc., credentials(7) and also capabilities(7) are useful manual pages for further exploration for Linux developers.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Cameron Kerr</dc:creator><pubDate>Tue, 14 Apr 2009 22:09:58 -0000</pubDate></item><item><title>Re: 5 Things You Don&amp;#8217;t Know About User IDs That Will Destroy You</title><link>http://timetobleed.com/5-things-you-dont-know-about-user-ids-that-will-destroy-you/#comment-8721694</link><description>&lt;p&gt;UNIX UIDs are not as hard to understand as you imagine. Stevens covered it years and years ago.&lt;/p&gt;&lt;p&gt;If you don't understand how they work you shouldn't run anything as root. If you don't know how to safely drop privileges from UID 0 to some other userm then you don't know how to write secure code.&lt;/p&gt;&lt;p&gt;Anyone who thinks they can learn secure programming from the odd page here and there of code snippets is mistaken.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Bibble</dc:creator><pubDate>Tue, 14 Apr 2009 05:20:32 -0000</pubDate></item><item><title>Re: 5 Things You Don&amp;#8217;t Know About User IDs That Will Destroy You</title><link>http://timetobleed.com/5-things-you-dont-know-about-user-ids-that-will-destroy-you/#comment-8721693</link><description>&lt;p&gt;@Khang Toh: Yep, Starling has been patched. We're collecting a couple items before we do the next release.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Chris Gaffney</dc:creator><pubDate>Mon, 13 Apr 2009 16:27:40 -0000</pubDate></item><item><title>Re: 5 Things You Don&amp;#8217;t Know About User IDs That Will Destroy You</title><link>http://timetobleed.com/5-things-you-dont-know-about-user-ids-that-will-destroy-you/#comment-8721692</link><description>&lt;p&gt;@jelle - I probably should have been more clear, but I was referring to the case where you are calling setuid() as root to drop privileges.&lt;/p&gt;&lt;p&gt;In that case, all 3 IDs are set to the ID passed in.&lt;/p&gt;&lt;p&gt;Sorry about the confusion, I'll see if I can make it a bit more clear.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Joe Damato</dc:creator><pubDate>Mon, 13 Apr 2009 16:09:51 -0000</pubDate></item><item><title>Re: 5 Things You Don&amp;#8217;t Know About User IDs That Will Destroy You</title><link>http://timetobleed.com/5-things-you-dont-know-about-user-ids-that-will-destroy-you/#comment-8721691</link><description>&lt;p&gt;You're wrong about setuid (atleast on linux), see:&lt;br&gt;&lt;a href="http://linux.die.net/man/2/setuid" rel="nofollow noopener" target="_blank" title="http://linux.die.net/man/2/setuid"&gt;http://linux.die.net/man/2/...&lt;/a&gt;&lt;br&gt;setuid() sets the effective user ID of the current process. If the effective UID of the caller is root, the real UID and saved set-user-ID are also set.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jelle</dc:creator><pubDate>Mon, 13 Apr 2009 15:38:10 -0000</pubDate></item><item><title>Re: 5 Things You Don&amp;#8217;t Know About User IDs That Will Destroy You</title><link>http://timetobleed.com/5-things-you-dont-know-about-user-ids-that-will-destroy-you/#comment-8721690</link><description>&lt;p&gt;@Khang Toh: Yep.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Joe Damato</dc:creator><pubDate>Mon, 13 Apr 2009 15:31:06 -0000</pubDate></item><item><title>Re: 5 Things You Don&amp;#8217;t Know About User IDs That Will Destroy You</title><link>http://timetobleed.com/5-things-you-dont-know-about-user-ids-that-will-destroy-you/#comment-8721689</link><description>&lt;p&gt;Did you you submit a patch for starling?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Khang Toh</dc:creator><pubDate>Mon, 13 Apr 2009 14:02:54 -0000</pubDate></item><item><title>Re: 5 Things You Don&amp;#8217;t Know About User IDs That Will Destroy You</title><link>http://timetobleed.com/5-things-you-dont-know-about-user-ids-that-will-destroy-you/#comment-8721688</link><description>&lt;p&gt;Excellent overview - I've been a Unix programmer for 15 years, and some of that was new to me.&lt;/p&gt;&lt;p&gt;The 8-bytes-of-Ruby was particularly chilling.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">TJIC from SmartFlix</dc:creator><pubDate>Mon, 13 Apr 2009 13:54:10 -0000</pubDate></item><item><title>Re: 5 Things You Don&amp;#8217;t Know About User IDs That Will Destroy You</title><link>http://timetobleed.com/5-things-you-dont-know-about-user-ids-that-will-destroy-you/#comment-8721687</link><description>&lt;p&gt;Process::{GID,UID}.change_privilege changes both effective and&lt;br&gt;real user IDs in one fell swoop. This is how Mongrel does it:&lt;/p&gt;&lt;p&gt;def change_privilege(user, group)&lt;br&gt;  begin&lt;br&gt;    uid, gid = Process.euid, Process.egid&lt;br&gt;    target_uid = Etc.getpwnam(user).uid if user&lt;br&gt;    target_gid = Etc.getgrnam(group).gid if group&lt;/p&gt;&lt;p&gt;    if uid != target_uid or gid != target_gid&lt;br&gt;      log "Initiating groups for #{user.inspect}:#{group.inspect}."&lt;br&gt;      Process.initgroups(user, target_gid)&lt;/p&gt;&lt;p&gt;      log "Changing group to #{group.inspect}."&lt;br&gt;      Process::GID.change_privilege(target_gid)&lt;/p&gt;&lt;p&gt;      log "Changing user to #{user.inspect}."&lt;br&gt;      Process::UID.change_privilege(target_uid)&lt;br&gt;    end&lt;br&gt;  rescue Errno::EPERM =&amp;gt; e&lt;br&gt;    log "Couldn't change user and group to #{user.inspect}:#{group.inspect}:&lt;br&gt;    log "Mongrel failed to start."&lt;br&gt;    exit 1&lt;br&gt;  end&lt;br&gt;end&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Eric Wong</dc:creator><pubDate>Mon, 13 Apr 2009 13:42:01 -0000</pubDate></item></channel></rss>