Cisco WebEx Sanitization bypasses permit Arbitrary Remote Command Execution

2017.07.18
Credit: Tavis Ormandy
Risk: High
Local: No
Remote: Yes
CVE: N/A
CWE: N/A

In issue 1096 and issue 1100 I described various flaws in the way the Cisco WebEx extension worked, permitting remote command execution. Earlier this week a former colleague from Chrome Security, Cris Neckar from Divergent Security, pointed out that there had been some changes to the way atgpcext worked, and it looked like there may be some new problems. I see several problems with the way sanitization works, and have produced a remote code execution exploit to demonstrate them. This extension has over 20M active Chrome users alone, FireFox and other browsers are likely to be affected as well. 1. JSON parsing discrepancies. WebEx filters various critical JSON properties in the extension code, here is an example: ... var c = e.GpcExtName; if (c && (c = c.trim(), "atgpcext" != c.toLowerCase() && "atgpcext" != atob(c).toLowerCase().trim())) return !1; var d = e.GpcUnpackName; if (d && (d = d.trim(), "atgpcdec" != d.toLowerCase() && "atgpcdec" != atob(d).toLowerCase().trim())) return !1; var f = e.GpcInitCall; if (f && !a.verifyScriptCall(atob(f.trim()))) ... Unfortunately, The atgpcext library uses it's own native JSON parser to process messages from the client, which handles property names differently. Therefore, you can create a JSON object like this: object={ "foo": 1, "foo\0": 2 } Chrome will see object.foo = 1, atgpcext will see object.foo = 2. This difference in JSON parsing effectively defeats all sanitization and filtering in the WebEx extension. 2. GpcScript verification Regex is incomplete. WebEx includes a scripting language that allows WebEx messages to interact with native components, this scripting language must pass through this verification function: a.verifyScriptCall = function(a) { var b = /^(WebEx_|A[sT][ADEPSN]|conDll|RA[AM])|^(Ex|In)it|^(FinishC|Is[NS]|JoinM|[NM][BCS][JRUC]|Set|Name|Noti|Trans|Update)|^(td|SCSP)$/; if (10240 < a.length) return !1; a = a.split(";"); for (var c = 0; c < a.length; c++) { var d = a[c].trim() , f = "" , g = d.indexOf("="); 0 <= g && (d = d.substring(g + 1).trim()); g = d.indexOf("("); 0 <= g && (f = d.substring(g + 1), d = d.substring(0, g).trim()); g = f.split(","); if (1024 < f.length || 20 < g.length || 0 < d.length && !d.match(b)) return !1 } return !0 } This is incomplete, because the left hand side of assignments are not validated, but can include function calls in Cisco's language. e.g., the following GpcInitCall is accepted, and works: "_wsystem(Calc)=WebEx_Exploit;" This allows you to call any exported routine from any library, and results in arbitrary remote code execution. 3. Whitelisted Function Calls are not necessarily safe to call. If we assume for a moment that the Verification Regex worked, many whitelisted exported routines from WebEx modules accept object Parameters, for example atmccli!WebEx_AutoLaunch, which is permitted but the first parameter is an attacker controlled object. The routine immediately makes a virtual call, so the following call would result in arbitrary code execution: { ObjectAddress: "1094795585", GpcInitCall: "WebEx_AutoLaunch(ObjectAddress, ObjectAddress, ObjectAddress);" } Note that the webexlauncher catches the access violation exception, but this is irrelevant to exploitation. 4. No prevention against downgrade attacks. You can simply set a custom GpcExtVersion and GpcUrlRoot and roll back to an older version. The signature is verified, but as old versions were signed at one point they are permitted and loaded. This means fixing any vulnerabilities in native components is pointless, because an attacker can just roll you back to a vulnerable version without any user interaction. Here is a working demo: https://lock.cmpxchg8b.com/JauChal3/webex.html CREDIT These vulnerabilities were found by Tavis Ormandy from Google Project Zero and Cris Neckar of Divergent Security. This bug is subject to a 90 day disclosure deadline. After 90 days elapse or a patch has been made broadly available, the bug report will become visible to the public.

References:

https://bugs.chromium.org/p/project-zero/issues/detail?id=1324&desc=2
https://tools.cisco.com/security/center/content/CiscoSecurityAdvisory/cisco-sa-20170717-webex
https://lock.cmpxchg8b.com/JauChal3/webex.html


Vote for this issue:
50%
50%


 

Thanks for you vote!


 

Thanks for you comment!
Your message is in quarantine 48 hours.

Comment it here.


(*) - required fields.  
{{ x.nick }} | Date: {{ x.ux * 1000 | date:'yyyy-MM-dd' }} {{ x.ux * 1000 | date:'HH:mm' }} CET+1
{{ x.comment }}

Copyright 2024, cxsecurity.com

 

Back to Top