Skip to content

Commit e58daee

Browse files
committed
Added 2017 vulnerabilities to index
1 parent dc13fff commit e58daee

38 files changed

+97
-110
lines changed

config/vulns.js

+11-9
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
module.exports = {
22
'a1_injection': 'A1: Injection',
3-
'a2_broken_auth': 'A2: Broken Authentication and Session Management',
4-
'a3_xss': 'A3: Cross-site Scripting',
5-
'a4_idor': 'A4: Insecure Direct Object Reference',
6-
'a5_sec_misconf': 'A5: Security Misconfiguration',
7-
'a6_sensitive_data': 'A6: Sensitive Data Exposure',
8-
'a7_missing_access_control': 'A7: Missing Function Level Access Control',
9-
'a8_csrf': 'A8: Cross-site Request Forgery',
10-
'a9_vuln_component': 'A9: Using Components with Known Vulnerability',
11-
'a10_redirect': 'A10: Unvalidated Redirects and Forwards'
3+
'a2_broken_auth': 'A2: Broken Authentication',
4+
'a3_sensitive_data': 'A3: Sensitive Data Exposure',
5+
'a4_xxe': 'A4: XML External Entities',
6+
'a5_broken_access_control': 'A5: Broken Access Control',
7+
'a6_sec_misconf': 'A6: Security Misconfiguration',
8+
'a7_xss': 'A7: Cross-site Scripting',
9+
'a8_ides': 'A8: Insecure Deserialization',
10+
'a9_vuln_component': 'A9: Using Components with Known Vulnerabilities',
11+
'a10_logging': 'A10: Insufficient Logging and Monitoring',
12+
'ax_csrf': 'A8:2013 Cross-site Request Forgery',
13+
'ax_redirect': 'A10:2013 Unvalidated Redirects and Forwards'
1214
}

core/appHandler.js

+9-5
Original file line numberDiff line numberDiff line change
@@ -212,9 +212,9 @@ module.exports.listUsersAPI = function (req, res) {
212212
})
213213
}
214214

215-
module.exports.bulkProducts = function(req, res) {
215+
module.exports.bulkProductsLegacy = function (req,res){
216216
// TODO: Deprecate this soon
217-
if (req.query.legacy && req.files.products){
217+
if(req.files.products){
218218
var products = serialize.unserialize(req.files.products.data.toString('utf8'))
219219
console.log(products)
220220
products.forEach( function (product) {
@@ -223,12 +223,16 @@ module.exports.bulkProducts = function(req, res) {
223223
newProduct.code = product.code
224224
newProduct.tags = product.tags
225225
newProduct.description = product.description
226-
227226
newProduct.save()
228227
})
229228
res.redirect('/app/products')
229+
}else{
230+
res.render('app/bulkproducts',{messages:{danger:'Invalid file'},legacy:true})
230231
}
231-
else if (req.files.products && req.files.products.mimetype=='text/xml'){
232+
}
233+
234+
module.exports.bulkProducts = function(req, res) {
235+
if (req.files.products && req.files.products.mimetype=='text/xml'){
232236
var products = libxmljs.parseXmlString(req.files.products.data.toString('utf8'), {noent:true,noblanks:true})
233237
products.root().childNodes().forEach( product => {
234238
var newProduct = new db.Product()
@@ -240,6 +244,6 @@ module.exports.bulkProducts = function(req, res) {
240244
})
241245
res.redirect('/app/products')
242246
}else{
243-
res.render('app/bulkproducts',{messages:{danger:'Invalid file'}})
247+
res.render('app/bulkproducts',{messages:{danger:'Invalid file'},legacy:false})
244248
}
245249
}

routes/app.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ module.exports = function () {
2020
})
2121

2222
router.get('/bulkproducts', authHandler.isAuthenticated, function (req, res) {
23-
res.render('app/bulkproducts')
23+
res.render('app/bulkproducts',{legacy:req.query.legacy})
2424
})
2525

2626
router.get('/products', authHandler.isAuthenticated, appHandler.listProducts)
@@ -61,5 +61,7 @@ module.exports = function () {
6161

6262
router.post('/bulkproducts',authHandler.isAuthenticated, appHandler.bulkProducts);
6363

64+
router.post('/bulkproductslegacy',authHandler.isAuthenticated, appHandler.bulkProductsLegacy);
65+
6466
return router
6567
}

routes/main.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@ module.exports = function (passport) {
1717
vuln_title: vulnDict[req.params.vuln],
1818
vuln_scenario: req.params.vuln + '/scenario',
1919
vuln_description: req.params.vuln + '/description',
20-
vuln_reference: req.params.vuln + '/reference'
20+
vuln_reference: req.params.vuln + '/reference',
21+
vulnerabilities:vulnDict
2122
}, function (err, html) {
2223
if (err) {
24+
console.log(err)
2325
res.status(404).send('404')
2426
} else {
2527
res.send(html)
@@ -28,7 +30,7 @@ module.exports = function (passport) {
2830
})
2931

3032
router.get('/learn', authHandler.isAuthenticated, function (req, res) {
31-
res.render('learn')
33+
res.render('learn',{vulnerabilities:vulnDict})
3234
})
3335

3436
router.get('/register', authHandler.isNotAuthenticated, function (req, res) {

views/app/bulkproducts.ejs

+23-38
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@
2323

2424
<div>
2525
<h3>Upload products</h3>
26-
<form encType="multipart/form-data" method="post" action="/app/bulkproducts">
26+
<form encType="multipart/form-data" method="post" action="/app/bulkproducts<% if(legacy){%>legacy<%}%>">
2727
<div class="input-group mb-3">
2828
<div class="products-file">
29-
<input type="file" name="products" class="file-input" id="inputfile" accept=".xml">
29+
<input type="file" name="products" class="file-input" id="inputfile" <% if(!legacy){ %> accept=".xml" <% } %>>
3030
<br>
3131
<input class="button" type="submit" name="submit" value="Upload">
3232
</div>
@@ -35,44 +35,29 @@
3535
</div>
3636

3737
<div><br>
38+
<!-- Handle legacy endpoit /app/bulkproducts?legacy=true -->
39+
<% if (!legacy) { %>
3840
<h3>Sample XML</h3>
39-
<xmp>
40-
<products>
41-
<product>
42-
<name>Xbox One</name>
43-
<code>23</code>
44-
<tags>gaming console</tags>
45-
<description>Gaming console by Microsoft</description>
46-
</product>
47-
<product>
48-
<name>Playstation 4</name>
49-
<code>26</code>
50-
<tags>gaming console</tags>
51-
<description>Gaming console by Sony</description>
52-
</product>
53-
</products>
54-
</xmp>
55-
<xmp>
56-
<products>
57-
<product>
58-
<name>Xbox One</name>
59-
<code>23</code>
60-
<tags>gaming console</tags>
61-
<description>Gaming console by Microsoft</description>
62-
</product>
63-
<product>
64-
<name>Playstation 4</name>
65-
<code>26</code>
66-
<tags>gaming console</tags>
67-
<description>Gaming console by Sony</description>
68-
</product>
69-
</products>
70-
</xmp>
71-
<!-- For legacy endpoit /app/bulkproducts?legacy=true <xmp>[{"name":"Xbox 360","code":"15","tags":"gaming console","description":"Microsoft's flagship gaming console"},{"name":"Playstation 3","code":"17","tags":"gaming console","description":"Sony's flagshipgaming console"}]</xmp> -->
41+
<pre><xmp>
42+
<products>
43+
<product>
44+
<name>Xbox One</name>
45+
<code>23</code>
46+
<tags>gaming console</tags>
47+
<description>Gaming console by Microsoft</description>
48+
</product>
49+
<product>
50+
<name>Playstation 4</name>
51+
<code>26</code>
52+
<tags>gaming console</tags>
53+
<description>Gaming console by Sony</description>
54+
</product>
55+
</products>
56+
</xmp></pre>
57+
<% } else { %>
58+
<pre style="white-space: pre-wrap;">[{"name":"Xbox 360","code":"15","tags":"gaming console","description":"Microsoft's flagship gaming console"},{"name":"Playstation 3","code":"17","tags":"gaming console","description":"Sony's flagshipgaming console"}]</pre>
59+
<%} %>
7260
</div>
73-
74-
75-
7661
</div></div></div>
7762
<% include ../common/footer %>
7863
</body>

views/common/menu.ejs

-32
This file was deleted.

views/learn.ejs

+10-11
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@
99

1010
<div class='row'>
1111
<div class='col-md-3'>
12-
<% include common/menu %>
12+
<div class='list-group'>
13+
<% for (var vulnKey in vulnerabilities) { %>
14+
<a href="/learn/vulnerability/<%=vulnKey%>" class='list-group-item'>
15+
<i class='fa fa-angle-double-right'></i> <%=vulnerabilities[vulnKey]%>
16+
</a>
17+
<% } %>
18+
</div>
1319
</div>
1420
<div class='col-md-9'>
1521
<% if (messages.success) { %>
@@ -26,16 +32,9 @@
2632
Start by selecting one of the vulnerability class from the left menu or select one of the link below: </p>
2733

2834
<ul>
29-
<li><a href='/learn/vulnerability/a1_injection'>A1: Injection</a></li>
30-
<li><a href='/learn/vulnerability/a2_broken_auth'>A2: Broken Authentication and Session Management</a></li>
31-
<li><a href='/learn/vulnerability/a3_xss'>A3: Cross-site Scripting</a></li>
32-
<li><a href='/learn/vulnerability/a4_idor'>A4: Insecure Direct Object Reference</a></li>
33-
<li><a href='/learn/vulnerability/a5_sec_misconf'>A5: Security Misconfiguration</a></li>
34-
<li><a href='/learn/vulnerability/a6_sensitive_data'>A6: Sensitive Data Exposure</a></li>
35-
<li><a href='/learn/vulnerability/a7_missing_access_control'>A7: Missing Function Level Access Control</a></li>
36-
<li><a href='/learn/vulnerability/a8_csrf'>A8: Cross-site Request Forgery</a></li>
37-
<li><a href='/learn/vulnerability/a9_vuln_component'>A9: Using Components with Known Vulnerability</a></li>
38-
<li><a href='/learn/vulnerability/a10_redirect'>A10: Unvalidated Redirects and Forwards</a></li>
35+
<% for (var vulnKey in vulnerabilities) { %>
36+
<li><a href='/learn/vulnerability/<%=vulnKey%>'> <%=vulnerabilities[vulnKey]%> </a></li>
37+
<% } %>
3938
</ul>
4039
</div>
4140
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="markdown">
2+
Insufficient logging and monitoring, coupled with missing or ineffective integration with incident response, allows attackers to further attack systems, maintain persistence, pivot to more systems, and tamper, extract, or destroy data.
3+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="markdown">
2+
* [https://www.owasp.org/index.php/Top_10-2017_A10-Insufficient_Logging%26Monitoring](https://www.owasp.org/index.php/Top_10-2017_A10-Insufficient_Logging%26Monitoring)
3+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<div class='markdown'>
2+
* No Scenario for this vulnerability
3+
</div>
4+

views/vulnerabilities/a4_idor/description.ejs

-3
This file was deleted.

views/vulnerabilities/a4_idor/reference.ejs

-3
This file was deleted.

views/vulnerabilities/a4_idor/scenario.ejs

-4
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="markdown">
2+
Many older or poorly configured XML processors evaluate external entity references within XML documents. External entities can be used to disclose internal files using the file URI handler, internal file shares, internal port scanning, remote code execution, and denial of service attacks.
3+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="markdown">
2+
* [https://www.owasp.org/index.php/Top_10-2017_A4-XML_External_Entities_(XXE)](https://www.owasp.org/index.php/Top_10-2017_A4-XML_External_Entities_(XXE))
3+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class='markdown'>
2+
* [XXE: Import Products](/app/bulkproducts)
3+
</div>
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<div class='markdown'>
22
* [Admin API Dashbaord](/app/admin)
3-
3+
* [Edit User](/app/useredit)
44
</div>
55

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="markdown">
2+
Insecure deserialization often leads to remote code execution. Even if deserialization flaws do not result in remote code execution, they can be used to perform attacks, including replay attacks, injection attacks, and privilege escalation attacks.
3+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div class="markdown">
2+
* [https://www.owasp.org/index.php/Top_10-2017_A8-Insecure_Deserialization](https://www.owasp.org/index.php/Top_10-2017_A8-Insecure_Deserialization)
3+
</div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<div class='markdown'>
2+
* [Insecure Deserialization: Legacy Import Products](/app/bulkproductslegacy)
3+
</div>
4+

views/vulnerabilities/layout.ejs

+7-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,13 @@
99

1010
<div class='row'>
1111
<div class='col-md-3'>
12-
<% include ../common/menu %>
12+
<div class='list-group'>
13+
<% for (var vulnKey in vulnerabilities) { %>
14+
<a href="/learn/vulnerability/<%=vulnKey%>" class='list-group-item'>
15+
<i class='fa fa-angle-double-right'></i> <%=vulnerabilities[vulnKey]%>
16+
</a>
17+
<% } %>
18+
</div>
1319
</div>
1420
<div class='col-md-9'>
1521
<h3><%=vuln_title%></h3>

0 commit comments

Comments
 (0)