cwong-scw / action-playground

0 stars 2 forks source link

jaiowejf cwe94 #25

Open cwong-scw opened 3 years ago

cwong-scw commented 3 years ago

dfiaofj ssrf stored xss use after free

temp-scw-app[bot] commented 3 years ago

Micro-Learning Topic: Code Injection (CWE 94)

What is this? (2min video)

Code injection happens when an application insecurely accepts input that is subsequently used in a dynamic code evaluation call. If insufficient validation or sanitisation is performed on the input, specially crafted inputs may be able to alter the syntax of the evaluated code and thus alter execution. In a worst case scenario, an attacker could run arbitrary code in the server context and thus perform almost any action on the application server.

Try to identify instances where external input is subsequently used in a dynamic code evaluation call and identify the code context in which each input is used. Carefully review the data flow of these inputs and determine if appropriate filtering or encoding is being performed. You may need to look up language reference material to identify the language-specific special characters that any validation or sanitisation logic will need to account for.

Try this challenge in Secure Code Warrior

Micro-Learning Topic: Use After Free (Detected by phrase)

What is this? (2min video)

Dereferencing pointers to objects that have already been freed opens the door to execution of arbitrary code. Attackers may be able to insert instructions at the freed memory location in order to trigger the exploit when the pointer is used after the memory has been freed.

There are many ways this vulnerability may appear in code. Garbage collection, weak pointers, duplicate raw pointers, improperly written wrapper classes. The bottom line is to check the life time management of every memory or object reference and ensure that if memory is released then any reference or pointer falls out of scope or initialised to null.

Try this challenge in Secure Code Warrior

Micro-Learning Topic: Stored Cross-Site Scripting (Detected by phrase)

What is this? (2min video)

Stored cross-site scripting vulnerabilities happen when unescaped input is displayed by the application after successful storage in persistence layers (e.g. database or cache). When HTML or script is included in the input that is stored in the database, and is then rendered into a page without escaping or encoding, it will be processed by a user's browser as HTML or script and can alter the appearance of the page or execute malicious scripts in their user context.

Find the instances in the application where external input is saved to the persistence layer and subsequently displayed to users. Try to trace each value all the way from input to display and work out if any escaping or encoding is applied to prevent these values from being treated as raw HTML or script once it is written to the page. Pay special attention to the context of where the values are being written into a page as different contexts may have different encoding requirements. For example, a value written into a HTML tag attribute will require different encoding to a value written into a HTML tag value.

Try this challenge in Secure Code Warrior

Micro-Learning Topic: Reflected Cross-Site Scripting (Detected by phrase)

What is this? (2min video)

Reflected cross-site scripting vulnerabilities occur when unescaped input is displayed in the resulting page displayed to the user. When HTML or script is included in the input, it will be processed by a user's browser as HTML or script and can alter the appearance of the page or execute malicious scripts in their user context.

Find the instances in the application where external input is displayed to users. Try to trace each value all the way from input to display and work out if any escaping or encoding is applied to prevent these values from being treated as raw HTML or script once it is written to the page. Pay special attention to the context of where the values are being written into a page as different contexts may have different encoding requirements. For example, a value written into a HTML tag attribute will require different encoding to a value written into a HTML tag value.

Try this challenge in Secure Code Warrior

Micro-Learning Topic: Server-Side Request Forgery (SSRF) (Detected by phrase)

What is this? (2min video)

Server-Side Request Forgery (SSRF) vulnerabilities are caused when an attacker can supply or modify a URL that reads or sends data to the server. The attacker can create a malicious request with a manipulated URL, when this request reaches the server, the server-side code executes the exploit URL causing the attacker to be able to read data from services that shouldn't be exposed.

Look for places where URLs are handled such as calling resources from external servers, requests that are sent to external services or custom webhooks. Additionally, check where the user can specify custom URLs.

Try this challenge in Secure Code Warrior