code-injectie
Sign in to saveAlso known as injection attack, code injection attack, injection vulnerability, code injection vulnerability
class of exploits in which a vulnerable computer program misinterprets data as code
Described at
CWE - CWE-94: Improper Control of Generation of Code ('Code Injection') (4.20)
Common Weakness Enumeration (CWE) is a list of software weaknesses.
cwe.mitre.org →Home CWE List CWE-94: Improper Control of Generation of Code ('Code Injection') (4.20) ID Lookup: The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. This table specifies different individual consequences associated with the weakness. The Scope identifies the application security area that is violated, while the Impact describes the negative technical impact that arises if an adversary succeeds in exploiting this weakness. The Likelihood provides information about how likely the specific consequence is expected to be seen relative to the other consequences in the list. For example, there may be high likelihood that a weakness will be exploited to achieve a certain impact, but a low likelihood that it will be exploited to achieve a different impact. This table shows the weaknesses and high level categories that are related to this weakness. These relationships are defined as ChildOf, ParentOf, MemberOf and give insight to similar items that may exist at higher and lower levels of abstraction. In addition, relationships such as PeerOf and CanAlsoBe are defined to show similar weaknesses that the user may want to explore. MemberOf Category - a CWE entry that contains a set of other entries that share a common characteristic. 137 Data Neutralization Issues MemberOf Category - a CWE entry that contains a set of other entries that share a common characteristic. 1019 Validate Inputs The different Modes of Introduction provide information about how and when this weakness may be introduced. The Phase identifies a point in the life cycle at which introduction may occur, while the Note provides a typical scenario related to introduction during the given phase. Implementation REALIZATION: This weakness is caused during implementation of an architectural security tactic. This listing shows possible areas for which the given weakness could appear. These may be for specific named Languages, Operating Systems, Architectures, Paradigms, Technologies, or a class of such platforms. The platform is listed along with how frequently the given weakness appears for that instance. This example attempts to write user messages to a message file and allow users to view them. The programmer thought they were just including the contents of a regular data file, but PHP parsed it and executed the code. Now, this code is executed any time people view messages. Any arbitrary Perl code could be added after the attacker has "closed off" the construction of the original function call, in order to prevent parsing errors from causing the malicious eval() to fail before the attacker's payload is activated. This particular manipulation would fail after the system() call, because the " key( $fname, $key, $val)" portion of the string would cause an error, but this is irrelevant to the attack because the payload has already been activated. This simple python3 script asks a user to supply a comma-separated list of numbers as input and adds them together. The eval() function can take the user-supplied list and convert it into a Python list object, therefore allowing the programmer to use list comprehension methods to work with the data. However, if code is supplied to the eval() function, it will execute that code. For example, a malicious user could supply the following string: This would delete all the files in the current directory. For this reason, it is not recommended to use eval() with untrusted input. An alternative, commonly-cited mitigation for this kind of weakness is to use the ast.literal eval() function, since it is intentionally designed to avoid executing code. However, an adversary could still cause excessive memory or stack consumption via deeply nested structures [REF-1372 ], so the python documentation discourages use of ast.literal eva
Excerpt from a page describing this subject · 40,000 chars · not written by Vinony
Wikidata facts
Show 3 more facts
- described at URL
- cwe.mitre.org/data/definitions/94.html
- Stack Exchange tag
- stackoverflow.com/tags/code-injection
- different from
- dependency injection
Sources (1)
via Wikidata · CC0
Article · Nederlands
Code-injectie is het misbruik van een computerbug waarbij data die niet valide is door een programma wordt verwerkt. Deze hacktechniek wordt door hackers toegepast om code in te voeren (te 'injecteren') in een kwetsbaar computerprogramma en het verloop van de uitvoering ervan te veranderen. Succesvolle code-injectie kan zeer ernstige gevolgen hebben, hierdoor kunnen bijvoorbeeld computerwormen worden verspreid. Code-injectie-veiligheidslekken vinden plaats als een applicatie niet-gevalideerde data naar een interpreter stuurt. Deze data wordt vaak handmatig door hackers ingevoerd, maar veelal gebeurt dit ook automatisch. Dit soort veiligheidslekken worden doorgaans gevonden in SQL-, LDAP-, XPath-, of NoSQL-query's; commando's die deel uitmaken van het OS, XML-parsers, SMTP-headers, argumenten van programma's, etc. Veel van dit soort veiligheidslekken zijn eenvoudiger te detecteren door broncode te onderzoeken dan door te testen. Scanners en fuzzers kunnen evengoed helpen deze veiligheidslekken te vinden. Code-injectie kan leiden tot verlies van gegevens of datacorruptie, traceerbaarheid tegengaan of toegang tot systemen onmogelijk maken. Ook kan deze hacktechniek ervoor zorgen dat complete systemen zoals servers of werkstations worden overgenomen. Code-injectietechnieken zijn populair bij het hacken van systemen om data te stelen, voor het ongeoorloofd verkrijgen van toegang tot systemen met meer "rechten" of het überhaupt toegang krijgen tot systemen. Voor veel doeleinden kan deze hacktechniek worden ingezet, waaronder: * Het willekeurig veranderen van waarden in een database door middel van SQL-injectie. Het resultaat hiervan kan bijvoorbeeld website defacement zijn, maar ook het compromitteren van vertrouwelijke data. * De installatie van malware of het uitvoeren van schadelijke code op een server, door scriptcode zoals PHP of ASP te injecteren. * Het verkrijgen van meer toegangsrechten tot aan rootpermissies door het injecteren van shellcode in binaire bestanden die setuid root zijn op UNIX systemen of op het lokale systeem door misbruik van een service op Windows. * Het aanvallen van gebruikers van het Web met het injecteren van HTML of Javascript (Cross-site scripting). In 2008 was 5,66% van alle beveiligingslekken die waren gerapporteerd geclassificeerd als code-injectie, dit was het jaar waarin de meeste van dergelijke beveiligingslekken waren gerapporteerd. In 2015 was dit percentage afgenomen tot 0,77%.
Abstract from DBpedia / Wikipedia · CC BY-SA