Injection vulnerabilities: command injection and SQL injection

Size: px
Start display at page:

Download "Injection vulnerabilities: command injection and SQL injection"

Transcription

1 Injection vulnerabilities: command injection and SQL injection Questões de Segurança em Engenharia de Software (QSES) Departamento de Ciência de Computadores Faculdade de Ciências da Universidade do Porto Eduardo R. B. Marques,

2 Injection Vulnerability class CWE-74 Improper Neutralization of Special Elements in Output Used by a Downstream Component Short name: Injection Description The software constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted [ ] [ ] all injection problems share one thing in common [ ] the execution of the process may be altered by sending code in through legitimate data channels, using no other mechanism. While buffer overflows, and many other flaws, involve the use of some further issue to gain execution, injection problems need only for the data to be parsed. 2

3 Two examples from last class SQL injection CWE-89 int id = input(); String query = "SELECT NAME FROM USERS WHERE ID=" + id Statement conn = db.createstatement(); ResultSet rs = conn.executequery(query); //... OS command injection CWE-78 user = input(); String[] cmdline = { "/bin/sh", "-c", "finger " + user }; Process p = Runtime.getRuntime().exec(cmdLine); 3 SQL injection and OS command injection are the top two entries in the CWE/SANS Top 25 Most Dangerous Software Errors

4 CWE TOP #1 and #2 - SQL and Command injection #4 - Cross-site scripting frequently uses some form of injection #3 - Buffer overflows involve more issues than plain input handling, hence are not technically considered forms of injection (even if they require malicious input to be injected ) 4

5 Injection vulnerabilities Ingredients improper input validation / trust boundary violations (last class) malicious input, when parsed or interpreted, alters execution of the program. relies on and/or results on a blurred distinction between code and data Let s take a closer look at two types of injection: Command injection SQL injection 5

6 OS command injection

7 OS commands why and how OS commands are often handy, e.g.: as a shortcut for more verbose/complex code (shell commands can be quite expressive) to invoke third-party software / OS utilities (gluing functionality) Example ways to execute OS commands: Traditional system call in C, Python, Perl, or equivalent support in other languages, e.g., Runtime.exec() in Java (as in the example) Within SQL in some database engines (!!!): xp_cmdshell in SQL Server exec directive in "server-side includes" 7

8 Input-based vulnerability Input determines the executed commands. Special meta-characters are interpreted by the system shell. Suppose you have system( mybeautifulcommand $input ) Now consider $input = somearg; rm -fr * The executed commands are mybeautifulcommand somearg rm -fr * 8

9 Environment-based vulnerabilities Environment determines what commands are executed. Suppose you have system( mybeautifulcommand $input ) This assumes mybeautifulcommand is in the PATH of the running program If attacker can affect the PATH, a malicious mybeautifulcommand may be executed instead. How? Suppose commands are executed in association with a certain user badguy. Malicious environment settings can be loaded by the shell from badguy s environment configuration (.profile,.bashrc, etc) Variations The path for dynamically-linked code can also be controlled by environment variables, e.g. LD_PRELOAD and LD_LIBRARY_PATH in Unix IFS separator variable changes the interpretation of file names! 9

10 Shellshock A family of security bugs starting with CVE aka ShellShock Base vulnerability: The UNIX bash shell unintentionally executed commands that were concatenated to the end of function definitions stored in environment variables (!!). Example export X= () { }; maliciouscommand runanything # does not need to access X!! and maliciouscommand would run! Example exploits HTTP request headers converted to environment variables to CGI programs in many platforms! So Check more info here and here. 10

11 Mitigations #1 Avoid OS command execution! The safest thing to do! But not always practical! #2 Input validation Whitelisting strategy - for instance only allow command strings to be executed as long as they do not contain any special shell characters Meta-character escaping for sanitisation Measures are prone to loopholes: scripting languages and system shell flavours can be very creative/heterogeneous in terms of command execution variants #3 Environment-based vulnerabilities Only use commands with full path specified or explicitly control PATH setting / other dangerous variables #4 Taint mode execution in Perl, PHP, Python keep track of tainted (unsecure) data and disallow their use in security-sensitive spots; let s see how it works next with a simple example Useful for mitigating command injection and other purposes. It employs taint analysis, a subject we will go back to. 11

12 Mitigation by input validation DVWA Have a look at the source code for command injection: low.php : input is used directly to execute command Exploit easy : ; cat /etc/passwd or && cat / etc/passwd medium.php: blacklisting of ; and &&, removed from input Still easy: cat /etc/passwd high.php: blacklisting of more characters impossible.php: whitelist strategy, validates that input is strictly an IP address, reject all other input 12

13 Example mitigations Perl s taint mode #! /opt/local/bin/perl $username = $ARGV[0]; system("finger $username"); -T switch #! /opt/local/bin/perl -T $username = $ARGV[0]; system("finger $username"); Input-based command injection through command-line argument. Environment-based command injection also possible. PATH may be arbitrarily set. This will force us to transform the program. Let s run it and see how! Small Perl program (similar to the Java example) Malicious use: unsafe.pl someusername; arbitrarycommand -T switch activates taint mode which tries to keep track of tainted (unsecure) data and their use in security-sensitive spots 13

14 Example mitigations Perl s taint mode (2) #! /opt/local/bin/perl -T $username = $ARGV[0]; system("finger $username"); Insecure $ENV{PATH} #! /opt/local/bin/perl -T $ENV{PATH} = /usr/bin ; $username = $ARGV[0]; system("finger $username"); Set PATH to a safe value. Insecure dependency in system 14 #! /opt/local/bin/perl -T $ENV{PATH}='/usr/bin'; $username = $ARGV[0]; if ($username =~ /^([\w\_]+)$/ ) { system("finger $1"); } else { print "Invalid argument: '". $username. "'\n"; } Regular expression match assumed to yield untainted data. The reasoning is to force program to perform input validation. Regular expression can still potentially be inadequate.

15 SQL injection (SQLi)

16 SQLi Context SQL (Structured Query Language): the standard for interfacing with databases. most common SQL code normally defined and executed by arbitrary programs, in conjunction with some API (e.g. JDBC for Java). SQL injection happens when programs supply inputs to the SQL code that alter their intended functionality maliciously. Discussion: typical SQLi patterns probes for SQL injection points mitigation strategies 16

17 Tales of Bobby tables Exploits of a mom SQLi attacks are common and cause serious damage SQL injection hall of shame The History of SQL Injection, the Hack That Will Never Go Away Some people just try to be funny (?) about it (inspired by XKCD) Did Little Bobby Tables migrate to Sweden? ; DROP TABLE "COMPANIES";-- LTD 17

18 SQLi motivation int id = input(); String query = "SELECT NAME FROM USERS WHERE ID=" + id Statement conn = db.createstatement(); ResultSet rs = conn.executequery(query); //... id parameter, used for building the query, is a front door for arbitrary command execution possible leading to Data tampering - modifying the database Information disclosure - disclosing unauthorised data, e.g. the even the entire database schema Denial of Service - by issuing a time-consuming query 18

19 SQLi flavours int id = input(); String query = "SELECT NAME FROM USERS WHERE ID=" + id Statement conn = db.createstatement(); ResultSet rs = conn.executequery(query); //... Piggy-backed queries (sequences) id = 1234 ; DELETE FROM USERS UNION queries 19 id = 1234 UNION SELECT PASSWORD FROM USERS WHERE ID=1234 Tautologies id = 1234 OR 1=1 Further reading: "A Classification of SQL Injection Attacks and Countermeasures, Halfond et al., ISSSE 06 Available on QSES web page

20 SQLi probes malformed SQL int id = input(); String query = "SELECT NAME FROM USERS WHERE ID=" + id Statement conn = db.createstatement(); ResultSet rs = conn.executequery(query); //... Use malformed SQL id = 1234 FOLLOWED_BY_INVALID_SQL Server may yield back detailed error messages providing positive indication that SQLi is possible 20

21 SQLi probes Blind SQL injection int id = input(); String query = "SELECT NAME FROM USERS WHERE ID=" + id Statement conn = db.createstatement(); ResultSet rs = conn.executequery(query); //... Blind SQL injection works by issuing false / true statements and comparing the responses id = 1234 AND 1=2 : server may report no data, but we may not be aware if the query was rejected / malformed id = 1234 AND 1=1 : if output is different then SQLi should be possible 21

22 Blind SQLi - DVWA example yields Looks like a vulnerable answer SQLi may be possible, how can we be sure? Perhaps input was sanitised instead? 22

23 Blind SQLi - DVWA example (2) yields Different answer! SQLi point identified! 23

24 SQLi probes time-based blind SQL injection int id = input(); String query = "SELECT NAME FROM USERS WHERE ID=" + id Statement conn = db.createstatement(); ResultSet rs = conn.executequery(query); //... Time-based SQL injection works by issuing functions that may cause a delay in the query if a delay is noticeable, SQLi should be possible E.g. SLEEP function for MySQL - info here at sqlinjection.net for different databases DVWA demo: you may use 1 AND SLEEP(5)-- x 24

25 SQLi and stored procedures CREATE OR REPLACE PROCEDURE proddescr(vname IN VARCHAR2, vresult OUT VARCHAR2) AS vsql VARCHAR2(4000); BEGIN vsql := 'SELECT description FROM products WHERE name=''' vname ''''; EXECUTE IMMEDIATE vsql INTO vresult; END; Example taken from sqlinjection.net : we can play with the vname parameter Stored procedures are not necessarily safer to use and prone to SQLi Even without SQLi some built-in stored procedures can be inherently dangerous, like the xp_cmdshell we mentioned for OS command injection 25

26 SQLi mitigation General principles (as always) Fail safely Run with least privilege Secure programming Input sanitisation by escaping input arguments Parameterised queries But how do I spot sensitive spots? using static analysis tools like FindBugs (FindSecBugs plugin in particular) using pen-testing tools like sqlmap.org brief demo at the end, more on this in future classes 26

27 Input sanitisation DVWA example vulnerabilities/sqli_blind/source/medium.php $id = mysql_real_escape_string($id, ) $getid = SELECT first_name, last_name FROM users WHERE user_id = $id;" Helpful, but prone to loopholes 27

28 Parameterised queries PHP (example from DVWA) vulnerabilities/sqli/source/impossible.php $data = $db->prepare( 'SELECT first_name, last_name FROM users WHERE user_id = (:id) ); $data->bindparam( ':id', $id, PDO::PARAM_INT ); $data->execute(); Java String sql = "SELECT ID, NAME, PASSWORD, ROLE, CREATED FROM USERS WHERE LOGIN =?"; PreparedStatement stmt = db.preparestatement(sql); stmt.setstring(1, login); The safest programming pattern Prepare (compile) statement with placeholders for argument Bind input parameters and indicate their types programatically after preparing statement 28 Note: it won t be helpful if input affects query construction in other ways beside strict query arguments, e.g. consider SELECT * FROM + tablename + WHERE ID=?

29 29 Static analysis example FindSecBugs (for Java)

30 Static analysis example awap > > > > File: /Users/edrdo/qses/tools/dvwa/DVWA/vulnerabilities/sqli_blind/ source/high.php < < < < > Information: - Number of Lines of Code: 33 - It is a include file: no - Included files: none - Defined user function: none - Number of Vulnerabilities detected: 1 - Real Vulnerabilities: 1 - False positives: 0 = = = = Vulnerability n.: 1 = = = = Vulnerable code: 5: $id = $_COOKIE[ 'id' ]; 8: $getid = "SELECT first_name, last_name FROM users WHERE user_id = '$id' LIMIT 1;"; 9: $result = mysqli_query($globals[" mysqli_ston"], $getid ); // Removed 'or die' to suppress mysql errors 30

31 31 Static analysis example RIPS

32 Pen-testing tool sqlmap python./sqlmap.py \ -u " GET parameter 'id' is vulnerable. Do you want to keep testing the others (if any)? [y/n] N sqlmap identified the following injection point(s) with a total of 211 HTTP(s) requests: --- Parameter: id (GET) Type: boolean-based blind Title: OR boolean-based blind - WHERE or HAVING clause (MySQL comment) (NOT) Payload: id=2' OR NOT 1576=1576#&Submit=Submit Type: error-based Title: MySQL >= 5.0 AND error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR) Payload: id=2' AND (SELECT 2030 FROM(SELECT COUNT(*),CONCAT(0x716b707671,(SELECT (ELT(2030=2030,1))),0x71767a7071,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a)-- avqj&submit=submit 32

Secure Programming Lecture 8++: SQL Injection

Secure Programming Lecture 8++: SQL Injection Secure Programming Lecture 8++: SQL Injection David Aspinall, Informatics @ Edinburgh 9th February 2016 Outline Overview Other past attacks More examples Classification Injection route and motive Forms

More information

Injection attacks use specially crafted inputs to subvert the intended operation of applications.

Injection attacks use specially crafted inputs to subvert the intended operation of applications. Secure Programming Lecture 8: SQL Injection David Aspinall, Informatics @ Edinburgh 8th February 2018 Recap Injection attacks use specially crafted inputs to subvert the intended operation of applications.

More information

Input validation - wrap-up discussion & complementary aspects -

Input validation - wrap-up discussion & complementary aspects - Input validation - wrap-up discussion & complementary aspects - Questões de Segurança em Engenharia de Software (QSES) Mestrado em Segurança Informática Departamento de Ciência de Computadores Faculdade

More information

The Most Dangerous Software Errors

The Most Dangerous Software Errors What is CWE? What is CWE? Secure Programming Lecture 7: Injection David Aspinall, Informatics @ Edinburgh 5th February 2016 Idea: organise CVEs into categories of problem Use categories to describe scope

More information

This slide shows the OWASP Top 10 Web Application Security Risks of 2017, which is a list of the currently most dangerous web vulnerabilities in

This slide shows the OWASP Top 10 Web Application Security Risks of 2017, which is a list of the currently most dangerous web vulnerabilities in 1 This slide shows the OWASP Top 10 Web Application Security Risks of 2017, which is a list of the currently most dangerous web vulnerabilities in terms of prevalence (how much the vulnerability is widespread),

More information

Secure Programming Lecture 7: Injection

Secure Programming Lecture 7: Injection Secure Programming Lecture 7: Injection David Aspinall, Informatics @ Edinburgh 10th February 2017 Outline Ranking vulnerabilities by type Trust assumptions Command injection Meta-characters in shell commands

More information

SQL Injection. EECS Introduction to Database Management Systems

SQL Injection. EECS Introduction to Database Management Systems SQL Injection EECS3421 - Introduction to Database Management Systems Credit "Foundations of Security: What Every Programmer Needs To Know" (Chapter 8) by Neil Daswani, Christoph Kern, and Anita Kesavan

More information

Software Security problems. Erik Poll. Digital Security group Radboud University Nijmegen

Software Security problems. Erik Poll. Digital Security group Radboud University Nijmegen Software Security problems Erik Poll Digital Security group Radboud University Nijmegen Problems with Insecure input handling is the most common security problem aka lack of input validation, but that

More information

Software Security. Erik Poll. Digital Security group Radboud University Nijmegen

Software Security. Erik Poll. Digital Security group Radboud University Nijmegen Tackling Software Security problems Erik Poll Digital Security group Radboud University Nijmegen 1 Erik Poll Recall: input attacks malicious input application a bug! malicious input application (abuse

More information

I n p u t. This time. Security. Software. sanitization ); drop table slides. Continuing with. Getting insane with. New attacks and countermeasures:

I n p u t. This time. Security. Software. sanitization ); drop table slides. Continuing with. Getting insane with. New attacks and countermeasures: This time Continuing with Software Security Getting insane with I n p u t sanitization ); drop table slides New attacks and countermeasures: SQL injection Background on web architectures A very basic web

More information

WEB SECURITY: SQL INJECTION

WEB SECURITY: SQL INJECTION WEB SECURITY: SQL INJECTION CMSC 414 FEB 15 2018 A very basic web architecture Client Server A very basic web architecture Client Server A very basic web architecture Client Server A very basic web architecture

More information

WEB SECURITY p.1

WEB SECURITY p.1 WEB SECURITY 101 - p.1 spritzers - CTF team spritz.math.unipd.it/spritzers.html Disclaimer All information presented here has the only purpose to teach how vulnerabilities work. Use them to win CTFs and

More information

CHAPTER 8 CONCLUSION AND FUTURE ENHANCEMENTS

CHAPTER 8 CONCLUSION AND FUTURE ENHANCEMENTS 180 CHAPTER 8 CONCLUSION AND FUTURE ENHANCEMENTS 8.1 SUMMARY This research has focused on developing a Web Applications Secure System from Code Injection Vulnerabilities through Web Services (WAPS-CIVS),

More information

SECURE CODING PART 1 MAGDA LILIA CHELLY ENTREPRENEUR CISO ADVISOR CYBERFEMINIST PEERLYST BRAND AMBASSADOR TOP 50 CYBER CYBER

SECURE CODING PART 1 MAGDA LILIA CHELLY ENTREPRENEUR CISO ADVISOR CYBERFEMINIST PEERLYST BRAND AMBASSADOR TOP 50 CYBER CYBER SECURE CODING PART 1 MAGDA LILIA CHELLY ENTREPRENEUR CISO ADVISOR CYBERFEMINIST PEERLYST BRAND AMBASSADOR TOP 50 CYBER INFLUENCER @RESPONSIBLE CYBER 1 AGENDA 1. Introduction: What is security? How much

More information

ATTACKING SYSTEM & WEB Desmond Alexander CISSP / GIAC/ GPEN CEO FORESEC

ATTACKING SYSTEM & WEB Desmond Alexander CISSP / GIAC/ GPEN CEO FORESEC ATTACKING SYSTEM & WEB Desmond Alexander CISSP / GIAC/ GPEN CEO FORESEC AGENDA VULNERABILITIES OF WEB EXPLOIT METHODS COUNTERMEASURE About Me DIRECTOR OF FORESEC COUNTER TERRORIST ACTION TEAM RESEARCH

More information

Server-side web security (part 2 - attacks and defences)

Server-side web security (part 2 - attacks and defences) Server-side web security (part 2 - attacks and defences) Security 1 2018-19 Università Ca Foscari Venezia www.dais.unive.it/~focardi secgroup.dais.unive.it Basic injections $query = "SELECT name, lastname,

More information

Lecture 7: Web hacking 3, SQL injection, Xpath injection, Server side template injection, File inclusion

Lecture 7: Web hacking 3, SQL injection, Xpath injection, Server side template injection, File inclusion IN5290 Ethical Hacking Lecture 7: Web hacking 3, SQL injection, Xpath injection, Server side template injection, File inclusion Universitetet i Oslo Laszlo Erdödi Lecture Overview What is SQL injection

More information

CIT 380: Securing Computer Systems

CIT 380: Securing Computer Systems CIT 380: Securing Computer Systems Secure Programming Slide #1 Topics 1. The nature of trust 2. Input validation 3. Input entry points 4. Integer overflows 5. Format string attacks Slide #2 Trust Relationships

More information

(System) Integrity attacks System Abuse, Malicious File upload, SQL Injection

(System) Integrity attacks System Abuse, Malicious File upload, SQL Injection Pattern Recognition and Applications Lab (System) Integrity attacks System Abuse, Malicious File upload, SQL Injection Igino Corona igino.corona (at) diee.unica.it Computer Security April 9, 2018 Department

More information

GUI based and very easy to use, no security expertise required. Reporting in both HTML and RTF formats - Click here to view the sample report.

GUI based and very easy to use, no security expertise required. Reporting in both HTML and RTF formats - Click here to view the sample report. Report on IRONWASP Software Product: IronWASP Description of the Product: IronWASP (Iron Web application Advanced Security testing Platform) is an open source system for web application vulnerability testing.

More information

Secure coding practices

Secure coding practices Secure coding practices www.infosys.com/finacle Universal Banking Solution Systems Integration Consulting Business Process Outsourcing Secure coding practices Writing good code is an art but equally important

More information

DEFENSIVE PROGRAMMING. Lecture for EDA 263 Magnus Almgren Department of Computer Science and Engineering Chalmers University of Technology

DEFENSIVE PROGRAMMING. Lecture for EDA 263 Magnus Almgren Department of Computer Science and Engineering Chalmers University of Technology DEFENSIVE PROGRAMMING Lecture for EDA 263 Magnus Almgren Department of Computer Science and Engineering Chalmers University of Technology Traditional Programming When writing a program, programmers typically

More information

Advanced Web Technology 10) XSS, CSRF and SQL Injection

Advanced Web Technology 10) XSS, CSRF and SQL Injection Berner Fachhochschule, Technik und Informatik Advanced Web Technology 10) XSS, CSRF and SQL Injection Dr. E. Benoist Fall Semester 2010/2011 1 Table of Contents Cross Site Request Forgery - CSRF Presentation

More information

A1 (Part 2): Injection SQL Injection

A1 (Part 2): Injection SQL Injection A1 (Part 2): Injection SQL Injection SQL injection is prevalent SQL injection is impactful Why a password manager is a good idea! SQL injection is ironic SQL injection is funny Firewall Firewall Accounts

More information

CSE 565 Computer Security Fall 2018

CSE 565 Computer Security Fall 2018 CSE 565 Computer Security Fall 2018 Lecture 15: Software Security II Department of Computer Science and Engineering University at Buffalo 1 Software Vulnerabilities Buffer overflow vulnerabilities account

More information

injection vulnerabilities

injection vulnerabilities injection vulnerabilities 1 Changelog 1 Corrections made in this version not in first posting: 17 April 2017: slide 35: make note on slide of second escaping s misinterpretation Last time 2 static analysis

More information

Hack-Proofing Your ASP.NET Applications

Hack-Proofing Your ASP.NET Applications Note: Article is mapped toe ACCP Trim 4 and ACCP-Pro Term III Introduction Almost every day, the mainstream media reports that another site has been hacked. These constant intrusions by prominent hacker

More information

Secure Web App. 제목 : Secure Web Application v1.0 ( 채수민책임 ) Copyright 2008 Samsung SDS Co., Ltd. All rights reserved - 1 -

Secure Web App. 제목 : Secure Web Application v1.0 ( 채수민책임 ) Copyright 2008 Samsung SDS Co., Ltd. All rights reserved - 1 - Secure Web App. Copyright 2008 Samsung SDS Co., Ltd. All rights reserved - 1 - Building & Testing Secure Web Applications By Aspect Security Copyright 2008 Samsung SDS Co., Ltd. All rights reserved - 2

More information

Web Application & Web Server Vulnerabilities Assessment Pankaj Sharma

Web Application & Web Server Vulnerabilities Assessment Pankaj Sharma Web Application & Web Server Vulnerabilities Assessment Pankaj Sharma Indian Computer Emergency Response Team ( CERT - IN ) Department Of Information Technology 1 Agenda Introduction What are Web Applications?

More information

CS 356 Systems Security Spring 2015

CS 356 Systems Security Spring 2015 CS 356 Systems Security Spring 2015 http://www.cs.colostate.edu/~cs356 Dr. Indrajit Ray http://www.cs.colostate.edu/~indrajit Original slides by Lawrie Brown. Adapted for CS 356 by Indrajit Ray Software

More information

Web insecurity Security strategies General security Listing of server-side risks Language specific security. Web Security.

Web insecurity Security strategies General security Listing of server-side risks Language specific security. Web Security. Web Security Web Programming Uta Priss ZELL, Ostfalia University 2013 Web Programming Web Security Slide 1/25 Outline Web insecurity Security strategies General security Listing of server-side risks Language

More information

CSC 405 Computer Security. Web Security

CSC 405 Computer Security. Web Security CSC 405 Computer Security Web Security Alexandros Kapravelos akaprav@ncsu.edu (Derived from slides by Giovanni Vigna and Adam Doupe) 1 source: https://xkcd.com/327/ 2 source: https://xkcd.com/327/ 3 source:

More information

WEB SECURITY WORKSHOP TEXSAW Presented by Solomon Boyd and Jiayang Wang

WEB SECURITY WORKSHOP TEXSAW Presented by Solomon Boyd and Jiayang Wang WEB SECURITY WORKSHOP TEXSAW 2014 Presented by Solomon Boyd and Jiayang Wang Introduction and Background Targets Web Applications Web Pages Databases Goals Steal data Gain access to system Bypass authentication

More information

Jacksonville Linux User Group Presenter: Travis Phillips Date: 02/20/2013

Jacksonville Linux User Group Presenter: Travis Phillips Date: 02/20/2013 Jacksonville Linux User Group Presenter: Travis Phillips Date: 02/20/2013 Welcome Back! A Quick Recap of the Last Presentation: Overview of web technologies. What it is. How it works. Why it s attractive

More information

NET 311 INFORMATION SECURITY

NET 311 INFORMATION SECURITY NET 311 INFORMATION SECURITY Networks and Communication Department Lec12: Software Security / Vulnerabilities lecture contents: o Vulnerabilities in programs Buffer Overflow Cross-site Scripting (XSS)

More information

Web Penetration Testing

Web Penetration Testing Web Penetration Testing What is a Website How to hack a Website? Computer with OS and some servers. Apache, MySQL...etc Contains web application. PHP, Python...etc Web application is executed here and

More information

Understanding Advanced Blind SQLI attack

Understanding Advanced Blind SQLI attack Understanding Advanced Blind SQLI attack Amit Dabas, Ashish Kumar Sharma Cyber Forensics & Information Security, MDU,amitdab@gmail.com,+918588831807 Abstract SQL Injection is not new attack to our web

More information

String Analysis for the Detection of Web Application Flaws

String Analysis for the Detection of Web Application Flaws String Analysis for the Detection of Web Application Flaws Luca Carettoni l.carettoni@securenetwork.it Claudio Merloni c.merloni@securenetwork.it CONFidence 2007 - May 12-13, Kraków, Poland 04/05/07 1

More information

CSE 127 Computer Security

CSE 127 Computer Security CSE 127 Computer Security Fall 2015 Web Security I: SQL injection Stefan Savage The Web creates new problems Web sites are programs Partially implemented in browser» Javascript, Java, Flash Partially implemented

More information

CSCE 548 Building Secure Software SQL Injection Attack

CSCE 548 Building Secure Software SQL Injection Attack CSCE 548 Building Secure Software SQL Injection Attack Professor Lisa Luo Spring 2018 Previous class DirtyCOW is a special type of race condition problem It is related to memory mapping We learned how

More information

Holistic Database Security

Holistic Database Security Holistic Database Security 1 Important Terms Exploit: Take advantage of a flaw or feature Attack Surface: Any node on the network that can be attacked. That can be the UI, People, anything that touches

More information

Excerpts of Web Application Security focusing on Data Validation. adapted for F.I.S.T. 2004, Frankfurt

Excerpts of Web Application Security focusing on Data Validation. adapted for F.I.S.T. 2004, Frankfurt Excerpts of Web Application Security focusing on Data Validation adapted for F.I.S.T. 2004, Frankfurt by fs Purpose of this course: 1. Relate to WA s and get a basic understanding of them 2. Understand

More information

SQL Injection Attacks and Defense

SQL Injection Attacks and Defense SQL Injection Attacks and Defense Justin Clarke Lead Author and Technical Editor Rodrigo Marcos Alvarez Dave Hartley Joseph Hemler Alexander Kornbrust Haroon Meer Gary O'Leary-Steele Alberto Revelli Marco

More information

Embedded SQL. csc343, Introduction to Databases Diane Horton with examples from Ullman and Widom Fall 2014

Embedded SQL. csc343, Introduction to Databases Diane Horton with examples from Ullman and Widom Fall 2014 Embedded SQL csc343, Introduction to Databases Diane Horton with examples from Ullman and Widom Fall 2014 Problems with using interactive SQL Standard SQL is not Turing-complete. E.g., Two profs are colleagues

More information

SQL INJECTION IN WEB APPLICATIONS By Roshmi Choudhury,Officer (IT) Numaligarh Refinery Limited

SQL INJECTION IN WEB APPLICATIONS By Roshmi Choudhury,Officer (IT) Numaligarh Refinery Limited SQL INJECTION IN WEB APPLICATIONS By Roshmi Choudhury,Officer (IT) Numaligarh Refinery Limited Abstract It may be too late to shut the stable door after the horse has been stolen. Most companies in the

More information

Bank Infrastructure - Video - 1

Bank Infrastructure - Video - 1 Bank Infrastructure - 1 05/09/2017 Threats Threat Source Risk Status Date Created Account Footprinting Web Browser Targeted Malware Web Browser Man in the browser Web Browser Identity Spoofing - Impersonation

More information

Static analysis of PHP applications

Static analysis of PHP applications Static analysis of PHP applications Ondřej Šerý DISTRIBUTED SYSTEMS RESEARCH GROUP http://dsrg.mff.cuni.cz CHARLES UNIVERSITY PRAGUE Faculty of Mathematics and Physics References G. Wassermann, Z. Su:

More information

ANALYSIS OF VARIOUS LEVELS OF PENETRATION BY SQL INJECTION TECHNIQUE THROUGH DVWA

ANALYSIS OF VARIOUS LEVELS OF PENETRATION BY SQL INJECTION TECHNIQUE THROUGH DVWA ANALYSIS OF VARIOUS LEVELS OF PENETRATION BY SQL INJECTION TECHNIQUE THROUGH DVWA By Ashish Kumar, Dr. Swapnesh Taterh 1st AIIT, Amity University, Rajasthan. 2nd Asst Prof, AIIT, Amity University, Rajasthan.

More information

SQL Injection SPRING 2018: GANG WANG

SQL Injection SPRING 2018: GANG WANG SQL Injection SPRING 2018: GANG WANG SQL Injection Another reason to validate user input data Slides credit to Neil Daswani and Adam Doupé 2 3 http://xkcd.com/327/ Produce More Secure Code Operating system

More information

Finding Vulnerabilities in Source Code

Finding Vulnerabilities in Source Code Finding Vulnerabilities in Source Code Jason Miller CSCE 813 Fall 2012 Outline Approaches to code review Signatures of common vulnerabilities Language-independent considerations Tools for code browsing

More information

Practical Techniques for Regeneration and Immunization of COTS Applications

Practical Techniques for Regeneration and Immunization of COTS Applications Practical Techniques for Regeneration and Immunization of COTS Applications Lixin Li Mark R.Cornwell E.Hultman James E. Just R. Sekar Stony Brook University Global InfoTek, Inc (Research supported by DARPA,

More information

Prepared Statement. Always be prepared

Prepared Statement. Always be prepared Prepared Statement Always be prepared The problem with ordinary Statement The ordinary Statement was open to SQL injections if fed malicious data. What would the proper response to that be? Filter all

More information

Security issues. Unit 27 Web Server Scripting Extended Diploma in ICT 2016 Lecture: Phil Smith

Security issues. Unit 27 Web Server Scripting Extended Diploma in ICT 2016 Lecture: Phil Smith Security issues Unit 27 Web Server Scripting Extended Diploma in ICT 2016 Lecture: Phil Smith Criteria D3 D3 Recommend ways to improve web security when using web server scripting Clean browser input Don

More information

Embedded SQL. csc343, Introduction to Databases Renée J. Miller and Fatemeh Nargesian and Sina Meraji Winter 2018

Embedded SQL. csc343, Introduction to Databases Renée J. Miller and Fatemeh Nargesian and Sina Meraji Winter 2018 Embedded SQL csc343, Introduction to Databases Renée J. Miller and Fatemeh Nargesian and Sina Meraji Winter 2018 Problems with using interactive SQL Standard SQL is not Turing-complete. E.g., Two profs

More information

CRAXweb: Web Testing and Attacks through QEMU in S2E. Shih-Kun Huang National Chiao Tung University Hsinchu, Taiwan

CRAXweb: Web Testing and Attacks through QEMU in S2E. Shih-Kun Huang National Chiao Tung University Hsinchu, Taiwan CRAXweb: Web Testing and Attacks through QEMU in S2E Shih-Kun Huang National Chiao Tung University Hsinchu, Taiwan skhuang@cs.nctu.edu.tw Motivation Symbolic Execution is effective to crash applications

More information

Secure Programming Learning objectives. and Best Practices. Windows shells Launches programs, including other shells Provides

Secure Programming Learning objectives. and Best Practices. Windows shells Launches programs, including other shells Provides 2 Learning objectives 1 Secure Programming Shell and Environment Flaws Ahmet Burak Can Hacettepe University Understand how shells interpret commands, launch and provide environments for processes Understand

More information

Secure Programming. Shell and Environment Flaws. Ahmet Burak Can Hacettepe University

Secure Programming. Shell and Environment Flaws. Ahmet Burak Can Hacettepe University Secure Programming Shell and Environment Flaws 1 Ahmet Burak Can Hacettepe University 2 Learning objectives Understand how shells interpret commands, launch and provide environments for processes Understand

More information

Copyright

Copyright 1 Security Test EXTRA Workshop : ANSWER THESE QUESTIONS 1. What do you consider to be the biggest security issues with mobile phones? 2. How seriously are consumers and companies taking these threats?

More information

C1: Define Security Requirements

C1: Define Security Requirements OWASP Top 10 Proactive Controls IEEE Top 10 Software Security Design Flaws OWASP Top 10 Vulnerabilities Mitigated OWASP Mobile Top 10 Vulnerabilities Mitigated C1: Define Security Requirements A security

More information

Web Application Vulnerabilities: OWASP Top 10 Revisited

Web Application Vulnerabilities: OWASP Top 10 Revisited Pattern Recognition and Applications Lab Web Application Vulnerabilities: OWASP Top 10 Revisited Igino Corona igino.corona AT diee.unica.it Computer Security April 5th, 2018 Department of Electrical and

More information

Web Security. Attacks on Servers 11/6/2017 1

Web Security. Attacks on Servers 11/6/2017 1 Web Security Attacks on Servers 11/6/2017 1 Server side Scripting Javascript code is executed on the client side on a user s web browser Server side code is executed on the server side. The server side

More information

MWR InfoSecurity Security Advisory. Oracle Enterprise Manager SQL Injection Advisory. 1 st February 2010

MWR InfoSecurity Security Advisory. Oracle Enterprise Manager SQL Injection Advisory. 1 st February 2010 MWR InfoSecurity Security Advisory Oracle Enterprise Manager SQL Injection Advisory 1 st February 2010 2010-11-12 Page 1 of 8 CONTENTS CONTENTS 1 Detailed Vulnerability Description... 4 1.1 Introduction...

More information

Slides adopted from Laurie Williams. OWASP Top Ten. John Slankas

Slides adopted from Laurie Williams. OWASP Top Ten. John Slankas Slides adopted from Laurie Williams OWASP Top Ten John Slankas jbslanka@ncsu.edu Agenda Overview of the Top 10 A1 Injection A2 Broken Authentication and Session Management A3 Cross-Site Scripting A4 Broken

More information

Injection. CSC 482/582: Computer Security Slide #1

Injection. CSC 482/582: Computer Security Slide #1 Injection Slide #1 Topics 1. Injection Attacks 2. SQL Injection 3. Mitigating SQL Injection 4. XML Injection Slide #2 Injection Injection attacks trick an application into including unintended commands

More information

Vulnerabilities in web applications

Vulnerabilities in web applications Vulnerabilities in web applications Web = Client + Server Client (browser) request HTTP response Server HTTP request contains the URL of the resource and the header HTTP response contains a status code,

More information

Application Security through a Hacker s Eyes James Walden Northern Kentucky University

Application Security through a Hacker s Eyes James Walden Northern Kentucky University Application Security through a Hacker s Eyes James Walden Northern Kentucky University waldenj@nku.edu Why Do Hackers Target Web Apps? Attack Surface A system s attack surface consists of all of the ways

More information

CyberP3i Hands-on Lab Series

CyberP3i Hands-on Lab Series CyberP3i Hands-on Lab Series Lab Series using NETLAB Designer: Dr. Lixin Wang, Associate Professor Hands-On Lab for Application Attacks The NDG Security+ Pod Topology Is Used 1. Introduction In this lab,

More information

Engineering Your Software For Attack

Engineering Your Software For Attack Engineering Your Software For Attack Robert A. Martin Senior Principal Engineer Cyber Security Center Center for National Security The MITRE Corporation 2013 The MITRE Corporation. All rights reserved.

More information

Securing Software Applications Using Dynamic Dataflow Analysis. OWASP June 16, The OWASP Foundation

Securing Software Applications Using Dynamic Dataflow Analysis. OWASP June 16, The OWASP Foundation Securing Software Applications Using Dynamic Dataflow Analysis Steve Cook OWASP June 16, 2010 0 Southwest Research Institute scook@swri.org (210) 522-6322 Copyright The OWASP Foundation Permission is granted

More information

Some Facts Web 2.0/Ajax Security

Some Facts Web 2.0/Ajax Security /publications/notes_and_slides Some Facts Web 2.0/Ajax Security Allen I. Holub Holub Associates allen@holub.com Hackers attack bugs. The more complex the system, the more bugs it will have. The entire

More information

Web Security: Vulnerabilities & Attacks

Web Security: Vulnerabilities & Attacks Computer Security Course. Song Dawn Web Security: Vulnerabilities & Attacks Slide credit: John Mitchell Dawn Song Security User Interface Dawn Song Safe to type your password? SAFEBANK Bank of the Safe

More information

Secure Programming. Input Validation. Learning objectives Code Injection: Outline. 4 Code Injection

Secure Programming. Input Validation. Learning objectives Code Injection: Outline. 4 Code Injection Secure Programming Input Validation 2 Learning objectives Understand the definition of code injection Know how code injection happens Learn how to perform input validation and cleansing 1 Ahmet Burak Can

More information

Web Application Security Evaluation

Web Application Security Evaluation Web Application Security Evaluation Jack Wilson Abertay University White Paper BSc Ethical Hacking 2016/2017 TABLE OF CONTENTS 1. Introduction..3 2. Vulnerabilities Discovered and Countermeasures...4 2.1

More information

Web Application Security GVSAGE Theater

Web Application Security GVSAGE Theater Web Application Security GVSAGE Theater B2B Tech Expo Oct 29, 2003 Durkee Consulting www.rd1.net 1 Ralph Durkee SANS Certified Mentor/Instructor SANS GSEC, GCIH, GGSC Network Security and Software Development

More information

Lateral SQL Injection Revisited

Lateral SQL Injection Revisited Lateral SQL Injection Revisited Exploiting NUMBERs Document Profile Version 1.0 Published 1/31/2012 Revision History Version Date Description 1.0 01/31/2012 Document published. Authors David Litchfield

More information

Web Application Whitepaper

Web Application Whitepaper Page 1 of 16 Web Application Whitepaper Prepared by Simone Quatrini and Isa Shorehdeli Security Advisory EMEAR 6 th September, 2017 1.0 General Release Page 2 of 16 1. Introduction In this digital age,

More information

Application vulnerabilities and defences

Application vulnerabilities and defences Application vulnerabilities and defences In this lecture We examine the following : SQL injection XSS CSRF SQL injection SQL injection is a basic attack used to either gain unauthorized access to a database

More information

Integrity attacks (from data to code): Malicious File upload, code execution, SQL Injection

Integrity attacks (from data to code): Malicious File upload, code execution, SQL Injection Pattern Recognition and Applications Lab Integrity attacks (from data to code): Malicious File upload, code execution, SQL Injection Igino Corona igino.corona _at_ diee.unica.it Computer Security May 2nd,

More information

Detecting SQLIA using execution plans

Detecting SQLIA using execution plans Graduate Theses and Dissertations Graduate College 2016 Detecting SQLIA using execution plans Sriram Nagarajan Iowa State University Follow this and additional works at: http://lib.dr.iastate.edu/etd Part

More information

CSE361 Web Security. Attacks against the server-side of web applications. Nick Nikiforakis

CSE361 Web Security. Attacks against the server-side of web applications. Nick Nikiforakis CSE361 Web Security Attacks against the server-side of web applications Nick Nikiforakis nick@cs.stonybrook.edu Threat model In these scenarios: The server is benign The client is malicious The client

More information

INF 102 CONCEPTS OF PROG. LANGS ADVERSITY. Instructors: James Jones Copyright Instructors.

INF 102 CONCEPTS OF PROG. LANGS ADVERSITY. Instructors: James Jones Copyright Instructors. INF 102 CONCEPTS OF PROG. LANGS ADVERSITY Instructors: James Jones Copyright Instructors. Approaches to failure Let it fail Good in development: understand failure mode Defend against the possible and

More information

Web Security: Vulnerabilities & Attacks

Web Security: Vulnerabilities & Attacks Computer Security Course. Song Dawn Web Security: Vulnerabilities & Attacks Cross-site Scripting What is Cross-site Scripting (XSS)? Vulnerability in web application that enables attackers to inject client-side

More information

Perslink Security. Perslink Security. Eleonora Petridou Pascal Cuylaerts. System And Network Engineering University of Amsterdam.

Perslink Security. Perslink Security. Eleonora Petridou Pascal Cuylaerts. System And Network Engineering University of Amsterdam. Eleonora Petridou Pascal Cuylaerts System And Network Engineering University of Amsterdam June 30, 2011 Outline Research question About Perslink Approach Manual inspection Automated tests Vulnerabilities

More information

Hacking Oracle APEX. Welcome. About

Hacking Oracle APEX. Welcome. About Hacking Oracle APEX!2 About Me Welcome scott@sumnertech.com @sspendol!3!4 About Sumner Technologies Originally Established 2005 Relaunched in 2015 Focused exclusively on Oracle APEX solutions Provide wide

More information

Module 14: SQL Injection

Module 14: SQL Injection Module 14: SQL Injection Objective The objective of this lab is to provide expert knowledge on SQL Injection attacks and other responsibilities that include: Understanding when and how web application

More information

Web Security. Jace Baker, Nick Ramos, Hugo Espiritu, Andrew Le

Web Security. Jace Baker, Nick Ramos, Hugo Espiritu, Andrew Le Web Security Jace Baker, Nick Ramos, Hugo Espiritu, Andrew Le Topics Web Architecture Parameter Tampering Local File Inclusion SQL Injection XSS Web Architecture Web Request Structure Web Request Structure

More information

ANZTB SIGIST May 2011 Perth OWASP How minor vulnerabilities can do very bad things. OWASP Wednesday 25 th May The OWASP Foundation

ANZTB SIGIST May 2011 Perth OWASP How minor vulnerabilities can do very bad things. OWASP Wednesday 25 th May The OWASP Foundation ANZTB SIGIST May 2011 Perth OWASP How minor vulnerabilities can do very bad things Christian Frichot / David Taylor (Some of) Perth OWASP s Chapter Leads OWASP Wednesday 25 th May 2011 Copyright The OWASP

More information

Tautology based Advanced SQL Injection Technique A Peril to Web Application

Tautology based Advanced SQL Injection Technique A Peril to Web Application IJIRST National Conference on Latest Trends in Networking and Cyber Security March 2017 Tautology based Advanced SQL Injection Technique A Peril to Web Application Kritarth Jhala 1 Shukla Umang D 2 2 Department

More information

CS 356 Software Security. Fall 2013

CS 356 Software Security. Fall 2013 CS 356 Software Security Fall 2013 Review Chapter 1: Basic Concepts and Terminology Chapter 2: Basic Cryptographic Tools Chapter 3 User Authentication Chapter 4 Access Control Lists Chapter 5 Database

More information

PHP-security Software lifecycle General Security Webserver security PHP security. Security Summary. Server-Side Web Languages

PHP-security Software lifecycle General Security Webserver security PHP security. Security Summary. Server-Side Web Languages Security Summary Server-Side Web Languages Uta Priss School of Computing Napier University, Edinburgh, UK Copyright Napier University Security Summary Slide 1/15 Outline PHP-security Software lifecycle

More information

Maximizing the speed of time based SQL injection data retrieval

Maximizing the speed of time based SQL injection data retrieval Maximizing the speed of time based SQL injection data retrieval 30c3, Hamburg, 29.12.2013 Arnim' ; DROP TABLE students;-- ) Introduction SQL injection SQLi is #1 of OWASP Top 10 Web vulnerabilities Sample

More information

Web Security, Part 1 (as usual, thanks to Dave Wagner and Vern Paxson)

Web Security, Part 1 (as usual, thanks to Dave Wagner and Vern Paxson) Web Security, Part 1 (as usual, thanks to Dave Wagner and Vern Paxson) Web Server Threats What can happen? Compromise Defacement Gateway to attacking clients Disclosure (not mutually exclusive) And what

More information

Karthik Bharathy Program Manager, SQL Server Microsoft

Karthik Bharathy Program Manager, SQL Server Microsoft Karthik Bharathy Program Manager, SQL Server Microsoft Key Session takeaways Understand the many views of SQL Server Look at hardening SQL Server At the network level At the access level At the data level

More information

Mayl, 10th /2013

Mayl, 10th /2013 Mayl, 10th 2013 1 07/2013 Mayl, 10th 2013 SQL INJECTION - detailed overview NOTE: this article was made for education purposes only. Many web developers are not aware that SQL query search can be easily

More information

Web Security: Web Application Security [continued]

Web Security: Web Application Security [continued] CSE 484 / CSE M 584: Computer Security and Privacy Web Security: Web Application Security [continued] Spring 2017 Franziska (Franzi) Roesner franzi@cs.washington.edu Thanks to Dan Boneh, Dieter Gollmann,

More information

3. Apache Server Vulnerability Identification and Analysis

3. Apache Server Vulnerability Identification and Analysis 1. Target Identification The pentester uses netdiscover to identify the target: root@kali:~# netdiscover -r 192.168.0.0/24 Target: 192.168.0.48 (Cadmus Computer Systems) Note: the victim IP address changes

More information

CSE 565 Computer Security Fall 2018

CSE 565 Computer Security Fall 2018 CSE 565 Computer Security Fall 2018 Lecture 16: Building Secure Software Department of Computer Science and Engineering University at Buffalo 1 Review A large number of software vulnerabilities various

More information

Attacks Against Websites. Tom Chothia Computer Security, Lecture 11

Attacks Against Websites. Tom Chothia Computer Security, Lecture 11 Attacks Against Websites Tom Chothia Computer Security, Lecture 11 A typical web set up TLS Server HTTP GET cookie Client HTML HTTP file HTML PHP process Display PHP SQL Typical Web Setup HTTP website:

More information

Simple Overflow. #include <stdio.h> int main(void){ unsigned int num = 0xffffffff;

Simple Overflow. #include <stdio.h> int main(void){ unsigned int num = 0xffffffff; Simple Overflow 1 #include int main(void){ unsigned int num = 0xffffffff; printf("num is %d bits long\n", sizeof(num) * 8); printf("num = 0x%x\n", num); printf("num + 1 = 0x%x\n", num + 1); }

More information

Web Application Security. Philippe Bogaerts

Web Application Security. Philippe Bogaerts Web Application Security Philippe Bogaerts OWASP TOP 10 3 Aim of the OWASP Top 10 educate developers, designers, architects and organizations about the consequences of the most common web application security

More information