How can you tell if an app is using dynamic code loading?

Duane Chambers
2 min readJul 31, 2023

Discovering whether an app uses dynamic code loading requires manual and automated tools. Dynamic code loading enables an app to dynamically load and execute code at runtime rather than having it statically compiled at build time, with various legitimate uses and being leveraged by malicious apps to conceal their behavior or deliver malicious payloads.

Here are a few methods to identify whether an app uses dynamic code loading:

  • Manual Code Review: Carrying out a comprehensive manual code review can uncover instances of dynamic code loading within an app’s source code, or disassembled binary can reveal instances of dynamic loading. Search for functions or libraries which facilitate code execution from external sources or use mechanisms like Java’s DexClassLoader or reflection for dynamic code loading.
  • Static Analysis Tools: Various static analysis tools are available to examine app binaries for signs of dynamic code loading. These tools can identify relevant function calls or API usage that indicate dynamic execution of software code.
  • Behavior Analysis: Run your app in a controlled environment or emulator and monitor its behavior with debugging tools. Look for instances when it requests external code or resources and dynamically loads them at runtime.
  • Network Traffic Analysis: Analyze the network traffic generated by your app. Dynamic code loading typically involves downloading code or resources from remote servers; any requests sent there could indicate dynamic code loading activity.
  • String Analysis: Examining strings within an app’s binary is essential in understanding its functionality, particularly dynamic code loading which may include strings associated with URLs, class, or package names of external code that is dynamically loaded from external sources.
  • Use of Reflection: Dynamic code loading often employs reflection in programming languages like Java. Search your app’s code for instances of reflection to detect its usage.
  • Runtime Monitoring Tools or Debuggers: Debug tools allow for runtime analysis and monitoring of an app’s execution, including function calls and any behavior which might indicate dynamic code loading.
  • Anomaly Detection: Some security tools use anomaly detection algorithms to identify any unusual app behaviors that could include dynamic code loading.

Be mindful that some legitimate apps — including those using plugins or performing updates — may use dynamic code loading for legitimate reasons, so understanding their intended functionality and developer practices before labeling this action as malicious is key.

If an app appears to use dynamic code loading for malicious purposes, report it immediately and avoid downloading from untrusted sources. For enterprise use, consider mobile app security solutions that analyze apps for potential security risks before they’re deployed on employee devices.

I recommend visiting NIST and Zimperium’s Glossary to learn more about mobile security,

--

--

Duane Chambers

I provide advisory services for corporations and executives regarding network architecture, test design/execution, network virtualization and datacenter design.