Mobile code non-final public field

Thank you for visiting OWASP.org. We have migrated our community to a new web platform and regretably the content for this page needed to be programmatically ported from its previous wiki page. There’s still some work to be done.

Description

This attack aims to manipulate non-final public variables used in mobile code, by injecting malicious values on it, mostly in Java and C++ applications.

When a public member variable or class used in mobile code isn’t declared as final, its values can be maliciously manipulated by any function that has access to it in order to extend the application code or acquire critical information about the application.

Risk Factors

TBD

Examples

A Java applet from a certain application is acquired and subverted by an attacker. Then, they make the victim accept and run a Trojan or malicious code that was prepared to manipulate non-final objects’ state and behavior. This code is instantiated and executed continuously using default JVM on the victim’s machine. When the victim invokes the Java applet from the original application using the same JVM, the malicious process could be mixed with original applet, thus it modifies values of non-final objects and executes under victim’s credentials.

In the following example, the class “any_class” is declared as final and “server_addr” variable is not:

public final class any_class extends class_Applet { public URL server_addr; }

In this case, the value of “server_addr” variable could be set by any other function that has access to it, thus changing the application behavior. A proper way to declare this variable is:

public class any_class extends class_Applet { public final URL server_addr; }

When a variable is declared as final its value cannot be modified.

TBD

References

Category:OWASP ASDR Project the last two links are the same Category:Abuse of Functionality Category:Attack