Slide 1

Slide 1 text

OWASP 301: Infrastructure-Based Security Eric Mann

Slide 2

Slide 2 text

ASR 3 - Sensitive Data Exposure

Slide 3

Slide 3 text

Many web applications do not adequately protect sensitive data, such as credit cards, tax IDs, and authentication credentials.

Slide 4

Slide 4 text

Photo borrowed from Schneier on Security: https://www.schneier.com/blog/archives/2005/02/the_weakest_lin.html

Slide 5

Slide 5 text

Sensitive Data Retention What data do you retain? Why do you need this data in the first place? Who has access to the data? Where are backups stored? Who has access to the data via the backup system?

Slide 6

Slide 6 text

Encoding is not encryption!

Slide 7

Slide 7 text

function encodeString($str) { for ($i = 0; $i < 5; $i++) { $str = strrev(base64_encode($str)); } return $str; } function decodeString($str) { for ($i = 0; $i < 5; $i++) { $str = base64_decode(strrev($str)); } return $str; } encodeString('this is a secret'); QVlRHZlbopUYxQWShRkTUR1aaVUWuB3UNdlR2NmRWplUuJkVUxGcPFGbGVkVqp0VUJjUZdVVaNVTtVUP

Slide 8

Slide 8 text

ASR 5 - Broken Access Control

Slide 9

Slide 9 text

Restrictions on what authenticated users are allowed to do are not properly enforced.

Slide 10

Slide 10 text

$app->post( '/profile', function ($request, $response, $args) { if (!isset($_SESSION['user_id']) || !$this->users->get($_SESSION['user_id'])) { return $response->withRedirect('/?error=notloggedin'); } $userID = $request->getParam('user_id'); $fname = $request->getParam('fname'); $lname = $request->getParam('lname'); $email = $request->getParam('email'); // Retrieve the user's account from the database (via the app container) $user = $this->users->get(intval($userID)); $user->profile->fname = filter_var($fname, FILTER_SANITIZE_STRING); $user->profile->lname = filter_var($lname, FILTER_SANITIZE_STRING); $user->profile->email = filter_var($email, FILTER_SANITIZE_EMAIL); $this->users->update($user); } );

Slide 11

Slide 11 text

United Airlines experienced this vulnerability in their mobile app in 2015 - https://randywestergren.com/united-airlines-bug-bounty-an-experience-in-reporting-a-serious-vulnerability//

Slide 12

Slide 12 text

ASR 6 - Security Misconfiguration

Slide 13

Slide 13 text

Secure settings should be defined, implemented, and maintained, as defaults are often insecure.

Slide 14

Slide 14 text

PHP Settings Disable error display (display_errors) Disable remote includes (allow_url_fopen and allow_url_include) Set reasonable resource maximums (upload_max_filesize and memory_limit) Leverage the disable_functions directive to block dangerous functions: exec, passthru, shell_exec, system, proc_open, popen, parse_ini_file, show_source, eval, create_function

Slide 15

Slide 15 text

Webserver Settings (Nginx / Apache / etc) Disable server tokens and signature disclosure Configure a static server name (don’t trust potentially malicious HOST headers) Disable directory traversal ALWAYS configure strong SSL certificates for secure access Return proper error codes

Slide 16

Slide 16 text

Database (MySQL) Settings Set an appropriate bind-address Ensure users are configured from the correct host, not a % wildcard Limit user permissions on the database to just what the application needs

Slide 17

Slide 17 text

ASR 9 - Using Components with Known Vulnerabilities

Slide 18

Slide 18 text

Applications using components with known vulnerabilities may undermine application defenses and enable a range of possible attacks and impacts.

Slide 19

Slide 19 text

Audit Application Dependencies Monitor Composer-installed dependencies for outdated or vulnerable libraries Leverage unattended-upgrades to keep system packages up-to-date Audit the packages installed on your server - don’t install things you don’t need

Slide 20

Slide 20 text

Custom error messages can help demonstrate when a security hole has been plugged. Or annoy those who were exploiting it in the first place...

Slide 21

Slide 21 text

Audit Application Dependencies Monitor Composer-installed dependencies for outdated or vulnerable libraries Leverage unattended-upgrades to keep system packages up-to-date Audit the packages installed on your server - don’t install things you don’t need Only run current, supported versions of PHP!!!

Slide 22

Slide 22 text

ASR 10 - Insufficient Logging & Monitoring

Slide 23

Slide 23 text

Attackers rely on the lack of monitoring and timely response to achieve their goals without being detected.

Slide 24

Slide 24 text

It’s Important to Track: What happened When it happened Where it happened (in terms of code and the IP of the server) To whom it happened What input triggered the event

Slide 25

Slide 25 text

Event Classes Input Validation Errors Output Validation Errors Authentication Events Authorization (Access Control) Failures Application Errors Application Startup/Shutdown High-risk Operations

Slide 26

Slide 26 text

(Full image slide. No text)

Slide 27

Slide 27 text

Questions?

Slide 28

Slide 28 text

Thank you [email protected] | 503.925.6266