Moab User Impersonation [CVE-2014-5375]


##[Moab User Impersonation : CVE-2014-5375]## Software: Moab Affected Versions: All current versions of Moab. However, the impact is limited in Moab 7.2.9 and Moab 8. CVE Reference: CVE-2014-5375 Author: John Fitzpatrick, Luke Jennings MWR Labs (http://labs.mwrinfosecurity.com/) Severity: High Risk Vendor: Adaptive Computing Vendor Response: Updates in Moab 7.2.9 and Moab 8 provide some mitigations ##[Description] It is possible to submit jobs to Moab as arbitrary users due to insufficient authentication checks during the submission of a job to the Moab server. ##[Impact] Users are able to submit jobs as arbitrary users. In environments that permit it this could allow job execution as root. ##[Cause] Moab does not sufficiently validate the job submissions against its intended user ID values. ##[Solution] An upgrade to Moab 7.2.9 or Moab 8 prevents direct exploitation of this issue (further details are provided in the “Technical Details” section below). In these versions jobs submitted in this manner enter a held state, this is flagged as a known issue by Adaptive (MOAB-7478): "Jobs submitted with invalid credentials are put in a held state, instead of rejected, until the administrator can respond. The checkjob command gives administrators further information regarding why the job is held. Blindly assuming that all held jobs should in fact be running RIGHT NOW is not only unsafe, but circumvents intentional Moab policies and workflow. An administrator should exercise care when resolving held jobs". Administrators should be aware that attackers can control the <UserID> value which provides them control over the user specified within the checkjob. MWR would recommend that Adaptive make use of the “actor” value passed to Moab, as the controls introduced in 7.2.9 and 8 prevent manipulation of this value. ##[Technical Details] Moab is a workload manager used in High Performance Computing (HPC) environments. In a typical environment a user submits their jobs to the Moab server for it to handle the workload. Moab communication makes use of an XML based protocol. An example message showing a job submission is shown below: <Envelope component="ClusterScheduler" count="1" name="moab" type="nonblocking" version="8.0.beta.2"> <Signature> <DigestValue>7v49VzAlbyNQ4O3VChCus+v2LeE=</DigestValue> <SignatureValue>QG13cmxhYnMgRWFzdGVyIEVnZyE=</SignatureValue> </Signature> <Body actor="test" timestamp="1408488412"> <Request action="submit" actor="test" cmdline="\STARTmsub"> <Object>job</Object> <job> <Owner>test</Owner> <UserId>test</UserId> <GroupId>test</GroupId> <InitialWorkingDirectory>/home/test</InitialWorkingDirectory> <UMask>2</UMask> <Executable>/usr/bin/id</Executable> <SubmitLanguage>PBS</SubmitLanguage> <SubmitString>\START/usr/bin/id\0a\0a</SubmitString> </job> </Request> </Body> </Envelope> Within this message users are specified in multiple locations, these are highlighted in bold in the message above. In versions of moab prior to Moab 8 there are two instances of the "actor" value specified. In order for mauth to sign a message the actor specified within the <Request> tag must match the user calling mauth. It is not necessary for the actor value within the <Body> tag to match the calling user. In addition to checks at the mauth level the server will perform its own checks. The server ensures that the <Owner> matches the user specified within the <Body> actor value. If either differs an error (code 999 – invalid credentials specified for submitted job) is returned by the server and the job rejected. Since the actor value within the body tag is not verified by mauth, and this actor value is also the one against which the server checks the <Owner> tag, it is possible to smuggle through jobs to the server with an arbitrary user specified in each of these values. The user under which the job is queued by Moab is the user specified within the <UserId> tag. Whilst it is possible to impersonate a user by changing only this value, doing so appears to impede communication between Moab and a workload manager, on TORQUE this results in the job entering a BatchHold state where it will not execute. When the Body.actor value, the <Owner> and the <UserId> value are altered (but the Request.actor value remains legitimate to facilitate signing) it is possible to impersonate any user. The example above describes this process when impersonating users during job submission. Moab also provides a means to reconfigure the server and a similar approach can be adopted to impersonate root and perform server reconfiguration. In Moab 8 only a single actor value is contained within the messages and is used by both mauth and by the Moab server. This prevents manipulation of the <Owner> value during job submission. It remains possible to alter the <UserId> value and submit jobs in Moab 8 (as described above), although in a typical Moab+TORQUE configuration this does cause the job to enter a BatchHold state (other resource managers have not been tested). Whilst components of this issue remain outstanding, upgrading to 7.2.9 or Moab 8 appears to mitigate direct exploitation of the issue. ##[Detailed Timeline] 2014-01-21 : Detailed vulnerability information provided to Adaptive 2014-09-01 : Full advisory provided to Adaptive 2014-09-08 : Release of advisory to HPC community 2014-09-25 : Public release of advisory http://labs.mwrinfosecurity.com