Skip to content

Commit 5cec41c

Browse files
committed
Fix code formatting
1 parent 5c69587 commit 5cec41c

File tree

6 files changed

+40
-31
lines changed

6 files changed

+40
-31
lines changed

app/views/layout.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
<span class="icon-bar"></span>
3535
</button>
3636
<a class="navbar-brand" href="/dashboard">
37-
<span style="font-size: x-large"><span class="fa fa-bullseye"></span> Retire<b>Easy</b>
37+
<span style="font-size: x-large">
38+
<span class="fa fa-bullseye"></span>Retire<b>Easy</b>
3839
</span>
3940
<span style="font-size: medium">Employee Retirement Savings Management</span>
4041
</a>

app/views/login.html

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,12 @@
3939
<ul class="nav navbar-nav navbar-right navbar-user">
4040

4141
<li class="dropdown user-dropdown">
42-
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="fa fa-info-circle"></i></a>
42+
<a href="#" class="dropdown-toggle" data-toggle="dropdown" style="font-size: larger"><i class="fa fa-info-circle"></i></a>
4343
<ul class="dropdown-menu alert-dropdown" style="min-width: 350px; padding: 10px">
4444
<li>
4545
<p>
46-
The OWASP Node Goat is an educational Node.js web application vulnerable to the <a target="_blank" href="https://www.owasp.org/index.php/Top_10_2013-Top_10"> OWASP Top 10</a> risks. </p>
47-
<p>It is intended to show how each of these vulnerabilities can manifest
48-
in a Node.js specific way, and provides the subsequent mitigation for each with source code examples.
46+
The OWASP Node Goat is an educational Node.js web application vulnerable to the <a target="_blank" href="https://www.owasp.org/index.php/Top_10_2013-Top_10"> OWASP Top 10</a> risks.</p>
47+
<p>It is intended to show how each of these vulnerabilities can manifest in a Node.js specific way, and provides the subsequent mitigation for each with source code examples.
4948
</p>
5049
<p>To start hacking the application, login using the form below, or access the tutorial guide to know more.</p>
5150

@@ -65,7 +64,7 @@
6564
<div class="row">
6665
<div class="col-lg-12">
6766
<div style="text-align: center; padding: 30px">
68-
<img src="/images/owasplogo.png" height="80px">
67+
<img src="/images/owasplogo.png" height="80px">
6968
</div>
7069
</div>
7170
</div>
@@ -77,20 +76,22 @@
7776
<div class="col-lg-4">
7877
<div class="panel panel-info">
7978
<div class="panel-heading" style="text-align: center">
80-
<a href="/tutorial" target="_blank"> <b><span class="fa fa-book"></span> Tutorial Guide:</b> Learn OWASP Top 10
81-
</a>
79+
<a href="/tutorial" target="_blank"> <b><span class="fa fa-book"></span> Tutorial Guide:</b> Learn OWASP Top 10
80+
</a>
8281
</div>
8382

8483
</div>
8584

86-
<div class="panel panel-default">
87-
<div class="panel-heading" style="text-align: center">
88-
<span style="font-size: x-large"><span class="fa fa-bullseye"> </span> Retire<b>Easy</b>
85+
<div class="panel panel-default">
86+
<div class="panel-heading" style="text-align: center">
87+
<span style="font-size: x-large">
88+
<span class="fa fa-bullseye"></span>Retire<b>Easy</b>
8989
</span>
9090
<br/>
9191
<span style="font-size: medium">Employee Retirement Savings Management</span>
92-
<br/><br/>
93-
</div>
92+
<br/>
93+
<br/>
94+
</div>
9495
<div class="panel-body">
9596

9697

app/views/tutorial/a1.html

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ <h3 class="panel-title">Further Reading</h3>
193193
<h4 class="panel-title">
194194
<a data-toggle="collapse" data-parent="#accordion" href="#collapseTwo">
195195
<i class="fa fa-chevron-down"></i> A1 - 2 SQL and NoSQL Injection
196-
</a>
196+
</a>
197197
</h4>
198198
</div>
199199
<div id="collapseTwo" class="panel-collapse">
@@ -206,8 +206,7 @@ <h3 class="panel-title">Description</h3>
206206
</div>
207207
<div class="panel-body">
208208
<p>
209-
SQL and NoSQL injections enable an attacker to inject code into the query that would be executed by the database.
210-
These flaws are introduced when software developers create dynamic database queries that include user supplied input.
209+
SQL and NoSQL injections enable an attacker to inject code into the query that would be executed by the database. These flaws are introduced when software developers create dynamic database queries that include user supplied input.
211210
</p>
212211
</div>
213212
</div>
@@ -220,23 +219,26 @@ <h3 class="panel-title">Attack Mechanics</h3>
220219
<p>Both SQL and NoSQL databases are vulnerable to injection attack. Here is an example of equivalent attack in both cases, where attacker manages to retrieve admin user's record without knowing password:</p>
221220
<h5>1. SQL Injection</h5>
222221
<p>Lets consider an example SQL statement used to authenticate the user with username and password</p>
223-
<pre>SELECT * FROM accounts WHERE username = '$username' AND password = '$password'</pre>
224-
<p>If this statement is not prepared or properly handled when constructed, an attacker may be able to supply <code>admin' --</code> in the username field to access the admin user's account bypassing the condition that checks for the password.
225-
The resultant SQL query would looks like:</p>
226-
<pre>SELECT * FROM accounts WHERE username = 'admin' -- AND password = ''</pre>
222+
<pre>SELECT * FROM accounts WHERE username = '$username' AND password = '$password'</pre>
223+
<p>If this statement is not prepared or properly handled when constructed, an attacker may be able to supply
224+
<code>admin' --</code>in the username field to access the admin user's account bypassing the condition that checks for the password. The resultant SQL query would looks like:</p>
225+
<pre>SELECT * FROM accounts WHERE username = 'admin' -- AND password = ''</pre>
227226
<br/>
228227
<h5>2. NoSQL Injection</h5>
229-
<p>The equivalent of above query for NoSQL MongoDB database is: </p>
228+
<p>The equivalent of above query for NoSQL MongoDB database is:</p>
230229
<pre>db.accounts.find({username: username, password: password});</pre>
231-
<p>While here we are no longer dealing with query language, an attacker can still achieve the same results as SQL injection by supplying JSON input object as below: </p>
230+
<p>While here we are no longer dealing with query language, an attacker can still achieve the same results as SQL injection by supplying JSON input object as below:</p>
232231
<pre>
233232
{
234233
"username": "admin",
235234
"password": {$gt: ""}
236235
}
237236
</pre>
238-
<p>In MongoDB, <code>$gt</code> selects those documents where the value of the field is greater than (i.e. >) the specified value. Thus above statement compares password in database with empty string for greatness, which returns <code>true</code>.</p>
239-
<p> The same results can be achieved using other comparison operator such as <code>$ne</code>.</p>
237+
<p>In MongoDB,
238+
<code>$gt</code>selects those documents where the value of the field is greater than (i.e. >) the specified value. Thus above statement compares password in database with empty string for greatness, which returns
239+
<code>true</code>.</p>
240+
<p>The same results can be achieved using other comparison operator such as
241+
<code>$ne</code>.</p>
240242
</div>
241243
</div>
242244

@@ -250,7 +252,8 @@ <h3 class="panel-title">How Do I Prevent It?</h3>
250252
<ul>
251253
<li>Prepared Statements: For SQL calls, use prepared statements instead of building dynamic queries using string concatenation. Stored procedures have the same effect as the use of prepared statements when implemented safely</li>
252254
<li>Input Validation: Validate inputs to detect malicious values. For NoSQL databases, also validate input types against expected types</li>
253-
<li>Least Privilege: To minimize the potential damage of a successful injection attack, do not assign DBA or admin type access rights to your application accounts. Similarly minimize the privileges of the operating system account that the database process runs under.</li>
255+
<li>Least Privilege: To minimize the potential damage of a successful injection attack, do not assign DBA or admin type access rights to your application accounts. Similarly minimize the privileges of the operating system account
256+
that the database process runs under.</li>
254257
</ul>
255258
</div>
256259
</div>

app/views/tutorial/a10.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ <h3 class="panel-title">Attack Mechanics</h3>
2828

2929
<p>For example, the "Learning Resources" link (
3030
<code>/learn?url=...</code>) in the application redirects to another website without validating the url.
31-
</p>
31+
</p>
3232
<iframe width="560" height="315" src="//www.youtube.com/embed/z98AQF8J_zg?rel=0" frameborder="0" allowfullscreen></iframe>
3333
<p>Here is code from
3434
<code>routes/index.js</code>,

app/views/tutorial/a5.html

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ <h3 class="panel-title">How Do I Prevent It?</h3>
4747
Here are some node.js and express specific configuration measures:
4848
<ul>
4949
<li>
50-
Use latest stable version of node.js and express (or other web framework you are using). Keep a watch on published vulnerabilities of these. The vulnerabilities for node.js and express.js can be found <a href="http://blog.nodejs.org/vulnerability/">here</a> and <a href="http://expressjs.com/advanced/security-updates.html">here</a>, respectively.
50+
Use latest stable version of node.js and express (or other web framework you are using). Keep a watch on published vulnerabilities of these. The vulnerabilities for node.js and express.js can be found <a href="http://blog.nodejs.org/vulnerability/">here</a> and
51+
<a href="http://expressjs.com/advanced/security-updates.html">here</a>, respectively.
5152
</li>
5253
<li>
5354
Do not run application with root privileges. It may seem necessary to run as root user to access privileged ports such as 80. However, this can achieved either by starting server as root and then downgrading the non-privileged user after listening on
@@ -82,7 +83,9 @@ <h3 class="panel-title">How Do I Prevent It?</h3>
8283
<h3 class="panel-title">Source Code Example</h3>
8384
</div>
8485
<div class="panel-body">
85-
<div><iframe width="560" height="315" src="//www.youtube.com/embed/lCpnVrD2Neg?rel=0" frameborder="0" allowfullscreen></iframe></div>
86+
<div>
87+
<iframe width="560" height="315" src="//www.youtube.com/embed/lCpnVrD2Neg?rel=0" frameborder="0" allowfullscreen></iframe>
88+
</div>
8689
<p>The default HTTP header x-powered-by can reveal implementation details to an attacker. It can be taken out by including this code in
8790
<code>server.js</code>
8891
<pre>

app/views/tutorial/a8.html

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ <h3 class="panel-title">Attack Mechanics</h3>
3939
<div class="panel-body">
4040
<p>
4141
As browsers automatically send credentials like session cookies with HTTP requests to the server where cookies were received from, attackers can create malicious web pages which generate forged requests that are indistinguishable from legitimate ones.</p>
42-
<p>For example, CSRF vulnerability can be exploited on profile form on the insecure demo application. </p>
42+
<p>For example, CSRF vulnerability can be exploited on profile form on the insecure demo application.</p>
4343
<iframe width="560" height="315" src="//www.youtube.com/embed/vRDykS_2y3I?rel=0" frameborder="0" allowfullscreen></iframe>
44-
<p> To exploit it:
44+
<p>To exploit it:
4545
<ol>
4646
<li>An attacker would need to host a forged form like below on a malicious sever.
4747
<pre>
@@ -75,7 +75,8 @@ <h3 class="panel-title">How Do I Prevent It?</h3>
7575
<div class="panel-body">
7676
<p>Express csrf middleware provide a very effective way to deal with csrf attack. By default this middleware generates a token named "_csrf" which should be added to requests which mutate state (PUT, POST, DELETE), within a hidden form field,
7777
or query-string, or header fields.</p>
78-
<p> If using method-override middleware, it is very important that it is used before any middleware that needs to know the method of the request, including CSRF middleware. Otherwise an attacker can use non-state mutating methods (such as GET) to bypass the CSRF middleware checks, and use method override header to convert request to desired method.</p>
78+
<p>If using method-override middleware, it is very important that it is used before any middleware that needs to know the method of the request, including CSRF middleware. Otherwise an attacker can use non-state mutating methods (such as
79+
GET) to bypass the CSRF middleware checks, and use method override header to convert request to desired method.</p>
7980
<p>When form is submitted, the middleware checks for existence of token and validates it by matching to the generated token for the response-request pair. If fails to match, it rejects the request. Thus making it really hard for an attacker
8081
to exploit CSRF.
8182
</p>

0 commit comments

Comments
 (0)