[Paper Review] Contrastive Learning for Robust Android Malware Familial Classification
This paper proposes IFDroid, a contrastive learning-based system for robust and interpretable familial classification of obfuscated Android malware. By transforming function call graphs into images via centrality analysis and applying supervised contrastive learning, IFDroid achieves 98.4% F1 on 69,421 obfuscated samples, outperforming state-of-the-art methods while enabling heatmap-based interpretability through Grad-CAM++ visualization.
Due to its open-source nature, Android operating system has been the main target of attackers to exploit. Malware creators always perform different code obfuscations on their apps to hide malicious activities. Features extracted from these obfuscated samples through program analysis contain many useless and disguised features, which leads to many false negatives. To address the issue, in this paper, we demonstrate that obfuscation-resilient malware family analysis can be achieved through contrastive learning. The key insight behind our analysis is that contrastive learning can be used to reduce the difference introduced by obfuscation while amplifying the difference between malware and other types of malware. Based on the proposed analysis, we design a system that can achieve robust and interpretable classification of Android malware. To achieve robust classification, we perform contrastive learning on malware samples to learn an encoder that can automatically extract robust features from malware samples. To achieve interpretable classification, we transform the function call graph of a sample into an image by centrality analysis. Then the corresponding heatmaps can be obtained by visualization techniques. These heatmaps can help users understand why the malware is classified as this family. We implement \emph{IFDroid} and perform extensive evaluations on two datasets. Experimental results show that \emph{IFDroid} is superior to state-of-the-art Android malware familial classification systems. Moreover, \emph{IFDroid} is capable of maintaining a 98.4\% F1 on classifying 69,421 obfuscated malware samples.
Motivation & Objective
- To address the challenge of inaccurate malware familial classification due to code obfuscation in Android apps.
- To develop an obfuscation-resilient malware classification system that maintains high accuracy despite structural code transformations.
- To enable interpretable classification by visualizing key features through Grad-CAM++ on learned representations.
- To demonstrate that contrastive learning can reduce noise from obfuscation while amplifying semantic differences between malware families.
Proposed method
- Transforming the function call graph of each Android app into a 2D image using four centrality metrics: degree, closeness, betweenness, and eigenvector centrality.
- Applying supervised contrastive learning to train an encoder that maximizes similarity between positive pairs (original and obfuscated versions) and minimizes similarity between negative pairs (different malware families).
- Using a CNN-based encoder to extract robust features from the centrality-based images, with contrastive loss optimized during training.
- Generating class-discriminative heatmaps via Grad-CAM++ to visualize which regions of the image (i.e., graph substructures) contributed most to classification decisions.
- Leveraging the pre-trained encoder for zero-shot or few-shot classification of new malware families using continuous learning.
- Evaluating the system on two datasets with 69,421 obfuscated samples to measure F1-score and robustness.

Experimental results
Research questions
- RQ1Can contrastive learning effectively reduce the impact of code obfuscation on malware family classification?
- RQ2Can the combination of centrality-based graph-to-image transformation and contrastive learning yield robust, generalizable features for malware classification?
- RQ3How does the proposed method compare in accuracy and robustness to state-of-the-art Android malware familial classification systems?
- RQ4Can visualization techniques like Grad-CAM++ provide meaningful interpretability for the model’s classification decisions?
Key findings
- IFDroid achieves a 98.4% F1-score on 69,421 obfuscated Android malware samples, demonstrating strong robustness against code obfuscation.
- The system outperforms ten state-of-the-art malware classification systems, including Dendroid, Apposcopy, FalDroid, and DroidSIFT.
- Heatmap visualization via Grad-CAM++ successfully highlights critical subgraph regions responsible for classification, enhancing model interpretability.
- The use of multiple centrality measures increases resistance to adversarial attacks by increasing the complexity of crafting effective perturbations.
- The pre-trained encoder enables effective few-shot classification of new malware families without full retraining, using continuous learning.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.