Bug 1029663 (CVE-2013-4559)

Summary: CVE-2013-4559 lighttpd: setuid/setgid/setgroups return value check
Product: [Other] Security Response Reporter: Kurt Seifried <kseifried>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED UPSTREAM QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: ccoleman, dmcphers, jialiu, lmeyer, matthias, mmcgrath
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-05-20 21:15:21 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1029666, 1029667, 1029669    
Bug Blocks:    

Description Kurt Seifried 2013-11-12 21:19:41 UTC
Stefan Bühler of the lighthttpd project reports:

 setuid/setgid/setgroups return values not checked
===================================================

 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-XXXX (TBD)
[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

 GPG signatures
----------------

* http://download.lighttpd.net/lighttpd/security/lighttpd-1.4.33_fix_setuid.patch.asc
* http://download.lighttpd.net/lighttpd/security/lighttpd_sa_2013_02.txt.asc

Comment 1 Kurt Seifried 2013-11-12 21:24:07 UTC
Created lighttpd tracking bugs for this issue:

Affects: fedora-all [bug 1029666]

Comment 2 Kurt Seifried 2013-11-12 21:25:45 UTC
Created lighttpd tracking bugs for this issue:

Affects: epel-all [bug 1029667]

Comment 4 Product Security DevOps Team 2020-05-20 21:15:21 UTC
This CVE Bugzilla entry is for community support informational purposes only as it does not affect a package in a commercially supported Red Hat product. Refer to the dependent bugs for status of those individual community products.