Bug 1553265 (CVE-2018-1000132)

Summary: CVE-2018-1000132 mercurial: HTTP server permissions bypass
Product: [Other] Security Response Reporter: Pedro Sampaio <psampaio>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: katzj, mads, ndbecker2, pcahyna, pstodulk, sfowler
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: mercurial 4.5.2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-06 19:18:28 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: 1553267, 1564351, 1564352, 1564353    
Bug Blocks: 1553270    

Description Pedro Sampaio 2018-03-08 15:27:47 UTC
Quote from release notes:

All versions of Mercurial prior to 4.5.2 have vulnerabilities in the HTTP server that allow permissions bypass to:

    Perform writes on repositories that should be read-only
    Perform reads on repositories that shouldn't allow read access 

The nature of the vulnerabilities is:

    Wire protocol commands that didn't explicitly declare their permissions had no permissions checking done. The web.{allow-pull, allow-push, deny_read, etc} config options governing access control were never consulted when running these commands. This allowed permissions bypass for impacted commands.

    The batch wire protocol command did not list its permission requirements nor did it enforce permissions on individual sub-commands. 

The implication of these vulnerabilities is that no permissions checking was performed on commands and this could lead to accessing data that web.* config options were supposed to prevent access to or modifying data (via wire protocol commands that can mutate data) without authorization. A Mercurial HTTP server in its default configuration is supposed to be read-only. However, a well-crafted batch command could invoke commands that perform writes.

Upstream patch:

https://www.mercurial-scm.org/repo/hg/rev/2ecb0fc535b1

References:

https://www.mercurial-scm.org/wiki/WhatsNew#Mercurial_4.5.1_.2F_4.5.2_.282018-03-06.29

Comment 1 Pedro Sampaio 2018-03-08 15:28:43 UTC
Created mercurial tracking bugs for this issue:

Affects: fedora-all [bug 1553267]

Comment 3 Huzaifa S. Sidhpurwala 2018-04-06 03:36:16 UTC
As per upstream, there are two attack vectors here (which have been assigned one CVE):

1. Wire protocol commands: The write protocol performs all mercurial network access via either http or ssh. These did not declare any permissions and did not check permissions before their execution. This flaw has existed in mercurial since version 1.0. All versions of mercurial shipped in Red Hat Enterprise Linux are affected by this particular flaw.

2. "batch wire protocol commands": The batch write permissions bypass has been present since Mercurial 1.9. A well-crafted batch command could invoke commands that performs unauthorized writes. Only Red Hat Enterprise Linux 7 is affected by this flaw.

Comment 5 errata-xmlrpc 2019-08-06 12:34:40 UTC
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2019:2276 https://access.redhat.com/errata/RHSA-2019:2276

Comment 6 Product Security DevOps Team 2019-08-06 19:18:28 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2018-1000132