<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-US"><generator uri="https://jekyllrb.com/" version="4.1.1">Jekyll</generator><link href="https://klise.now.sh/feed.xml" rel="self" type="application/atom+xml" /><link href="https://klise.now.sh/" rel="alternate" type="text/html" hreflang="en-US" /><updated>2024-10-03T13:06:32+07:00</updated><id>https://klise.now.sh/feed.xml</id><title type="html">Sam</title><subtitle>Hiya! I&apos;m a Security Researcher with a focus on CyberCrime and Ransomware.</subtitle><author><name>Sam M</name><email>xprotectszn@gmail.com</email></author><entry><title type="html">Defcon 32 Talk - Bypass 101</title><link href="https://klise.now.sh/Bypass101-defcon/" rel="alternate" type="text/html" title="Defcon 32 Talk - Bypass 101" /><published>2024-08-09T09:45:47+07:00</published><updated>2024-08-09T09:45:47+07:00</updated><id>https://klise.now.sh/Bypass101-defcon</id><content type="html" xml:base="https://klise.now.sh/Bypass101-defcon/"><![CDATA[<hr />

<p>I want to thank Karen Ng for co-speaking with me!</p>
<hr />

<p>Talk Description - There are loads of ways to get through a door without actually attacking the lock itself, including using the egress hardware, access control hardware, and countless other techniques to gain entry. Learn how to do these attacks in this talk!</p>

<p>Slide Deck - <a href="https://media.defcon.org/DEF%20CON%2032/DEF%20CON%2032%20villages/DEF%20CON%2032%20-%20Physical%20Security%20Village%20-%20Karen%20Ng%20%26%20Sam%20Mayers%20-%20Bypass101.pdf">https://media.defcon.org/DEF%20CON%2032/DEF%20CON%2032%20villages/DEF%20CON%2032%20-%20Physical%20Security%20Village%20-%20Karen%20Ng%20%26%20Sam%20Mayers%20-%20Bypass101.pdf</a></p>

<p>Video - (Will update when posted)</p>]]></content><author><name>Sam M</name><email>xprotectszn@gmail.com</email></author><category term="Defcon" /><category term="Bypass" /><category term="Presentations" /><summary type="html"><![CDATA[There are loads of ways to get through a door without actually attacking the lock itself, including using the egress hardware, access control hardware, and countless other techniques to gain entry. Learn how to do these attacks in this talk!]]></summary></entry><entry><title type="html">How AMOS macOS stealer avoids detection</title><link href="https://klise.now.sh/How-AMOS-macOS-Stealer-Avoids-Detection/" rel="alternate" type="text/html" title="How AMOS macOS stealer avoids detection" /><published>2024-03-02T09:45:47+07:00</published><updated>2024-03-02T09:45:47+07:00</updated><id>https://klise.now.sh/How-AMOS-macOS-Stealer-Avoids-Detection</id><content type="html" xml:base="https://klise.now.sh/How-AMOS-macOS-Stealer-Avoids-Detection/"><![CDATA[<hr />

<p>Check out the blog post on the orginal site: <a href="https://www.kandji.io/blog/amos-macos-stealer-analysis">Kandji Blog</a> (Credit to Christopher Lopez who wrote this article with me)</p>
<hr />

<p>Atomic macOS Stealer (AMOS) was first spotted in early 2023. It’s a powerful piece of malware that targets Apple users and tricks them into installing the software on their computers. The malware is sold via Telegram; as of January 20, 2024, the price was $3,000 a month.</p>

<p>Once installed, Atomic Stealer can exfiltrate an extensive amount of data, including keychain passwords, user documents, system info, cookies, browser data, credit card information, cryptocurrency wallets, and more.</p>
<figure>
<img src="/How-AMOS-macOS-Stealer-Avoids-Detection/image1.png" width="400" height="500" alt="Telegram post" />
</figure>
<p>Adversaries leveraging AMOS direct victims to a website (the URL of which changes constantly) to download an unsigned disk image (DMG). If a user were to go that URL accidentally, they’d see only a benign welcome message.</p>
<figure>
<img src="/How-AMOS-macOS-Stealer-Avoids-Detection/image2.png" alt="Telegram post" />
</figure>
<p>On that website is a subdirectory where 12 DMG files are available for download: Six in the <code class="language-plaintext highlighter-rouge">/name</code> directory, another six in <code class="language-plaintext highlighter-rouge">/name/files</code>.</p>
<figure>
<img src="/How-AMOS-macOS-Stealer-Avoids-Detection/image3.png" width="500" height="380" alt="Telegram post" />
</figure>
<figure>
<img src="/How-AMOS-macOS-Stealer-Avoids-Detection/image4.png" width="500" height="380" alt="Telegram post" />
</figure>
<p>Each of these twelve DMG files gives you a different hash. This is a way to avoid hash-based detection.  (We’ll explain how they do that in a bit.) Because of this, hash-based detection for this new version will not work, since every time someone downloads the sample, they’d need to look for a new hash. From our research, this is new: AMOS creators have not previously had a way to iterate small portions of code to change hashes.</p>

<p>If you did download one of these DMG files, a pop-up would appear that looks similar to any other application you download from outside the Apple store.</p>
<figure>
<img src="/How-AMOS-macOS-Stealer-Avoids-Detection/image5.png" width="600" height="400" alt="Telegram post" />
</figure>
<p>Inside that DMG is a Mach-O that, if the user right-clicks and opens it, the malware will execute.</p>

<h1 id="xor-encoding">XOR Encoding</h1>

<p>Since it first appeared, AMOS has continued to evolve. A recent sample included <code class="language-plaintext highlighter-rouge">XOR</code> instructions to prevent detections of strings known to be associated with this stealer. The capabilities of the latest sample do not appear to have changed, but its obfuscation tactics differ from previously reported samples.</p>

<p>In the example below, some of the strings are visible even with the <code class="language-plaintext highlighter-rouge">XOR</code> encoding. The XOR key for these is <code class="language-plaintext highlighter-rouge">0x90</code>, so we can see how these are separated by null bytes. It appears that, for many of these, only half of the strings were <code class="language-plaintext highlighter-rouge">XOR</code> encoded.</p>
<figure>
<img src="/How-AMOS-macOS-Stealer-Avoids-Detection/image6.png" width="1000" height="400" alt="Telegram post" />
</figure>
<p>In a more recent sample, we can see that no strings are visible in the const section. Something appears to have changed with how the encoding is completed. This further highlights how quickly and often the AMOS malware changes.</p>
<figure>
<img src="/How-AMOS-macOS-Stealer-Avoids-Detection/image7.png" width="1000" height="400" alt="Telegram post" />
</figure>
<p>Let’s dive into an example of how an <code class="language-plaintext highlighter-rouge">XOR</code> function is called, along with the arguments that are passed in the arm64 slice of the Universal binary.</p>

<figure class="highlight"><pre><code class="language-markdown" data-lang="markdown">1  10000c7cc  28108052  mov   w8, #0x81
2  10000c7d0  e8430039  strb  w8, [sp, #0x10 {xorKey}]  {0x81}
3  10000c7d4  e8430091  add   x8, sp, #0x10 {xorKey}
(...)
4  10000c84c  29008052  mov   w9, #0x1
5  10000c850  e013813c  stur  q0, [sp, #0x11 {var_af}]
6  10000c854  3f0d02f1  cmp   x9, #0x83
7  10000c858  80000054  b.eq  0x10000c868
8  10000c85c  ea434039  ldrb  w10, [sp, #0x10 {xorKey}]
9  10000c860  b20d0094  bl    _OUTLINED_FUNCTION_1
10 10000c864  fcffff17  b     0x10000c854
11 10000c868  a0110094  bl    _system</code></pre></figure>

<p>Starting at line 1, the value <code class="language-plaintext highlighter-rouge">0x81</code> is moved to register W8. This will be the <code class="language-plaintext highlighter-rouge">XOR</code> key used later to decode the string stored on the stack.</p>

<p>At line 2, the <code class="language-plaintext highlighter-rouge">XOR</code> key is stored on the stack at the address <code class="language-plaintext highlighter-rouge">SP + 0x10</code>.</p>

<p>Line 3 indicates that a pointer to this offset on the stack is moved to register <code class="language-plaintext highlighter-rouge">X8</code>.</p>

<p>Between line 3 and 4, hex values are moved into registers and stored on the stack. This will be the string to decode.</p>

<p>Line 4 shows the value <code class="language-plaintext highlighter-rouge">0x1</code> is moved into <code class="language-plaintext highlighter-rouge">W9</code>. This will serve as the index used to iterate through the string.</p>

<p>Line 5 indicates that the value stored at register <code class="language-plaintext highlighter-rouge">Q0</code> is saved on the stack at <code class="language-plaintext highlighter-rouge">SP + 0x11</code>. This is one byte away from where the <code class="language-plaintext highlighter-rouge">XOR</code> key is stored.</p>

<p>Line 6 compares the value stored at <code class="language-plaintext highlighter-rouge">X9</code> and <code class="language-plaintext highlighter-rouge">0x83</code>, which would be the length of the string.</p>

<p>Line 7 shows a branch <code class="language-plaintext highlighter-rouge">if equals instruction</code>, which would branch to the address <code class="language-plaintext highlighter-rouge">0x10000c82c</code> when <code class="language-plaintext highlighter-rouge">X9 = 0x83</code>. The system() function is at <code class="language-plaintext highlighter-rouge">0x10000c82c</code>, which indicates that, once the decoding is complete for <code class="language-plaintext highlighter-rouge">0x82</code> characters, the output is passed as the argument to the <code class="language-plaintext highlighter-rouge">system()</code> function.</p>

<p>Line 8 is a <code class="language-plaintext highlighter-rouge">LDRB</code> instruction that loads the byte value stored at <code class="language-plaintext highlighter-rouge">SP +0x10</code> (XOR Key) to <code class="language-plaintext highlighter-rouge">W10</code>.</p>

<p>Line 9 is the branch to the function called <code class="language-plaintext highlighter-rouge">_OUTLINED_FUNCTION_1</code>, where the <code class="language-plaintext highlighter-rouge">XOR</code> instructions occur.</p>

<p>Line 10 indicates that once the <code class="language-plaintext highlighter-rouge">XOR</code> function is completed, a branch back to the comparison of the value stored in <code class="language-plaintext highlighter-rouge">W9</code> is completed to continue this loop.</p>

<p>Line 11 is the <code class="language-plaintext highlighter-rouge">system()</code> function call after the loop completes. This sets up the call to the <code class="language-plaintext highlighter-rouge">system()</code> function after decoding the string using an <code class="language-plaintext highlighter-rouge">XOR</code> function.</p>

<p>Let’s now look at the <code class="language-plaintext highlighter-rouge">XOR</code> function called <code class="language-plaintext highlighter-rouge">_OUTLINED_FUNCTION_1</code>, which we branched to above.</p>

<figure class="highlight"><pre><code class="language-markdown" data-lang="markdown">10000ff28  int64_t _OUTLINED_FUNCTION_1(char<span class="err">*</span> arg1 @ x8, int64_t arg2   @ x9, 
10000ff28  char arg3 @ x10)
10000ff28  0b696938  ldrb  w11, [x8, x9]
10000ff2c  6a010a4a  eor  w10, w11, w10
10000ff30  0a692938  strb  w10, [x8, x9]
10000ff34  29050091  add  x9, x9, #0x1
10000ff38  c0035fd6  ret     </code></pre></figure>

<p>The function definition indicates that the values stored in <code class="language-plaintext highlighter-rouge">X8</code>, <code class="language-plaintext highlighter-rouge">X9</code>, and <code class="language-plaintext highlighter-rouge">X10</code> are passed as arguments: <code class="language-plaintext highlighter-rouge">X8</code> is pointing to the stack at <code class="language-plaintext highlighter-rouge">SP +0x10</code>; <code class="language-plaintext highlighter-rouge">X9</code> is our index, which at the start of this loop was given the value <code class="language-plaintext highlighter-rouge">0x1</code>; and <code class="language-plaintext highlighter-rouge">X10</code> has the <code class="language-plaintext highlighter-rouge">XOR</code> key byte value <code class="language-plaintext highlighter-rouge">0x81</code>.</p>

<p>Using the value in <code class="language-plaintext highlighter-rouge">X9</code> as the index, the byte stored at the memory address <code class="language-plaintext highlighter-rouge">X8 + X9</code> is loaded into <code class="language-plaintext highlighter-rouge">W11</code>. The encoded string starts at the address of <code class="language-plaintext highlighter-rouge">SP +0x11</code>, one byte away from what <code class="language-plaintext highlighter-rouge">X8</code> is pointing to. This is why the loop starts with <code class="language-plaintext highlighter-rouge">X9</code> having the value <code class="language-plaintext highlighter-rouge">0x1</code> as the index.</p>

<p>The <code class="language-plaintext highlighter-rouge">EOR (XOR)</code> instruction then uses the key (<code class="language-plaintext highlighter-rouge">0x81</code>) stored in W10 to calculate the hex value stored back into <code class="language-plaintext highlighter-rouge">W10</code>. The STRB instruction then stores this byte back to the location at <code class="language-plaintext highlighter-rouge">[X8, X9]</code> which is the string pointed to by <code class="language-plaintext highlighter-rouge">X8</code> with the index in <code class="language-plaintext highlighter-rouge">X9</code>.</p>

<p>This example creates an <code class="language-plaintext highlighter-rouge">osascript</code> command that is common in AMOS samples and is passed to the system function to execute.</p>
<style>
  code {
    white-space : pre-wrap !important;
    word-break: break-word;
  }
</style>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>osascript <span class="nt">-e</span> <span class="s1">'display dialog "Some error occurred while running the application." buttons {"OK"} default button 1 with icon stop'</span>
</code></pre></div></div>

<p>This example is just to demonstrate how one string is decoded in this manner using the <code class="language-plaintext highlighter-rouge">0x81</code> key. There are many other examples in the binary that leverage similar functionality to decode the strings. To highlight the use of the <code class="language-plaintext highlighter-rouge">XOR</code> function described above, we can see that <code class="language-plaintext highlighter-rouge">_OUTLINED_FUNCTION_1</code> is called 120 times by other functions in the binary, further highlighting the use of this encoding.</p>

<p>AMOS is an active malware that is constantly changing and frequently being updated. As we post this, the source website is still live and is being actively updated; on March 1, the site was updated between 2:00 and 8:00 AM PST. Kandji is actively tracking the group that is distributing this malware and will continue to monitor and update our security processes as needed. We suggest that all security devs/teams should do the same.</p>

<h1 id="indicators-of-compromise">Indicators Of Compromise</h1>
<h3 id="sha256">SHA256</h3>

<ul>
  <li>CrackSetup.dmg/dowload1.php: <code class="language-plaintext highlighter-rouge">c988fd14753a8ee73d5c2747e4deeda8ef798deeb747435a112744d243cfb7ba</code></li>
  <li>CrackSetup-2.dmg/dowload2.php: <code class="language-plaintext highlighter-rouge">400303250be2414d340675226aea7f78757ea8d1413af8dcd8f2c7a8d3ff8e21</code></li>
  <li>CrackSetup-3.dmg/dowload3.php: <code class="language-plaintext highlighter-rouge">0e8aa909c1fefe12fd12f8f1e0073203ef4111f27fefb48568fd6ab02c13fb38</code></li>
  <li>CrackSetup-4.dmg/dowload4.php: <code class="language-plaintext highlighter-rouge">9e52d52e53393ac49447a8fa1d0e98b4f7835346b7f7b85df1b9c891b554924c</code></li>
  <li>CrackSetup-5.dmg/dowload5.php: <code class="language-plaintext highlighter-rouge">785e96c34123d1b2e30e9cc43972ab165f584815cdb323bd892b78fe7c9980e7</code></li>
  <li>CrackSetup-6.dmg/dowload6.php: <code class="language-plaintext highlighter-rouge">64abdcd49e9f12f6f92457a006dc1876f04dc1ad9bcab5d1766f126a87a5c60a</code></li>
  <li>CrackInstaller.dmg: <code class="language-plaintext highlighter-rouge">ed46d8865491e81d14197eafc71165eb0358086680a604e4bf6fe9c6372e741c</code></li>
  <li>hendro.dmg: <code class="language-plaintext highlighter-rouge">469a0176993e13c28b5b8f7f85a382e576f5e93310c8f5dec53a860783b97f0f</code></li>
  <li>riesling.dmg: <code class="language-plaintext highlighter-rouge">d7c7aad5899fa10e47cd1f7a224c62a44ea2858b1205762e183d69cdf356a6c2</code></li>
  <li>vera.dmg: <code class="language-plaintext highlighter-rouge">cb6ebdc900d730f844f07d9d66ee4008aeedff1eac0662553f1713fffb29f058</code></li>
  <li>whiskey.dmg: <code class="language-plaintext highlighter-rouge">596330886e915d9905d72284dcba6b663d8db95e84c00d25e1e19a3d79b01664</code></li>
  <li>zinfandel.dmg: <code class="language-plaintext highlighter-rouge">aebd77032f05029f0c6d614d40a5891926daec04fba4254a671b59709dfa625f</code></li>
</ul>]]></content><author><name>Sam M</name><email>xprotectszn@gmail.com</email></author><category term="AMOS" /><category term="Mac Malware" /><summary type="html"><![CDATA[Atomic macOS Stealer (AMOS) was first spotted in early 2023. It's a powerful piece of malware that targets Apple users and tricks them into installing the software on their computers.]]></summary></entry></feed>