Code Injection (Ruby)
- PCI 3.2-6.5.1
- CWE 94
- CAPEC 23
- OWASP 2013-A1
Code Injection is the general term for attack types which consist of injecting code that is then interpreted/executed by the application. This type of attack exploits poor handling of untrusted data. These types of attacks are usually made possible due to a lack of proper input/output data validation, for example:
- allowed characters (standard regular expressions classes or custom)
- data format
- amount of expected data
Code Injection differs from Command Injection in that an attacker is only limited by the functionality of the injected language itself. If an attacker is able to inject PHP code into an application and have it executed, he is only limited by what PHP is capable of.
Remediation
Whitelisting is the best practice to validate input against blacklisting whenever it is practicable.