setuid/setgid/setgroups return values not checked

Bug #1301358 reported by sylv1 on 2014-04-02
256
This bug affects 1 person
Affects Status Importance Assigned to Milestone
lighttpd (Ubuntu)
Undecided
Unassigned

Bug Description

 Description
-------------

Privilege escalation from lighttpd user ("www-data").

This bug was found with the clang static analyzer.

 Attack scenario
-----------------

In certain cases setuid() and similar can fail; if an environment limits
the number of processes a user can have, setuid() might fail if the target
uid already is at the limit.

A user who can execute processes with the same userid (for example by
having write access to CGI scripts) could clone() often; in this case
a lighttpd restart would end up with lighttpd running as root, and the
CGI scripts would run as root too.

It could be possible that remote users could trigger many processes too, and
trigger a restart using a different bug in lighttpd.

 Affected versions
-------------------

All versions before 1.4.33.

 Patch
-------

See http://download.lighttpd.net/lighttpd/security/lighttpd-1.4.33_fix_setuid.patch

 Fixed in
----------

1.4.x: http://redmine.lighttpd.net/projects/lighttpd/repository/revisions/2923
1.4.34: not released yet (http://www.lighttpd.net/)

 Solutions or workaround
-------------------------

Make sure setuid()/setgid()/... can never fail:
* don't have any limits, or
* disable mod_cgi (perhaps using fcgi-cgi [3] or scgi-cgi [4] as replacement),
  and run any backends (FastCGI, SCGI, ...) with different users.
  Privilege separation is always a good idea!

Other restrictions could be in place (AppArmor/SELinux), but they usually
either always work or never work.

 References
------------

[1] http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-4559
[2] http://redmine.lighttpd.net/projects/lighttpd/repository/revisions/2923/diff/
[3] http://redmine.lighttpd.net/projects/fcgi-cgi/wiki
[4] http://redmine.lighttpd.net/projects/scgi-cgi/wiki

Related branches

CVE References

information type: Private Security → Public Security
Jamie Strandboge (jdstrand) wrote :

Thanks for taking the time to report this bug and helping to make Ubuntu better. Since the package referred to in this bug is in universe or multiverse, it is community maintained. If you are able, I suggest coordinating with upstream and posting a debdiff for this issue. When a debdiff is available, members of the security team will review it and publish the package. See the following link for more information: https://wiki.ubuntu.com/SecurityTeam/UpdateProcedures

Changed in lighttpd (Ubuntu):
status: New → Incomplete
Launchpad Janitor (janitor) wrote :

[Expired for lighttpd (Ubuntu) because there has been no activity for 60 days.]

Changed in lighttpd (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public Security information  Edit
Everyone can see this security related information.

Other bug subscribers