Introduction to InfoSec – Recitation 8 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)

Slides:



Advertisements
Similar presentations
WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Advertisements

CSE 461 Section. “Transport Layer Security” protocol Standard protocol for encrypting Internet traffic Previously known as SSL (Secure Sockets Layer),
More on SSL/TLS. Internet security: TLS TLS is one of the more prominent internet security protocols. TLS is one of the more prominent internet security.
Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation.
Introduction to InfoSec – Recitation 6 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)
IS 360 Course Introduction. Slide 2 What you will Learn (1) The role of Web servers and clients How to create HTML, XHTML, and HTML 5 pages suitable for.
Chapter 9 Web Applications. Web Applications are public and available to the entire world. Easy access to the application means also easy access for malicious.
Dynamic Web Pages. Web Programming  All our web pages so far have been static pages. 1. We create a web page 2. We upload it to the web server 3. People.
How the web works: HTTP and CGI explained
1 The World Wide Web. 2  Web Fundamentals  Pages are defined by the Hypertext Markup Language (HTML) and contain text, graphics, audio, video and software.
Hypertext Transport Protocol CS Dick Steflik.
 What is it ? What is it ?  URI,URN,URL URI,URN,URL  HTTP – methods HTTP – methods  HTTP Request Packets HTTP Request Packets  HTTP Request Headers.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Christopher M. Pascucci Basic Structural Concepts of.NET Browser – Server Interaction.
Introduction to InfoSec – Recitation 10 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)
Martin Kruliš by Martin Kruliš (v1.0)1.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
CSCI 323 – Web Development Chapter 1 - Setting the Scene We’re going to move through the first few chapters pretty quick since they are a review for most.
INTRODUCTION TO WEB DATABASE PROGRAMMING
IT 210 The Internet & World Wide Web introduction.
Lecture 3 – Data Storage with XML+AJAX and MySQL+socket.io
Introduction to PHP and Server Side Technology. Slide 2 PHP History Created in 1995 PHP 5.0 is the current version It’s been around since 2004.
CSCI 6962: Server-side Design and Programming Course Introduction and Overview.
Databases with PHP A quick introduction. Y’all know SQL and Databases  You put data in  You get data out  You can do processing on it very easily 
1 HTML and CGI Scripting CSC8304 – Computing Environments for Bioinformatics - Lecture 10.
Introduction to InfoSec – Recitation 09 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (infosec15 at modprobe.net)
Server-side Scripting Powering the webs favourite services.
Introduction to InfoSec – Recitation 7 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)
Lecture 14 – Web Security SFDV3011 – Advanced Web Development 1.
Web Application Access to Databases. Logistics Test 2: May 1 st (24 hours) Extra office hours: Friday 2:30 – 4:00 pm Tuesday May 5 th – you can review.
Chapter 9 Web Applications. Web Applications are public and available to the entire world. Easy access to the application means also easy access for malicious.
JavaScript, Fourth Edition Chapter 12 Updating Web Pages with AJAX.
November 13, 2008 Ohio Information Security Forum Attack Surface of Web Applications James Walden Northern Kentucky University
10/13/2015 ©2006 Scott Miller, University of Victoria 1 Content Serving Static vs. Dynamic Content Web Servers Server Flow Control Rev. 2.0.
Feedback #2 (under assignments) Lecture Code:
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
School of Computing and Information Systems CS 371 Web Application Programming PHP – Forms, Cookies, Sessions and Database.
October 3, 2008IMI Security Symposium Application Security through a Hacker’s Eyes James Walden Northern Kentucky University
Introduction to InfoSec – SQLI and jQuery (R9)
INTRODUCTION TO WEB APPLICATION Chapter 1. In this chapter, you will learn about:  The evolution of the Internet  The beginning of the World Wide Web,
GOAL User Interactive Web Interface Update Pages by Club Officers Two Level of Authentication.
API Crash Course CWU Startup Club. OUTLINE What is an API? Why are API’s useful? What is HTTP? JSON? XML? What is a RESTful API? How do we consume an.
1 WWW. 2 World Wide Web Major application protocol used on the Internet Simple interface Two concepts –Point –Click.
Operating Systems Lesson 12. HTTP vs HTML HTML: hypertext markup language ◦ Definitions of tags that are added to Web documents to control their appearance.
הרצאה 4. עיבוד של דף אינטרנט דינמי מתוך Murach’s PHP and MySQL by Joel Murach and Ray Harris.  דף אינטרנט דינמי משתנה עפ " י הרצת קוד על השרת, יכול להשתנות.
NMD202 Web Scripting Week5. What we will cover today PHP & MySQL Displaying Dynamic Pages Exercises Modifying Data PHP Exercises Assignment 1.
Web Security Lesson Summary ●Overview of Web and security vulnerabilities ●Cross Site Scripting ●Cross Site Request Forgery ●SQL Injection.
Distributed systems: an architectural view. Once upon a time… The Mainframe Dumb Terminal Dumb Terminal Dumb Terminal Dumb Terminal Dumb Terminal Dumb.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
 Web pages originally static  Page is delivered exactly as stored on server  Same information displayed for all users, from all contexts  Dynamic.
IS2803 Developing Multimedia Applications for Business (Part 2) Lecture 2: Introduction to IS2803 Rob Gleasure
INFO 344 Web Tools And Development CK Wang University of Washington Spring 2014.
AJAX and REST. Slide 2 What is AJAX? It’s an acronym for Asynchronous JavaScript and XML Although requests need not be asynchronous It’s not really a.
COSC 2328 – Web Programming.  PHP is a server scripting language  It’s widely-used and free  It’s an alternative to Microsoft’s ASP and Ruby  PHP.
Overview Web Technologies Computing Science Thompson Rivers University.
Session 11: Cookies, Sessions ans Security iNET Academy Open Source Web Development.
CAESked Computer Aided Engineering Scheduler. Introduction Team Members: Chris Fruin & Jerry Grochowski What CAESked is: Web based class scheduling application.
National College of Science & Information Technology.
1 Chapter 1 INTRODUCTION TO WEB. 2 Objectives In this chapter, you will: Become familiar with the architecture of the World Wide Web Learn about communication.
Introduction to Information Security
Introduction to Dynamic Web Programming
World Wide Web policy.
Web Development Web Servers.
COMP2322 Lab 2 HTTP Steven Lee Feb. 8, 2017.
Hypertext Transport Protocol
What is REST API ? A REST (Representational State Transfer) Server simply provides access to resources and the REST client accesses and presents the.
WEB API.
What is Cookie? Cookie is small information stored in text file on user’s hard drive by web server. This information is later used by web browser to retrieve.
Tutorial 6 PHP & MySQL Li Xu
PHP Forms and Databases.
Presentation transcript:

Introduction to InfoSec – Recitation 8 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)

Today Web 101 o HTTP o Cookies o HTML o PHP o SQL Web Vulnerabilities – o SQL Injection If we have time – o HeartBleed

HTTP Hyper Text Transfer Protocol Simple textual protocol over TCP port 80, stateless request- response model Requests – o [METHOD] [URI]\r\n o Headers\r\n\r\n e.g.: “GET /\r\n\r\n” o Headers – Client type – User agent Will the client support compression – Accept Encoding Client language Last valid cache the client has ….

HTTP Response Responses – o [Numeric code] [String]\r\n o Headers\r\n\r\n o Data o Codes – 200 OK 302 Redirect 404 Not found 500 Server Error 502 Gateway Error ….

Misc HTTP Extra things to know about – o HTTP Keep alive o HTTP Authentication o X-forwarded-for (and X-we-are-hiring…) HTTPS is SSL / TLS transporting regular HTTP

Cookies A way for the server to store something in the client’s browser for later use Cookies default to being domain specific Cookies have an expiry date Most authentication schemes use something like – o Client logs in via form o Server authenticates user, sends back an encrypted and hashed cookie, valid for x days o Client browses through the site with no need to re-login for a few days Cookies come in a few flavors – ‘regular’, ‘HTTP only’ and ‘secure’

Cookies – cont. Cookies are a valuable commodity – o If I have your cookie – I AM YOU o Cookie stealing used to be very easy (simple Javascript), but now is pretty impossible (thank the SOP – Same Origin Policy)

HTML Hyper Text Markup Language XML format representation of the DOM (Document Object Model) The DOM is the tree-like structure of the document You may interact with and modify the DOM via Javascript The browser renders the objects within the document and allows the user to interact with them HTML5 is geared towards the dynamic web, and provides many services (local storage, 3d API, Async calls) CSS is used for design, HTML is used for structure

Basic HTML Example My title Big letters! Small letters!

Forms and AJAX The two major ways to send user data as part of a web application are HTML forms and AJAX (Async Javascript And XML) HTML Forms – o o o Will send data as POST parameters to target.php upon clicking the submit button AJAX – o Read about JQuery and AsyncHttpRequest()

PHP Server-side processing language, commonly used in web applications Hybrid perl & C syntax Once the web server support processing PHP files, all that’s needed is – <?php echo “Hello, world!”; ?>

PHP – cont. Headers are sent using header() (all calls to header() must be before sending data) Data is sent via echo / print() calls (or anything that writes to stdout) Input is done via HTTP parameters - $_POST[“var_name”] The body of the request can be had via reading from stdin directly / file_get_contents(php://input) or stream_get_contents(STDIN)

A little more <?php mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error()); mysql_select_db("Database_Name") or die(mysql_error()); ?>

PHP – Tips and Tricks Don’t forget the “ ; ” at the end of each line Use the “or die();” syntax to quickly find when your code breaks Errors are hard to spot. Your machines should have error reporting enabled, but don’t expect much May need to revert to “printf debugging” You can run php on a file in a terminal, but understand you won’t have the environment available (There could be better tools out there)

SQL Structured Query Language Very powerful interface to relational databases Tables have fields (columns) and rows Actions – o Select – query, return valid row(s) o Insert – Add new row(s) o Update – Change existing row(s) o Maintenance – Create table, Drop table, Add column…. o + Many more operations

SQL For each action, you can select which fields to choose by, and which fields to return Examples - o FROM users SELECT * WHERE username = “mitsi” o FROM users SELECT password WHERE username = “mitsi” o UPDATE users SET password=“123456” WHERE username=“mitsi” o INSERT INTO users VALUES (“myuser”, “mypass”)

PHP & SQL PHP has support for sql (MySQL in our case) You’ll need to connect to the DB, and then you may query to your heart’s content See the example within the exercise

SQL Vulenarbilities There are quite a few, but SQL Injection is #1 Example – statement = "SELECT * FROM users WHERE name = '" + userName + "';“ The attacker controls userName, and assuming there is no input sanitation, the attacker can set userName to be ' or '1'='1 Will lead to the query always returning valid data

Adaptations statement = "SELECT * FROM users WHERE name = '" + userName + "';“ Blocking the rest of the query ' or '1'='1' -- ‘ ' or '1'='1' ({ ' ' or '1'='1' /* ‘ Not really limited to the Web – can be done with RFID food tags, dog tags – anywhere someone is querying a DB without proper input sanitation

Further reading & Tools W3Cschools.com, codecademy.com & php.net have everything you need to know Also, Google Firefox Developer tools Fiddler really helps when you want to research an existing site XML verifiers / code beautifiers

Questions?

HeartBleed 101 In SSL/TLS, a “Heart-beat” packet is used to keep the connection alive / know when the connection has dropped Works like ‘ping’ – will echo sent data (built-in length field) OpenSSL is a very common SSL/TLS implementation (~66% of HTTPS servers on the Internet) OpenSSL allowed a peer to send a heart-beat packet while controlling the length field Attacker can send a small packet with a large length value  Attacker gets back a bigger answer, consisting of server memory

Implications Reading (dynamic) server memory Which may contain sensitive information And key material! If exploited, all your security are belong to us! (can decrypt / MITM that site’s traffic)

Mitigation Proper Solution – o Update to a fixed version of OpenSSL o Generate new certificates o Change all passwords, re-check anything that happened in the mean time o Never sleep well again Reality – o Most of the Internet has been patched very quickly (<24hours) o Not all certificates have been / will be replaced o Most sites have not urged users to change passwords o Most users won’t do it anyway…

Questions? More info at hearbleed.com