Академический Документы
Профессиональный Документы
Культура Документы
XSS is where someone (attacker) inject data into system or web application. It is happened
when untrusted source is allowed to inject its own code into web application. XSS normally
allow the attacker to pretend as victim user to carry out same action as the user such as
accessing any of user’s data.
o Sanitizing User input – this method ignores the data that have potential executable
characters, changing the user input into acceptable format and ensuring the data
receive cannot be interpreted as executable code.
o Input validation – Ensuring the input data following the format and preventing
malicious data from harming a website, database and users. It also helps prevent
user entering or adding unwanted character in the forms.
SQL Injection
SQL injection refer to a class of code-injection attacks in which data provided by the
user is included in a SQL query where this attacker will inject SQL query via the input
data from the client to the application. This attacker can submit SQL commands
directly to the database and a successful SQL injection exploit can read sensitive data
from the database and modify them.
This SQL Injection vulnerable happen when there is insufficient validation of user
input where it is not very well established to escape characters and then did pass them
into SQL statement to the server.
Injection Mechanism:
o Injection trough user input
o Injection trough cookies
o Injection trough server variables
o Second-Order Injection
o Escaping Queries:
$this->db->escape ()
$this->db->escape_str ()
$this->db->escape_like_str ()
Cookies
Main purpose of a cookie is to identify users and possibly prepare customized Web
pages or to save site login information.
Cookie is a type of message that is given to a Web Browser by a Web Server
For example, when you enter web site using cookies, you may ask to fill out a form
providing personal information: like name, email address, and interests. This
information is packaged into a cookie and send to web browser, which then stores the
information for later use. Next time you go to the same web site, your browser will
send the cookie to the web server. The message is sent back to the server each timer
the browser requests page from a server.
A web server has no memory so the hosted web site you are visiting transfers a cookie
file of the browser on your computer’s hard disk so that the web site can remember
who you are and your preferences.
This message exchange allows the Web server to use this information to present you
with customized web pages. so, instead of seeing just welcome page, this could also
generate your name on the page.
Types of Cookies:
o Session Cookie (Transient cookie)
Cookie that is erased when you close the Web Browser
Stored in temporary memory and is not retained after the browser is
closed.
Session cookie do not collect information from computer.
Typically store information in form of session identification that does
not personally identify user.
o Persistent cookie (Permanent cookie/Stored cookie)
Stored on hard drive until expires (persistent cookies are set with
expiration dates) or until delete by user
Use to collect identifying information about user
For example, collect web surfing behavior or user preference for
specific web site.