Bug 961916 (CVE-2016-1899) - VUL-0: CVE-2016-1899,CVE-2016-1900,CVE-2016-1901: cgit: multiple vulnerabilities
Summary: VUL-0: CVE-2016-1899,CVE-2016-1900,CVE-2016-1901: cgit: multiple vulnerabilities
Status: RESOLVED FIXED
Alias: CVE-2016-1899
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents (show other bugs)
Version: unspecified
Hardware: Other openSUSE 42.1
: P5 - None : Normal
Target Milestone: ---
Assignee: Security Team bot
QA Contact: Security Team bot
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-01-14 14:53 UTC by Andreas Stieger
Modified: 2016-01-24 18:13 UTC (History)
1 user (show)

See Also:
Found By: Security Response Team
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Stieger 2016-01-14 14:53:42 UTC
http://seclists.org/oss-sec/2016/q1/93

1. Reflected Cross Site Scripting & Header Injection in Mimetype Query
String [Katowicz-Kowalewski]

The ui-blob handler accepted a mimetype as a query string and then
echoed this string verbatim back. A malicious user could provide a
string like:

  http://git.zx2c4.com/cgit/blob/cgit.c?mimetype=text/html%0d%0a%0d%0a<script>xss</script>

This has been fixed by removing support for the mimetype query string parameter:
http://git.zx2c4.com/cgit/commit/?id=1c581a072651524f3b0d91f33e22a42c4166dd96
And then restricting to only generic mimetypes:
http://git.zx2c4.com/cgit/commit/?id=92996ac2a6fc4e944c3d723e12d5ab244a43508e
And finally, just in case, setting the IE anti-sniffing header as well
as a restrictive CSP header:
http://git.zx2c4.com/cgit/commit/?id=9ca2566972db968df4479108b29bb92551138b57


2. Stored Cross Site Scripting & Header Injection in Filename
Parameter [Donenfeld]

A user who has write access to the git repository could create
filenames containing new lines that would result in that filename,
including the newlines, being included in a header, resulting in
header injection and eventually XSS.

This has been fixed by properly escaping filenames in headers:
http://git.zx2c4.com/cgit/commit/?id=513b3863d999f91b47d7e9f26710390db55f9463
Additionally, while the redirect for the /about -> /about/ page does
*not* appear to be vulnerable due to mitigating conditions, the
following commit was made to similarly harden potential injections
here:
http://git.zx2c4.com/cgit/commit/?id=4291453ec30656c2f59645d8a74cf295ce0253a9

3. Stored Cross Site Scripting in Git Repo Files [Katowicz-Kowalewski]

A user who has write access to the git repository can add HTML pages
and then serve them with an HTML mimetype. A user could therefore
upload pages with malicious javascript executing in the same origin as
the cgit web site. While this is ordinarily not a problem for
single-use users - and indeed some users rather like being able to
serve html from cgit - sites that allow potentially malicious third
party users may not find this behavior desirable.

This has been fixed by adding a configuration option,
"enable-html-serving", which is by default off:
http://git.zx2c4.com/cgit/commit/?id=aaba5f8b925f44f7d5ffb0a45fe349642d478513
This flag sets anti-sniffing, CSP, and restricts mimetypes to
non-"application/" (except for application/pdf and
application/octet-stream) and non-"text/" (except for text/plain). If
you have a better idea of what sort of white/black list to use for
this, I am open to suggestions.

4. Integer Overflow resulting in Buffer Overflow [Cabetas]

ctx.env.content_length is an unsigned int, coming from the
CONTENT_LENGTH environment variable, which is parsed by strtoul. The
HTTP/1.1 spec says that "any Content-Length greater than or equal to
zero is a valid value." By storing this unsigned int into an int, we
potentially overflow it, resulting in the following bounding check
failing, leading to a buffer overflow.

This has been fixed by this commit:
http://git.zx2c4.com/cgit/commit/?id=4458abf64172a62b92810c2293450106e6dfc763



These issues are fixed in the new release, v0.12:
http://lists.zx2c4.com/pipermail/cgit/2016-January/002817.html
Comment 1 Andreas Stieger 2016-01-14 18:37:10 UTC
(In reply to Andreas Stieger from comment #0)
> 1. Reflected Cross Site Scripting & Header Injection in Mimetype Query
> String

CVE-2016-1899

> 2. Stored Cross Site Scripting & Header Injection in Filename
> Parameter 

CVE-2016-1900

> 3. Stored Cross Site Scripting in Git Repo Files

No CVE id.

> 4. Integer Overflow resulting in Buffer Overflow

CVE-2016-1901
Comment 2 Bernhard Wiedemann 2016-01-14 20:00:08 UTC
This is an autogenerated message for OBS integration:
This bug (961916) was mentioned in
https://build.opensuse.org/request/show/353755 Factory / cgit
Comment 3 Bernhard Wiedemann 2016-01-14 22:00:08 UTC
This is an autogenerated message for OBS integration:
This bug (961916) was mentioned in
https://build.opensuse.org/request/show/353764 42.1 / cgit
Comment 4 Andreas Stieger 2016-01-14 22:03:56 UTC
Update is running.
Comment 5 Andreas Stieger 2016-01-22 07:41:55 UTC
Release
Comment 6 Swamp Workflow Management 2016-01-22 11:12:09 UTC
openSUSE-SU-2016:0196-1: An update that fixes three vulnerabilities is now available.

Category: security (moderate)
Bug References: 961916
CVE References: CVE-2016-1899,CVE-2016-1900,CVE-2016-1901
Sources used:
openSUSE Leap 42.1 (src):    cgit-0.12-6.1
openSUSE 13.2 (src):    cgit-0.12-13.6.1
Comment 7 Swamp Workflow Management 2016-01-24 18:13:52 UTC
openSUSE-SU-2016:0218-1: An update that fixes three vulnerabilities is now available.

Category: security (moderate)
Bug References: 948969,961916
CVE References: CVE-2016-1899,CVE-2016-1900,CVE-2016-1901
Sources used:
openSUSE 13.1 (src):    cgit-0.12-11.6.1