Duck Billed Platypus Origami
[STANDARD] OWASP - Episode 7
seventh episode of our saga to the knowledge of the methodology OWASP. We do not yet cover all topics, or even the classics. Indeed, if there is one recipe that works almost every time in terms of PenTest WEB apps, what are the injections of all kinds !
- 1 - Foreword
-
-
The episode 7 deals with the control data inputted by a user (
Data Validation Testing - DV
). In the case of an attacker, he will try to inject special characters and malicious code if the data control is not effective. The goal is not to explain how each type of injection (or so I tried the blog page the longest of the canvas) but to review the main options available to an attacker proposed by the standard.
2 -
active testing phase 6 - testing on injections
2.1 - DV-001: non-persistent XSS
There are two types of XSS attack (or Cross Site Scripting) XSS
nonpersistent that are not maintained in the application, launched into "one-shot" (see paragraph present); persistent XSS that are maintained and can be replayed by victims without their knowledge by consulting a page affected by such forward without intervening again (see next paragraph);
There are actually a third category More specifically, CSRF attacks (seen in episode 4).
Find non-persistent XSS, we address the following approach:
What are the possible entries? Where we have a chance to succeed in such an attack. The answer has usually been elucidated in episode 1;
Analysis Phase: XSS attempt a classic (see example below. Encode application if necessary).
phase attack: inject the desired code (eg retrieval of cookies).
2.2 - DV-002: Persistent XSS
-
- The persistent XSS are even more popular since the attacker may have an impact after the fact. A similar approach is followed to inject these codes:
- Find a way to "save" your XSS (form, profile page, configuration page, etc.).
analyze the HTML of the page to find the field vulnerable;
Test with a classic XSS (another example is provided below). -
-
inject code that will run when the infected page is accessed manually or automatically (Eg by a rope). It is also possible to use the tools of exploitation (a future post?). -
2.3 - DV-003: DOM Based XSS
In gray box, this test is to
find in the code functions potentially injectable (eg document.location, document.URL ...) ;
attempt the attack: ex1: # concatenate the character
tracking malicious code (javascript) in the URL; -
ex2: try the XSS code in place of the parameter values. -
- I invite you to see the document
Amit Klein for more info on this subject.
2.4 - DV-004: Cross Site Flashing
-
Here we test the safety of flash animations:
First, get the *. swf with a simple wget
;
- Then
- use flare to decompile;
Find methods potentially dangerous (eg - loadVariables () , getURL ()
, etc.). -
inject malicious code (eg
javascript: code_malicieux
).
To cite only one, there is an audit tool for this kind of animation:
SWFIntruder
.
2.5 - DV-005: SQL injection Here, tackling a very large pieces. The standard is the magnitude of the subject by treating the databases the most famous (MySQL, Oracle, MS SQL, Access, PostgreSQL). We broach the principle here that very (very very) large. - The successful attack mostly in the field on a form, a search field, a field of e-commerce; Test special characters and strings that can allow us to build SQL queries:
'- AND OR / * - Launch SQL injections by guessing the underlying queries (eg
a gold '1 '= '1 - ) 2.6 - DV-006: LDAP injections
- LDAP bases often contain information as sensitive as those we could have recovered in vulnerable databases (see previous paragraph). Concretely, the attacks will generally be realized as follows: use the character *
instead of legitimate values to view all results;
try characters ( for authentication, there are more complex attacks (example below).
username => *) (uid =* uid =*))( injection attacks are similar to those already mentioned in DV-005;
if test mode box gray / white, to study the code that will certainly reveal new vulnerabilities. 2.8 - DV-008: XML injections -
- XML is now widely used to transport information between the GUI and the database. It is common to have this format in a pentest. A new track for the audit!
Test special characters accepted and might contribute to an injection: - " &
Knowing the structure of the database. Is it possible to read the DTD? If yes, identify the field names of interest ... Use the type Entity with the & character;
Test by inserting a tag injection of malicious tags in the field vulnerable.
As an example, we take a field that adds a user in the database. We'll add two of the following:
second example we add an additional property to our user:
2.9 - DV-009: ISS injections
SSI "Server Side Includes "provides dynamic code in its HTML pages. Which pages are vulnerable? In general, pages with the extension *. shtml but not necessarily. So how to know Again, test the reaction server address special characters:
- Then ... Out! Here's an example below:
-
-
2.10 - DV-010: XPATH injection
XPATH is the language that used to interpret XML files. The attacks will be very similar to an SQL injection:
How to test? Trying character - ' . This causes there an error interesting? < > Test a classic SQL injection (DV-005 for examples rather than classical) Adapting the attack if it becomes aware of the associated XML.
- the same way as SQL, we can attempt an attack blindly.
-
2.11 - DV-011: Injection IMAP / SMTP
Well, it is not necessary to present the IMAP and SMTP, but do you know the possible attacks on these protocols in terms of injection? Injection in the URL: modify a parameter giving a zero value, or containing a random character special. You can also change the name of the parameter or change it altogether. Through these tests, you will know better the behavior of the mail server.
Complete your knowledge generating errors on the parameters and values vulnerable after the first point. The goal is to understand the flow structures and interesting email. Test injections without being connected (eg using the IMAP commands) and then the being if you have an account (eg use the CRLF at the right place in the mail that is not constituted as the body message ...).
2.12 - DV-012: Injection code
< ! # = / . " - > In the URL, it is sometimes possible to run commands by changing the settings with malicious code (encoded). In gray box, we will look for pieces of code or function that allows input of code and, more importantly, accepts injections to code execution on the host server (eg a simple
ls).
2.13 - DV-013: OS Commanding
Interacting with the server host is a big step in our attack phase. The most traditional methods are to chain malicious carry instructions to lawful instructions. In general, this amounts adding:
&
followed by the command (Windows); - ;
followed by the command (Linux) -
- ;
- marker byte is where you can inject an address that redirects to our malicious code;
In the case of an attack
string, use the following strings:
% x,% s
and % n attempt to corrupt the application.
-
2.15 - DV-015: Vulnerability Incubating -
- This time we are trying to corrupt the application to "applicant" malicious code that we can reuse it for our pousuivre attack (for example, a backdoor) or hoping a nice victim drives our trap.
It may be simply upload our code with a nice field (eg field for file upload);
Also, it can be XSS, SQL Injection + XSS ... (Eg in a forum);
Or, taking advantage of a security breach or configuration. For example, one can inject a malicious WAR file (see the post on
Jonas and JBoss
...).
2.16 - DV-016: Splitting and Smuggling attack
- A splitting attack is to arrange to send two HTTP requests including one in particular which should not normally be accepted by the Web server.
Use CRLF with your malicious application. For info, we can encode the CRLF in - % d% a ...
The entire application must be encoded; - To complete the attack, the fields we modifons Last-modified with a date in the future (this field is in the header of the HTTP request).
More than words, an example below:
fr% 0D% 0AContent-Length% 3A% 200% 0D% 0A% 0D% 2F1.1% 0AHTTP% 20200% 20OK% 0D% 0AContent-Type% 3A 2Fhtml% 20text%% 0D% 0AConteny-Length% 3A% 2031% 0D% 0A% 3CHTML%% 3ESuccessfully 20Hacked!% 3E% 3C% 2Fhtml
0 comments:
Post a Comment