<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ariel Tempelhof on Medium]]></title>
        <description><![CDATA[Stories by Ariel Tempelhof on Medium]]></description>
        <link>https://medium.com/@arieltm?source=rss-ec4107f72fa6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*a1pLZg02u-07o1Tu.jpg</url>
            <title>Stories by Ariel Tempelhof on Medium</title>
            <link>https://medium.com/@arieltm?source=rss-ec4107f72fa6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 20:45:57 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@arieltm/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Reentrancy Guard 2.0]]></title>
            <link>https://medium.com/spherex-technologies/reentrancy-guard-2-0-cbbc0be41634?source=rss-ec4107f72fa6------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbbc0be41634</guid>
            <category><![CDATA[web3-security]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[reentrancy]]></category>
            <category><![CDATA[reentrancy-attack]]></category>
            <dc:creator><![CDATA[Ariel Tempelhof]]></dc:creator>
            <pubDate>Tue, 21 Mar 2023 09:01:04 GMT</pubDate>
            <atom:updated>2023-03-21T19:09:27.242Z</atom:updated>
            <content:encoded><![CDATA[<h4>How we could have stopped tens of millions of $ from being stolen, and accidentally made 2.5K$</h4><p>Starting our journey few months ago, we began with a comprehensive survey of smart contract security challenges and solutions. The reentrancy attack, arguably the most common and famous type of attack, was there from the get go. The ReentrancyGuard by OpenZeppelin has been around at least since <a href="https://github.com/OpenZeppelin/openzeppelin-contracts/commit/a2bd1bb7f6a6d68029e02ec42ad3309fd2ba331b">beginning of 2017</a> to mitigate these kind of attacks. So we asked ourselves, how come a bug with such an easy mitigation still causes so much havoc?</p><p>Interestingly enough, we’ve noticed something even more disturbing: protocols that had already been implementing ReentrancyGuard, to some extent, are still being hacked by reentrancy!</p><p>Cream ($18.8m), Fei-Rari ($80m), BurgerSwap ($7.2m), and Orion ($3m), to name a few. All had a reentrancy guard in place, but failed to prevent the malicious reentrant call.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*cENBDlNGipmMrxYSYUWOOA.gif" /></figure><p>We scratched our heads in bewilderment and tried to triage this.</p><p>At first we thought it might be some kind of bug in the ReentrancyGuard contract, but it was not. It is a fairly simple concept and OZ made a tremendous job in refining it.</p><p>We came to the conclusion that the traditional reentrancy guard has some fundamental limitations that prevents it from providing a perfect prevention against reentrant calls:</p><ul><li>public functions. ReentrancyGuard includes a global flag, shared between all functions.If developers intend to call a public function internally they’ll probably choose not to protect it (Since protection will result it being blocked both externally and internally)</li><li>Inheriting from a contract already implementing ReentrancyGuard , making the main contract reentrancy inheritance somewhat cumbersome</li><li>view functions. The reentrancy check includes saving to storage, making it unusable in the context of a STATICCALL</li><li>Overall integration complexity. Although the ReentrancyGuard is a very straightforward contract, it requires the developer to add a modifier to each protected function. What happens if there are multiple developers? what happens in case of protocol upgrades?</li></ul><p>As cyber security experts, we know that security counter measures are only as good as how it is being implemented, and this is exactly our way of thinking at SphereX.</p><p>We asked ourselves, is there a better implementation pattern for this crucial security element? Is there somehow a way for it to be incorporated in such a way that will prevent all the above problems and still be easily used?</p><p>The answer is yes!</p><p>Most of the protocols mentioned above were also using <strong>a proxy</strong>. Let’s imagine a conceptual protocol where a proxy is being used and the implementation is protected by a reentrancy guard:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*tFJN4Xn5xIqG5G3o6R7NnA.jpeg" /></figure><p>In this traditional design every function in the implementation is accompanied with a nonReentrant modifier. Every implementation upgrade might break the consistency of the reentrancy check and might introduce new reentrancy bugs.</p><p>We would like to suggest a different approach. For the reentrancy guard to be incorporated in the proxy contract rather than in the implementation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*Da9lTMOAxZzMeCJVVAuCKw.jpeg" /></figure><p>This way, we have one, non-distributed enforcement point to prevent Reentrancy!</p><p>This approach has some other cool features:</p><ul><li>It requires <strong>no extra coding</strong>! the proxy contract comes as is, doesn’t require any pre-deployment integrations, and now that reentrancy guard is in the proxy the implementation contract becomes leaner and cleaner.</li><li>It’s upgrade-proof! any upgrades to the protocol are on the implementation part, which will always be protected of reentrant calls by the proxy</li><li>public functions are protected! developers can now call public functions internally with ease of mind. External reentrant calls to public functions are protected using this design</li><li>view functions are protected! even in the context of a STATICCALL as special check in the proxy will prevent “read-only reentrancy”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*uYnYjk5rOYpfSj3TtvNw0A.gif" /></figure><p>We took the liberty of implementing this. We took ReentrancyGuard and TransparentUpgradeableProxy as reference contracts and used them to do exactly that. This wasn’t without challenges (That you can read about at the bottom).</p><p>Interesting story, we decided to fully implement this during the awesome ETHDenver 2023 Hackathon. Thinking that the odds were small, we presented the project in the morning of the last day of the Hackathon, and then headed to the airport to catch a flight.</p><p>We watched the live broadcast of the closing ceremony finding out we were nominated as one of the best infrastructure projects in the Hackathon 😞</p><h3>Mike Stepanovic on Twitter: &quot;Reentrancy Proxy:no-show :( / Twitter&quot;</h3><p>Reentrancy Proxy:no-show :(</p><p>We felt like this is such a fundamental piece we have to release it for everyone to benefit, but keep in mind, this is the bare minimum. Web3 hacks are becoming more and more sophisticated and our analysis shows the current tools at hand just don’t cut it.</p><p>Some technical difficulties we were facing</p><ul><li>The reentrancy flag in the reentrancy guard is stored in the contract storage. Proxies need to be careful using the storage since it is shared with the implementation. For this reason we moved the reentrancy flag to a very high storage slot</li><li>The proxy code is the same whether the current context is CALL or STATICCALL, since the reentrancy guard mechanism alters the storage, which is prohibited in STATICCALL, we have to check first this is the case and act accordingly.</li><li>OZ proxies work in such a way that after the implementation call it returns immediately (roughly speaking), we had to change this behavior to be able to reset the reentrancy flag on exit</li></ul><p>Some caveats you should know before using this:</p><ul><li>We currently still haven’t implemented any fine-grained control of the function selectors that can pass the reentrancy guard. This means that callbacks, where the contract calls a 3rd party which in turn calls a callback function in the contract, will trigger the reentrancy guard.</li><li>One legitimate use-case using this scenario is a contract transferring NFT to itself, which requires triggering <a href="https://docs.openzeppelin.com/contracts/3.x/api/token/erc721#IERC721Receiver-onERC721Received-address-address-uint256-bytes-"><strong>onERC721Received</strong></a><strong>.</strong></li><li>As with normal proxies, send and transfer of funds will probably revert due to the 2300 gas limit it creates</li></ul><p>We’re releasing the reentrancy proxy for free use by the community, for a better secured Web3.0.</p><p>Here it is:</p><p><a href="https://github.com/spherex-xyz/reentrancy-guard-proxy">https://github.com/spherex-xyz/reentrancy-guard-proxy</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbbc0be41634" width="1" height="1" alt=""><hr><p><a href="https://medium.com/spherex-technologies/reentrancy-guard-2-0-cbbc0be41634">Reentrancy Guard 2.0</a> was originally published in <a href="https://medium.com/spherex-technologies">SphereX Technologies</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SD-PWN Part 4 — VMware VeloCloud — The Last Takeover]]></title>
            <link>https://medium.com/realmodelabs/sd-pwn-part-4-vmware-velocloud-the-last-takeover-a7016f9a9175?source=rss-ec4107f72fa6------2</link>
            <guid isPermaLink="false">https://medium.com/p/a7016f9a9175</guid>
            <category><![CDATA[vmware]]></category>
            <category><![CDATA[velocloud]]></category>
            <category><![CDATA[sd-wan]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[sase]]></category>
            <dc:creator><![CDATA[Ariel Tempelhof]]></dc:creator>
            <pubDate>Thu, 26 Nov 2020 19:55:25 GMT</pubDate>
            <atom:updated>2020-11-26T19:55:25.987Z</atom:updated>
            <content:encoded><![CDATA[<h3>SD-PWN Part 4 — VMware VeloCloud — The Last Takeover</h3><p>This is the last part of our SD-PWN series where we present severe vulnerabilities in four of the leading SD-WAN vendors. This time focusing on VMware’s SD-WAN platform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*WXaziwc4g5jI1vxrljrS1g.jpeg" /></figure><p>If you haven’t read the previous posts you’re highly encouraged to:</p><p><a href="https://medium.com/realmodelabs/silver-peak-unity-orchestrator-rce-2928d65ef749">Part 1 — Silver Peak Unity Orchestrator</a></p><p><a href="https://medium.com/realmodelabs/sd-pwn-part-2-citrix-sd-wan-center-another-network-takeover-a9c950a1a27c">Part 2 — Citrix SD-WAN Center</a></p><p><a href="https://medium.com/realmodelabs/sd-pwn-part-3-cisco-vmanage-another-day-another-network-takeover-15731a4d75b7">Part 3 — Cisco Viptela vManage</a></p><p>If you use VMware VeloCloud Orchestrator make sure you <strong>update immediately</strong>. As we’re going to demonstrate, the issues below lead to unauthenticated remote code execution. The ramifications, as with the other products we covered in this series, can be used to disrupt the entire international network of a company.</p><h3>VMware VeloCloud Orchestrator</h3><p>VMware VeloCloud Orchestrator connects to the edge routers and centrally controls the network topology. This is why it is a crucial single point of failure from a security perspective.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/0*b0cSfPbR1O8WCIrX" /></figure><p>The VeloCloud infrastructure consists of nginx serving mainly as a reverse proxy for node.js servers.</p><h4>If it looks random, swims like it’s random, and quacks like it’s random, is it random?</h4><p>One of the first steps in a security survey of a product is to map out the unauthenticated interfaces it exposes. The obvious ones are the login &amp; password reset.</p><p>The general password reset concept is pretty straightforward:</p><ol><li>Generate one of the two:<br>• A random unique key that can’t be predicted <br>• A signed token</li><li>Send it using a predefined side channel that is assumed to be in the sole possession of the user (E-mail or SMS)</li><li>Prompt the user to enter the random key</li></ol><p>In step 1 Velocloud made two grave mistakes.</p><p>Velocloud, instead of generating random bytes for the reset key, probably looked at the users table in their database and said to themselves “Hey, we need some random bytes, here are some seemingly random bytes — the user’s hashed password, why not use this?”</p><p>Furthermore, they did implement an encrypted, signed token, but also added an option to use an unsigned cleartext one using the {CLEAR} prefix.</p><p>These two issues constitute what is known as Pass The Hash Attack.</p><p>But how do we know the hashed password you ask? Normally, we will try and find other vulnerabilities for DB data extraction, namely SQL injections.</p><p>But this is where it becomes interesting. Velocloud has used a practice we’ve seen less of in the past years. They added predefined backdoor users.</p><p>To be fair, the backdoor users are disabled by default, and probably no one except Velocloud knows their passwords, only their hashed values. However, the PTH Attack allows us to use the hashed password during the password reset procedure which also reenables the user.</p><p>These three issues lead to the first CVE.</p><h3>Authentication bypass using PTH + default accounts — CVE-2020-4001</h3><p>Using the previously described procedure we were able to reset the super@velocloud.net account possessing the highest admin rights in the system and after doing so it was no longer disabled. The attacker’s prior knowledge is:</p><ul><li>super@velocloud.net’s hashed password</li><li>A parameter called logicalId</li></ul><p>Both are predefined and can be obtained from the installation files. These values do not change between instances of the system.</p><p>This issue leverages all the rest and allows them to be run by an unauthenticated party.</p><h3>Modulus parameter SQL Injection — CVE-2020-3984</h3><p>This is a standard SQL injection vulnerability in which user controlled data is being concatenated to an SQL query without escaping any characters. One of the places this is happening is the softwareUpdate/getSoftwareUpdates method using the modulus parameter. This SQLi enables us to extract any data from the DB (it is non-blind).</p><h3>Rest Meta Dir Traversal + Unauthenticated File Inclusion — CVE-2020-4000</h3><p>The portal/rest/meta handler uses req.originalUrl to get the request method. The originalUrl is then being used to require a file. Now, putting a .. sign in the path itself will be resolved by the webserver and omitted, but originalUrl includes the full GET query string, including the GET parameters. Using urls with .. after the ? sign will result in directory traversal.</p><pre>/portal/rest/meta/none?test/%2E%2E/%2E%2E/%2E%2E/%2E%2E/%2E%2E/%2E%2E/somefile.js</pre><p>This primitive enables us to execute almost any JavaScript file on the local disk.</p><p>Although this issue is exposed to an unauthenticated attacker, we haven’t found an unauthenticated way to upload a file so that it can be included. We tried to think about ways to deliver js code from the network instead of the disk (e.g. using /proc/self/fd/*), but that didn’t work and we already found the other vulnerabilities which were enough. If you have any voodoo Linux tricks that can help require controlled content without dropping a file to disk we would love to hear from you.</p><h3>RCE Chain</h3><p>We haven’t found any straightforward shell injections. Our main approach was to utilize the file inclusion vulnerability by uploading a JavaScript file with controlled content. Still, all places involving a file upload had restrictions on the content. Then we looked at the generic file upload module and we’ve noticed that uploaded files which didn’t pass the content verification are not being deleted.</p><p>The filename is randomly generated and not being returned to the user. The only part that was aware of the filename was the logger module. Thankfully Velocloud added the feature of setting the syslog server of the device. So this is our RCE chain:</p><ol><li>Reset super@velocloud.net’s password (thus enabling it)</li><li>Login using the newly enabled account</li><li>Set our own server as the system’s syslog server</li><li>Upload a JavaScript file</li><li>Receive the random filename using an incoming syslog message</li><li>Use the Rest Meta file inclusion to require the JavaScript file</li></ol><p>This will lead to our JavaScript code running in node.js . Here is the POC script:</p><p><a href="https://github.com/RealmodeLabs/SD-PWN/blob/master/vmware_velocloud_orchestrator_rce.py">RealmodeLabs/SD-PWN</a></p><h3>Closing Remarks</h3><p>This concludes our SD-PWN series. If you look at the SD-WAN products that are out there, there’s something they have in common that we thought should get some notice. Many of them are products that originated in startups and were later acquired by large companies.</p><p>Silver Peak was acquired by HPE, Viptela by Cisco and VeloCloud by VMware. Talari was acquired by Oracle but it looks like Citrix shares some of their codebase.</p><p>The thing is that startup companies usually put less emphasis on securing their products. They need to build a system from scratch, they have tight development schedules, code is often left unreviewed and sometimes shortcuts are made.</p><p>The truth of the matter is that some of the issues were trivial, some were more complicated, but they were all bugs that could have been found and fixed by a standard security review.</p><p>This is why a security focused pair of eyes need to inspect crucial parts of the code. No one wants to read about their product having vulnerabilities like these in a post on a security blog, or much worse, discover it being used in the wild.</p><p>If you are interested in auditing your products, or performing special security research you can find us on <a href="https://twitter.com/RealmodeLabs">Twitter,</a> <a href="https://www.linkedin.com/company/realmode-labs/">LinkedIn </a>or contact us at <a href="/service/mailto:contact@realmodelabs.com">contact@realmodelabs.com</a></p><p>This is not a goodbye. Our next post will be focused on an everyday gadget many of us use (we would love to hear your guesses) and how we found some interesting, yet disturbing, issues with it. Stay tuned.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a7016f9a9175" width="1" height="1" alt=""><hr><p><a href="https://medium.com/realmodelabs/sd-pwn-part-4-vmware-velocloud-the-last-takeover-a7016f9a9175">SD-PWN Part 4 — VMware VeloCloud — The Last Takeover</a> was originally published in <a href="https://medium.com/realmodelabs">Realmode Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SD-PWN Part 2 — Citrix SD-WAN Center — Another Network Takeover]]></title>
            <link>https://medium.com/realmodelabs/sd-pwn-part-2-citrix-sd-wan-center-another-network-takeover-a9c950a1a27c?source=rss-ec4107f72fa6------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9c950a1a27c</guid>
            <category><![CDATA[sd-wan]]></category>
            <category><![CDATA[cakephp]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[citrix]]></category>
            <category><![CDATA[cyber]]></category>
            <dc:creator><![CDATA[Ariel Tempelhof]]></dc:creator>
            <pubDate>Sun, 15 Nov 2020 19:34:01 GMT</pubDate>
            <atom:updated>2020-11-15T19:34:01.099Z</atom:updated>
            <content:encoded><![CDATA[<h3>SD-PWN Part 2 — Citrix SD-WAN Center — Another Network Takeover</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*DxQMOEbpZiPRhLYvPecwfw.jpeg" /></figure><p>Everyone knows that Citrix takes security seriously. This is the story of how we gained remote code execution in the Citrix SD-WAN platform.</p><p>To be fair to Citrix, we did the same for <a href="https://medium.com/realmodelabs/silver-peak-unity-orchestrator-rce-2928d65ef749">Silver Peak</a> and two more leading networking companies to be revealed in future posts. All the vulnerabilities we found allow full remote code execution. Is this representative of a problem with SD-WAN security as a whole?</p><p>If you use Citrix SD-WAN make sure you <strong>update Immediately</strong>. This is a major vulnerability which allows someone to intercept traffic or take down your whole international network.</p><h3>Who Doesn’t Like Cake</h3><p>Citrix SD-WAN has been studied before by <a href="https://medium.com/u/f73d48b47782">Chris Lyne</a> of Tenable. He presented an <a href="https://medium.com/tenable-techblog/an-exploit-chain-against-citrix-sd-wan-709db08fb4ac">RCE chain</a> going all the way to the SD-WAN appliances. His <a href="https://medium.com/tenable-techblog/intro-to-cakephp-for-bug-hunters-97b89f8876bd">Intro to CakePHP for Bug Hunters</a> helped us a lot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/370/1*mDmc28hPBxtq5FocLG680A.png" /></figure><p>Not much has changed in the Citrix SD-WAN infrastructure. It still runs on Apache with CakePHP2 as the framework.</p><p>One of the most important parts of a security audit is examining past work and checking if past fixes have been implemented correctly. The main bug presented by Tenable was bypassing authentication by using the Collector endpoint to reach diagnostics. Citrix decided to block this access by adding the following access restriction in the apache configuration at /etc/apache2/sites-enabled/talari:</p><pre>SSLCACertificateFile /home/talariuser/certificates/apnaware_cert.pem<br>...<br>&lt;LocationMatch (?i)^/collector/&gt;<br> SSLVerifyClient require<br> SSLVerifyDepth 0<br>&lt;/LocationMatch&gt;</pre><p>This looks legit. To use the Collector endpoint you must present a client certificate signed by the vendor. As we haven’t found any way past this, we can’t send a request starting with /Collector/. But how does the CakePHP2 framework handle URLs? Let’s look at the function _url in CakeRequest.php:</p><pre>protected function _url() {<br> if (!empty($_SERVER[&#39;PATH_INFO&#39;])) {<br>  return $_SERVER[&#39;PATH_INFO&#39;];<br> } elseif (isset($_SERVER[&#39;REQUEST_URI&#39;]) &amp;&amp; strpos($_SERVER[&#39;REQUEST_URI&#39;], &#39;://&#39;) === false) {<br>  $uri = $_SERVER[&#39;REQUEST_URI&#39;];<br> } elseif (isset($_SERVER[&#39;REQUEST_URI&#39;])) {<br>  $qPosition = strpos($_SERVER[&#39;REQUEST_URI&#39;], &#39;?&#39;);<br>  if ($qPosition !== false &amp;&amp; strpos($_SERVER[&#39;REQUEST_URI&#39;], &#39;://&#39;) &gt; $qPosition) {<br>   $uri = $_SERVER[&#39;REQUEST_URI&#39;];<br>  } else {<br>   <strong>$uri = substr($_SERVER[&#39;REQUEST_URI&#39;], strlen(FULL_BASE_URL));</strong><br>  }</pre><pre>...<br> return $uri;<br>}</pre><p>To put this in words, if our REQUEST_URI contains ? after a :// the beginning of the URI will be removed. This will cause a discrepancy between how Apache sees the URI and how CakePHP analyzes it, which in turn allows us to bypass the client certificate check for the Collector endpoint. A URI of the form</p><pre>aaaaaaaaaaaaaaaaa/://?/collector/diagnostics/stop_ping </pre><p>will translate to</p><pre>/collector/diagnostics/stop_ping </pre><p>and require neither client certificate nor authentication.</p><p>We had an internal discussion whether this is a Citrix vulnerability or a much wider CakePHP2 one. We haven’t come up with a conclusion and would love to hear your opinion.</p><p>Now for the actual CVEs:</p><h4>Unauthenticated Path Traversal &amp; Shell Injection in stop_ping — CVE-2020–8271</h4><p>The /collector/diagnostics/stop_ping endpoint reads the file &quot;/tmp/pid_&quot; . $req_id and uses its contents in a shell_exec call. No sanitization is performed on the user supplied $req_id which allows path traversal. One can drop a file with user controlled content anywhere (for example, using /collector/licensing/upload) and run an arbitrary shell command.</p><h4>ConfigEditor Authentication Bypass — CVE-2020–8272</h4><p>This is an interesting bug related to how CakePHP translates the URI to Endpoint function parameters. Each element of the URI path after the endpoint name will be treated as a handler function parameter. If we have a router definition of</p><pre>Router::connect(&#39;/sdwan_center/nitro/v1/config_editor/:resource/*&#39;, array(&#39;controller&#39; =&gt; &#39;restApi&#39;, &#39;resource&#39; =&gt; &#39;[a-zA-Z]+&#39;, &#39;action&#39; =&gt; &#39;configEditor&#39;));</pre><p>and our handler definition is</p><pre>public function configEditor($params, $auth = false,$internal = false)</pre><p>The $auth parameter is specifically used in internal calls and is not meant to be set from outside. But, using the following URI:</p><pre>/sdwan_center/nitro/v1/config_editor/config_packages/test2=test2/test3/test4</pre><p>will result in the following parameter assignments</p><pre>$resource = &quot;config_packages;<br>$params = &quot;test2=test2&quot;<br>$auth = &quot;test3&quot;;<br>$internal = &quot;test4&quot;;</pre><p>Since the $auth parameter is now assigned, all of the configEditor functionality is accessible without authentication.</p><h4>CreateAzureDeployment Shell Injection — CVE-2020–8273</h4><p>In the AzureDeployment/createAzureDeployment endpoint, user supplied data is being JSON encoded and concatenated to an exec call using the code:</p><pre>$deploymentData = json_encode($this-&gt;request-&gt;data,JSON_UNESCAPED_SLASHES);</pre><pre>$cmd = &quot;sudo python3 &quot;.START_DEPLOY_SCRIPT.&quot; &#39;&quot;.$deploymentData.&quot;&#39; &gt; /dev/null 2&gt;&amp;1 &amp;&quot;;<br>$cmdResult = exec($cmd);</pre><p>Passing parameters of the form</p><pre>{&quot;loginData&quot;: &quot;test&#39;;ping -c 5 192.168.1.1;&#39;&quot;, &quot;param&quot;: &quot;1&quot;}</pre><p>Will run the shell command ping -c 5 192.168.1.1.</p><h4>RCE Chain</h4><p>Combining the Collector authentication bypass and the stop_ping shell injection will result in a pre-authenticated remote code execution. Here is an exploitation script:</p><p><a href="https://github.com/RealmodeLabs/SD-PWN/blob/master/citrix_sdwan_center_rce.py">RealmodeLabs/SD-PWN</a></p><h3>Closing Remarks</h3><p>We’ve shown in this post two authentication bypasses and two shell injections in Citrix SD-WAN Center.</p><p>In defense of Citrix we’ll admit that it’s hard to anticipate that CakePHP would treat URLs the way that it does. That’s why performing dedicated security audits on your products is so important.</p><p>If you want to hear about the next SD-PWN vulnerability before everyone else make sure you follow us on <a href="https://www.linkedin.com/company/realmode-labs/">LinkedIn</a> or contact us at <a href="/service/mailto:contact@realmodelabs.com">contact@realmodelabs.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9c950a1a27c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/realmodelabs/sd-pwn-part-2-citrix-sd-wan-center-another-network-takeover-a9c950a1a27c">SD-PWN Part 2 — Citrix SD-WAN Center — Another Network Takeover</a> was originally published in <a href="https://medium.com/realmodelabs">Realmode Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Silver Peak Unity Orchestrator RCE]]></title>
            <link>https://medium.com/realmodelabs/silver-peak-unity-orchestrator-rce-2928d65ef749?source=rss-ec4107f72fa6------2</link>
            <guid isPermaLink="false">https://medium.com/p/2928d65ef749</guid>
            <category><![CDATA[sase]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[sd-wan]]></category>
            <dc:creator><![CDATA[Ariel Tempelhof]]></dc:creator>
            <pubDate>Sun, 08 Nov 2020 11:00:20 GMT</pubDate>
            <atom:updated>2020-11-09T18:39:02.903Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/588/1*eqt6B62wI1bUnCBWiWwWIA.jpeg" /></figure><p>SD-WAN is a big deal. Gartner calls it the “replacement for traditional WAN routers”. But with great power comes great responsibility. Here at Realmode Labs, we researched the top four SD-WAN products on the market and<strong> </strong>found major remote code execution vulnerabilities. The vulnerabilities require no authentication whatsoever to exploit. In the best case scenario, an attacker can use these vulnerabilities to intercept or steer traffic. However, if an attacker desires, they can instead shutdown a company’s entire international network.</p><p>This is a four part series — in each post we’ll disclose another vulnerability in a major SD-WAN vendor. First up is Silver Peak. Gartner calls Silver Peak a “leader in the Magic Quadrant for WAN Edge Infrastructure” and they were recently acquired by HPE. But are they secure?</p><h3>SD-PWN Part 1 — Silver-Peak Unity Orchestrator</h3><p>Silver Peak is mostly remembered by us for having the best commercials of the lot:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FM8OUoe5dUvI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DM8OUoe5dUvI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FM8OUoe5dUvI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f082addd39ffd007400a69c178eed73d/href">https://medium.com/media/f082addd39ffd007400a69c178eed73d/href</a></iframe><p>First, some background. These vulnerabilities are in the Silver-Peak SD-WAN Orchestrator. An Orchestrator is the main management interface centrally controlling the SD-WAN topology of the company. This is obviously a crucial point from a security perspective. In order to gain remote code execution we discovered three different CVEs which join together to allow an attacker to SD-PWN the network.</p><p>Apart from Wayne McFarkus, examining Silver-Peak Unity Orchestrator revealed that the system runs on CentOS with JAVA applets running as the web server.</p><h4>Authentication Bypass — CVE-2020–12145</h4><p>Looking at the code handling the API calls, we’ve noticed special treatment for API calls originating from localhost where no authentication is being performed. Putting aside that this is probably a bad idea (it can really help in case of SSRF), after further examination we reached the point where the localhost check is being performed:</p><pre>request.getBaseUri().getHost().equals(“localhost”)</pre><p>Any requests with “localhost” as their HTTP Host header will satisfy this check. This can be easily forged in remote requests of course.</p><h4>File Delete Path Traversal — CVE-2020–12146</h4><p>Some of the API endpoints, which are now accessible thanks to the authentication bypass, allow the ability to upload debug logs to an S3 bucket to be examined by Silver Peak. This mechanism prepares the logs, uploads them and then deletes the locally hosted file. The /gms/rest/debugFiles/delete endpoint performing the deletion does not check for path traversal, creating the ability to delete any file on the system (if permissions allow).</p><h4>Arbitrary SQL Query Execution — CVE-2020–12147</h4><p>A special API endpoint exists to run arbitrary SQL queries. This endpoint is accessible only by localhost but same as in the Authentication Bypass this can be easily executed remotely.</p><p>The /gms/rest/sqlExecution endpoint can be leveraged to an arbitrary file write by utilizing an INTO DUMPFILE clause. INTO DUMPFILE does not allow overwriting a file but one can use the “File Delete Path Traversal” issue to first delete the file and then rewrite it.</p><p><strong>Full RCE Chain</strong></p><p>We didn’t find straightforward shell injections. But, by utilizing the three vulnerabilities, one can run arbitrary code using the following steps:</p><ol><li>Look for a file being run by the web server</li><li>Delete it using the File Delete Path Traversal issue</li><li>Recreate it using the SQL Query Execution endpoint</li><li>Trigger the execution of the file</li></ol><p>One such file found by us is /home/gms/gms/phantomGenImg.js. It’s part of a report generation process and it’s being run by PhantomJS. PhantomJS contains the child_process module making it possible to run arbitrary shell commands on the system.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FTt32Cr4pteE&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DTt32Cr4pteE&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/aeeb2d5b94b77c75154bc80f63803081/href">https://medium.com/media/aeeb2d5b94b77c75154bc80f63803081/href</a></iframe><p>The Script:</p><p><a href="https://github.com/RealmodeLabs/SD-PWN/blob/master/silver_peak_unity_orchestrator_rce.py">RealmodeLabs/SD-PWN</a></p><p>All issues found were disclosed to the respective vendors and resolved by the time of publication.</p><p>If you want to hear about the next SD-PWN vulnerability before everyone else then make sure you follow us on <a href="https://www.linkedin.com/company/realmode-labs/">LinkedIn</a> or contact us at <a href="/service/mailto:contact@realmodelabs.com">contact@realmodelabs.com</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2928d65ef749" width="1" height="1" alt=""><hr><p><a href="https://medium.com/realmodelabs/silver-peak-unity-orchestrator-rce-2928d65ef749">Silver Peak Unity Orchestrator RCE</a> was originally published in <a href="https://medium.com/realmodelabs">Realmode Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>