WHAT IS CODE INJECTION?
Code injection is the term used to describe attacks that inject code into an application. That injected code is then interpreted by the application, changing the way a program executes. Code injection attacks typically exploit an application vulnerability that allows the processing of invalid data. This type of attack exploits poor handling of untrusted data, and these types of attacks are usually made possible due to a lack of proper input/output data validation. Attackers are able to introduce (or inject) code into a computer program with this type of vulnerability.
Code injection differs from command injection, where the goal is to hijack a vulnerable application in order to execute arbitrary commands on the host operating system. Command injection consists of leveraging existing code to execute commands, usually within the context of a shell.