SlideShare a Scribd company logo
1 of 54
SECURE CODING WITH
SECURE CODING WITH NODE.JS
OBJECTIVE
▸The purpose of the following micro-course is learning
by examples the major security flaws in code in
NodeJS, possible solutions and good security practices.
SECURE CODING WITH NODE.JS
INDEX
SECURE CODING WITH NODE.JS
OWASP TOP 10 WITH 1 PICTURE
SECURE CODING WITH NODE.JS
CORRESPONDENCIA CON OWASP TOP 10
SECURE CODING WITH NODE.JS
VULNERABLE NODE.JS
PROJECT
▸ https://github.com/cr0hn/vulnerable-node
A1 - INJECTION:
INJECTION FLAWS, SUCH AS SQL, OS, AND
LDAP INJECTION OCCUR WHEN UNTRUSTED
DATA IS SENT TO AN INTERPRETER AS PART
OF A COMMAND OR QUERY. THE ATTACKER’S
HOSTILE DATA CAN TRICK THE INTERPRETER
INTO EXECUTING UNINTENDED COMMANDS
OR ACCESSING DATA WITHOUT PROPER
AUTHORIZATION. OWASP TOP 10
A1 - INJECTION
TEXTO
CODE INJECTION: DEFINITION
▸Those application points with input information, usually from
the user, which must be treated as untrusted by default.
▸Assimilate and understand the expression: This code smells
injection
A1 - INJECTION :: SQL INJECTION (1/5)
SQL INJECTION
function do_auth(username, password) {
var db = pgp(config.db.connectionString);
var q = "SELECT * FROM users WHERE name = '" + username + "' AND password ='" +
password + "';";
return db.one(q);
}
/model/auth.js:4
A1 - INJECTION :: SQL INJECTION (2/5)
SQL INJECTION
function do_auth(username, password) {
var db = pgp(config.db.connectionString);
var q = "SELECT * FROM users WHERE name = '" + username + "' AND password ='" +
password + "';";
return db.one(q);
}
/model/auth.js:4
A1 - INJECTION :: SQL INJECTION (3/5)
SQL INJECTION - ATTACK (1/2)
A1 - INJECTION :: SQL INJECTION (4/5)
SQL INJECTION - ATTACK (2/2)
A1 - INJECTION :: SQL INJECTION (5/5)
SQL INJECTION - SOLUTION
Prepared statement
A1 - INJECTION :: LOG INJECTION (1/3)
LOG INJECTION
router.post('/login/auth', function(req, res) {
var user = req.body.username;
var password = req.body.password;
var returnurl = req.body.returnurl;
logger.error("Tried to login attempt from user = " + user);
/model/login.js:25
A1 - INJECTION :: LOG INJECTION (1/3)
LOG INJECTION
router.post('/login/auth', function(req, res) {
var user = req.body.username;
var password = req.body.password;
var returnurl = req.body.returnurl;
logger.error("Tried to login attempt from user = " + user);
/model/login.js:25
A1 - INJECTION :: LOG INJECTION (1/3)
LOG INJECTION - ATTACK (1/2)
A1 - INJECTION :: LOG INJECTION (1/3)
LOG INJECTION - ATTACK (2/2)
A1 - INJECTION :: LOG INJECTION (1/3)
LOG INJECTION - SOLUTION
Use a logging framework, adding variables
as parameters
If you can’t use a framework, remove CR & LR
A1 - INJECTION :: EVIL REGEX (1/4)
EVIL REGEX - EXPLANATION
Regex: ^(a+)+$
Denial Of System (DoS)
A1 - INJECTION :: EVIL REGEX (2/4)
EVIL REGEX
var re = /^([a-zA-Z0-9])(([-.]|[_]+)?([a-zA-Z0-9]+))*(@){1}[a-z0-9]+[.]{1}(([a-z]{2,3})|([a-
z]{2,3}[.]{1}[a-z]{2,3}))$/
if (!re.test(cart.mail)){
throw new Error("Invalid mail format");
}
/routers/products.js:120
A1 - INJECTION :: EVIL REGEX (3/4)
EVIL REGEX - ATTACK
30 seconds
▸ https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS
A1 - INJECTION :: EVIL REGEX (4/4)
EVIL REGEX - SOLUTION
Use regex as simple as you can
Check each regex before go to production
A2 - BROKEN AUTHENTICATION AND
SESSION MANAGEMENT:
APPLICATION FUNCTIONS RELATED TO
AUTHENTICATION AND SESSION
MANAGEMENT ARE OFTEN NOT IMPLEMENTED
CORRECTLY, ALLOWING ATTACKERS TO
COMPROMISE PASSWORDS, KEYS, OR
SESSION TOKENS, OR TO EXPLOIT OTHER
IMPLEMENTATION FLAWS TO ASSUME OTHER
USERS’ IDENTITIES.
OWASP TOP 10
A2 - BROKEN AUTHENTICATION AND SESSION MANAGEMENT
A2 - BROKEN AUTHENTICATION AND SESSION MANAGEMENT :: COOKIES (1/3)
COOKIES
app.use(session({
secret: 'ñasddfilhpaf78h78032h780g780fg780asg780dsbovncubuyvqy',
cookie: {
secure: false,
maxAge: 99999999999
}
}));
/model/app.js:43
A2 - BROKEN AUTHENTICATION AND SESSION MANAGEMENT :: COOKIES (2/3)
COOKIES
A2 - BROKEN AUTHENTICATION AND SESSION MANAGEMENT :: COOKIES (3/3)
COOKIES - SOLUTION
Enable HTTP-Only
Limite expire time of cookie
A3 - CROSS-SITE SCRIPTING
XSS FLAWS OCCUR WHENEVER AN
APPLICATION TAKES UNTRUSTED DATA AND
SENDS IT TO A WEB BROWSER WITHOUT
PROPER VALIDATION OR ESCAPING. XSS
ALLOWS ATTACKERS TO EXECUTE SCRIPTS IN
THE VICTIM’S BROWSER WHICH CAN HIJACK
USER SESSIONS, DEFACE WEB SITES, OR
REDIRECT THE USER TO MALICIOUS SITES.OWASP TOP 10
A3 - CROSS-SITE SCRIPTING
A3 - CROSS-SITE SCRIPTING (1/4)
XSS
router.get('/products/search', function(req, res, next) {
var url_params = url.parse(req.url, true).query;
var query = url_params.q;
db_products.search(query)
.then(function (data) {
res.render('search', { in_query: query, products: data });
})
/routers/products.js:62
A3 - CROSS-SITE SCRIPTING (2/4)
XSS
router.get('/products/search', function(req, res, next) {
var url_params = url.parse(req.url, true).query;
var query = url_params.q;
db_products.search(query)
.then(function (data) {
res.render('search', { in_query: query, products: data });
})
/routers/products.js:62
A3 - CROSS-SITE SCRIPTING (3/4)
XSS - ATTACK
A3 - CROSS-SITE SCRIPTING (4/4)
XSS - SOLUTION
▸https://github.com/mdevils/node-html-entities
HTML Entities
A4 - INSECURE DIRECT OBJECT
REFERENCES
A DIRECT OBJECT REFERENCE OCCURS
WHEN A DEVELOPER EXPOSES A REFERENCE
TO AN INTERNAL IMPLEMENTATION OBJECT,
SUCH AS A FILE, DIRECTORY, OR DATABASE
KEY. WITHOUT AN ACCESS CONTROL CHECK
OR OTHER PROTECTION, ATTACKERS CAN
MANIPULATE THESE REFERENCES TO ACCESS
UNAUTHORIZED DATA.
OWASP TOP 10
A4 - INSECURE DIRECT OBJECT REFERENCES
A4 - INSECURE DIRECT OBJECT REFERENCES
INSECURE DIRECT OBJECT REFERENCES (1/2)
router.all('/products/buy', function(req, res, next) {
cart = {
mail: params.mail,
address: params.address,
ship_date: params.ship_date,
phone: params.phone,
product_id: params.product_id,
product_name: params.product_name,
username: req.session.user_name,
price: params.price.substr(0, params.price.length - 1)}
db_products.purchase(cart)
/routers/products.js:108
A4 - INSECURE DIRECT OBJECT REFERENCES
INSECURE DIRECT OBJECT REFERENCES (2/2)
function purchase(cart) {
var db = pgp(config.db.connectionString);
var q = "INSERT INTO purchases(mail, product_name, user_name, product_id, address, phone,
ship_date, price) VALUES('" +
cart.mail + "', '" +
cart.product_name + "', '" +
cart.username + "', '" +
cart.product_id + "', '" +
cart.address + "', '" +
cart.ship_date + "', '" +
cart.phone + "', '" +
cart.price +
"');";
return db.one(q);
}
/model/products.js:34
• User ownership check?
• Price check?
A4 - INSECURE DIRECT OBJECT REFERENCES
INSECURE DIRECT OBJECT REFERENCES -
ATTACK (1/2)
A4 - INSECURE DIRECT OBJECT REFERENCES
INSECURE DIRECT OBJECT REFERENCES -
SOLUTION
Check database & object references
A6 - SENSITIVE DATA EXPOSURE
MANY WEB APPLICATIONS DO NOT PROPERLY PROTECT
SENSITIVE DATA, SUCH AS CREDIT CARDS, TAX IDS,
AND AUTHENTICATION CREDENTIALS. ATTACKERS MAY
STEAL OR MODIFY SUCH WEAKLY PROTECTED DATA TO
CONDUCT CREDIT CARD FRAUD, IDENTITY THEFT, OR
OTHER CRIMES. SENSITIVE DATA DESERVES EXTRA
PROTECTION SUCH AS ENCRYPTION AT REST OR IN
TRANSIT, AS WELL AS SPECIAL PRECAUTIONS WHEN
EXCHANGED WITH THE BROWSER.
OWASP TOP 10
A6 - SENSITIVE DATA EXPOSURE
A6 - SENSITIVE DATA EXPOSURE (1/4)
SENSITIVE DATA EXPOSURE
router.post('/login/auth', function(req, res) {
var returnurl = req.body.returnurl;
auth(user, password)
})
.catch(function (err) {
res.redirect("/login?returnurl=" + returnurl + "&error=" + err.message);
});
/routers/login:39
A6 - SENSITIVE DATA EXPOSURE (2/4)
SENSITIVE DATA EXPOSURE - ATTACK (1/3)
A6 - SENSITIVE DATA EXPOSURE (3/4)
SENSITIVE DATA EXPOSURE - ATTACK (2/3)
A6 - SENSITIVE DATA EXPOSURE (4/4)
SENSITIVE DATA EXPOSURE - ATTACK (3/3)
A8 - CROSS-SITE REQUEST FORGERY
A CSRF ATTACK FORCES A LOGGED-ON VICTIM’S
BROWSER TO SEND A FORGED HTTP REQUEST,
INCLUDING THE VICTIM’S SESSION COOKIE AND ANY
OTHER AUTOMATICALLY INCLUDED
AUTHENTICATION INFORMATION, TO A VULNERABLE
WEB APPLICATION. THIS ALLOWS THE ATTACKER TO
FORCE THE VICTIM’S BROWSER TO GENERATE
REQUESTS THE VULNERABLE APPLICATION THINKS
ARE LEGITIMATE REQUESTS FROM THE VICTIM.OWASP TOP 10
A8 - CROSS-SITE REQUEST FORGERY
A8 - CROSS-SITE REQUEST FORGERY (1/6)
CROSS-SITE REQUEST FORGERY
router.all('/products/buy', function(req, res, next) {
cart = {
mail: params.mail,
address: params.address,
ship_date: params.ship_date,
phone: params.phone,
product_id: params.product_id,
product_name: params.product_name,
username: req.session.user_name,
price: params.price.substr(0, params.price.length - 1)
}
db_products.purchase(cart)
.catch(function (err) {
return res.json({message: "Product purchased correctly"});
});
/routers/products:89
A8 - CROSS-SITE REQUEST FORGERY (2/6)
CROSS-SITE REQUEST FORGERY
router.all('/products/buy', function(req, res, next) {
cart = {
mail: params.mail,
address: params.address,
ship_date: params.ship_date,
phone: params.phone,
product_id: params.product_id,
product_name: params.product_name,
username: req.session.user_name,
price: params.price.substr(0, params.price.length - 1)
}
db_products.purchase(cart)
.catch(function (err) {
return res.json({message: "Product purchased correctly"});
});
/routers/products:89
Token?
A8 - CROSS-SITE REQUEST FORGERY (3/6)
CROSS-SITE REQUEST FORGERY
A8 - CROSS-SITE REQUEST FORGERY (4/6)
CROSS-SITE REQUEST FORGERY
Buy by GET Request
No token
A8 - CROSS-SITE REQUEST FORGERY (5/6)
CROSS-SITE REQUEST FORGERY - ATTACK
A8 - CROSS-SITE REQUEST FORGERY (6/6)
CROSS-SITE REQUEST FORGERY - SOLUTION
Use POST requests for actions that modifies
the system.
Use a unique token (CSRF Token) for each
requests that modify the system.
A10 - UNVALIDATED REDIRECTS AND
FORWARDS
WEB APPLICATIONS FREQUENTLY REDIRECT
AND FORWARD USERS TO OTHER PAGES AND
WEBSITES, AND USE UNTRUSTED DATA TO
DETERMINE THE DESTINATION PAGES.
WITHOUT PROPER VALIDATION, ATTACKERS
CAN REDIRECT VICTIMS TO PHISHING OR
MALWARE SITES, OR USE FORWARDS TO
ACCESS UNAUTHORIZED PAGES.
OWASP TOP 10
A10 - UNVALIDATED REDIRECTS AND FORWARDS
A10 - UNVALIDATED REDIRECTS AND FORWARDS (1/4)
UNVALIDATED REDIRECTS AND FORWARDS
router.post('/login/auth', function(req, res) {
var returnurl = req.body.returnurl;
auth(user, password)
.then(function (data) {
if (returnurl == undefined || returnurl == ""){
returnurl = "/";
}
res.redirect(returnurl);
})
/routers/login.js:36
A10 - UNVALIDATED REDIRECTS AND FORWARDS (2/4)
UNVALIDATED REDIRECTS AND FORWARDS
router.post('/login/auth', function(req, res) {
var returnurl = req.body.returnurl;
auth(user, password)
.then(function (data) {
if (returnurl == undefined || returnurl == ""){
returnurl = "/";
}
res.redirect(returnurl);
})
/routers/login.js:36
A10 - UNVALIDATED REDIRECTS AND FORWARDS (3/4)
UNVALIDATED REDIRECTS AND FORWARDS -
ATTACK
A10 - UNVALIDATED REDIRECTS AND FORWARDS (4/4)
UNVALIDATED REDIRECTS AND FORWARDS -
SOLUTION
Only allow relative to domain redirection
White list for redirections
SECURE CODING WITH NODE.JS
REFERENCIAS
▸OWASP Top 10: https://www.owasp.org/index.php/Top_10_2013-Top_10
▸NodeJS Security check list: https://blog.risingstack.com/node-js-security-checklist/
▸Evil regex:
https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-
_ReDoS
▸Detect potentially evil regex: https://github.com/substack/safe-regex

More Related Content

What's hot

Android Application Penetration Testing - Mohammed Adam
Android Application Penetration Testing - Mohammed AdamAndroid Application Penetration Testing - Mohammed Adam
Android Application Penetration Testing - Mohammed AdamMohammed Adam
 
Sql Injection - Vulnerability and Security
Sql Injection - Vulnerability and SecuritySql Injection - Vulnerability and Security
Sql Injection - Vulnerability and SecuritySandip Chaudhari
 
WebAuthn and Security Keys
WebAuthn and Security KeysWebAuthn and Security Keys
WebAuthn and Security KeysFIDO Alliance
 
Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016bugcrowd
 
Ppt on sql injection
Ppt on sql injectionPpt on sql injection
Ppt on sql injectionashish20012
 
Hunting for security bugs in AEM webapps
Hunting for security bugs in AEM webappsHunting for security bugs in AEM webapps
Hunting for security bugs in AEM webappsMikhail Egorov
 
An Introduction to OAuth 2
An Introduction to OAuth 2An Introduction to OAuth 2
An Introduction to OAuth 2Aaron Parecki
 
Getting Started with FIDO2
Getting Started with FIDO2Getting Started with FIDO2
Getting Started with FIDO2FIDO Alliance
 
Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)Brian Huff
 
Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020Moataz Kamel
 
Secure Coding for NodeJS
Secure Coding for NodeJSSecure Coding for NodeJS
Secure Coding for NodeJSThang Chung
 
What should a hacker know about WebDav?
What should a hacker know about WebDav?What should a hacker know about WebDav?
What should a hacker know about WebDav?Mikhail Egorov
 
OWASP Top 10 API Security Risks
OWASP Top 10 API Security RisksOWASP Top 10 API Security Risks
OWASP Top 10 API Security RisksIndusfacePvtLtd
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Barrel Software
 
The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016
The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016
The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016Frans Rosén
 
Understanding Cross-site Request Forgery
Understanding Cross-site Request ForgeryUnderstanding Cross-site Request Forgery
Understanding Cross-site Request ForgeryDaniel Miessler
 
A Hacker's perspective on AEM applications security
A Hacker's perspective on AEM applications securityA Hacker's perspective on AEM applications security
A Hacker's perspective on AEM applications securityMikhail Egorov
 
seminar report on Sql injection
seminar report on Sql injectionseminar report on Sql injection
seminar report on Sql injectionJawhar Ali
 
스프링 시큐리티 구조 이해
스프링 시큐리티 구조 이해스프링 시큐리티 구조 이해
스프링 시큐리티 구조 이해beom kyun choi
 

What's hot (20)

Android Application Penetration Testing - Mohammed Adam
Android Application Penetration Testing - Mohammed AdamAndroid Application Penetration Testing - Mohammed Adam
Android Application Penetration Testing - Mohammed Adam
 
Sql Injection - Vulnerability and Security
Sql Injection - Vulnerability and SecuritySql Injection - Vulnerability and Security
Sql Injection - Vulnerability and Security
 
WebAuthn and Security Keys
WebAuthn and Security KeysWebAuthn and Security Keys
WebAuthn and Security Keys
 
Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016Bug Bounty Hunter Methodology - Nullcon 2016
Bug Bounty Hunter Methodology - Nullcon 2016
 
Socket.IO
Socket.IOSocket.IO
Socket.IO
 
Ppt on sql injection
Ppt on sql injectionPpt on sql injection
Ppt on sql injection
 
Hunting for security bugs in AEM webapps
Hunting for security bugs in AEM webappsHunting for security bugs in AEM webapps
Hunting for security bugs in AEM webapps
 
An Introduction to OAuth 2
An Introduction to OAuth 2An Introduction to OAuth 2
An Introduction to OAuth 2
 
Getting Started with FIDO2
Getting Started with FIDO2Getting Started with FIDO2
Getting Started with FIDO2
 
Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)
 
Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020Secure coding presentation Oct 3 2020
Secure coding presentation Oct 3 2020
 
Secure Coding for NodeJS
Secure Coding for NodeJSSecure Coding for NodeJS
Secure Coding for NodeJS
 
What should a hacker know about WebDav?
What should a hacker know about WebDav?What should a hacker know about WebDav?
What should a hacker know about WebDav?
 
OWASP Top 10 API Security Risks
OWASP Top 10 API Security RisksOWASP Top 10 API Security Risks
OWASP Top 10 API Security Risks
 
Cross Site Scripting (XSS)
Cross Site Scripting (XSS)Cross Site Scripting (XSS)
Cross Site Scripting (XSS)
 
The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016
The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016
The Secret Life of a Bug Bounty Hunter – Frans Rosén @ Security Fest 2016
 
Understanding Cross-site Request Forgery
Understanding Cross-site Request ForgeryUnderstanding Cross-site Request Forgery
Understanding Cross-site Request Forgery
 
A Hacker's perspective on AEM applications security
A Hacker's perspective on AEM applications securityA Hacker's perspective on AEM applications security
A Hacker's perspective on AEM applications security
 
seminar report on Sql injection
seminar report on Sql injectionseminar report on Sql injection
seminar report on Sql injection
 
스프링 시큐리티 구조 이해
스프링 시큐리티 구조 이해스프링 시큐리티 구조 이해
스프링 시큐리티 구조 이해
 

Viewers also liked

RootedCON 2017 - Docker might not be your friend. Trojanizing Docker images
RootedCON 2017 - Docker might not be your friend. Trojanizing Docker imagesRootedCON 2017 - Docker might not be your friend. Trojanizing Docker images
RootedCON 2017 - Docker might not be your friend. Trojanizing Docker imagesDaniel Garcia (a.k.a cr0hn)
 
2014 database - course 3 - PHP and MySQL
2014 database - course 3 - PHP and MySQL2014 database - course 3 - PHP and MySQL
2014 database - course 3 - PHP and MySQLHung-yu Lin
 
Scapy: Crear un Frankenstein de red y hacerlo pasar por el príncipe azul
Scapy: Crear un Frankenstein de red y hacerlo pasar por el príncipe azulScapy: Crear un Frankenstein de red y hacerlo pasar por el príncipe azul
Scapy: Crear un Frankenstein de red y hacerlo pasar por el príncipe azulDaniel Garcia (a.k.a cr0hn)
 
Cybercamp 2015 - Python, hacking y sec-tools desde las trincheras
Cybercamp 2015 - Python, hacking y sec-tools desde las trincherasCybercamp 2015 - Python, hacking y sec-tools desde las trincheras
Cybercamp 2015 - Python, hacking y sec-tools desde las trincherasDaniel Garcia (a.k.a cr0hn)
 
Identificando y rompiendo servicios de las 4 capas de TCP/IP
Identificando y rompiendo servicios de las 4 capas de TCP/IPIdentificando y rompiendo servicios de las 4 capas de TCP/IP
Identificando y rompiendo servicios de las 4 capas de TCP/IPDaniel Garcia (a.k.a cr0hn)
 
El poder de los reptiles: Hacer herramientas de hacking es fácil
El poder de los reptiles: Hacer herramientas de hacking es fácilEl poder de los reptiles: Hacer herramientas de hacking es fácil
El poder de los reptiles: Hacer herramientas de hacking es fácilDaniel Garcia (a.k.a cr0hn)
 
The art of disguise - Antifingerprinting techniques
The art of disguise - Antifingerprinting techniquesThe art of disguise - Antifingerprinting techniques
The art of disguise - Antifingerprinting techniquesDaniel Garcia (a.k.a cr0hn)
 
Qué es el fingerprinting: Definición, peligros y medidas mitigadoras
Qué es el fingerprinting: Definición, peligros y medidas mitigadorasQué es el fingerprinting: Definición, peligros y medidas mitigadoras
Qué es el fingerprinting: Definición, peligros y medidas mitigadorasDaniel Garcia (a.k.a cr0hn)
 
XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?Yurii Bilyk
 
Безопасность Node.js / Илья Вербицкий (Независимый консультант)
Безопасность Node.js / Илья Вербицкий (Независимый консультант)Безопасность Node.js / Илья Вербицкий (Независимый консультант)
Безопасность Node.js / Илья Вербицкий (Независимый консультант)Ontico
 

Viewers also liked (20)

RootedCON 2017 - Docker might not be your friend. Trojanizing Docker images
RootedCON 2017 - Docker might not be your friend. Trojanizing Docker imagesRootedCON 2017 - Docker might not be your friend. Trojanizing Docker images
RootedCON 2017 - Docker might not be your friend. Trojanizing Docker images
 
Blind XSS & Click Jacking
Blind XSS & Click JackingBlind XSS & Click Jacking
Blind XSS & Click Jacking
 
Blind XSS
Blind XSSBlind XSS
Blind XSS
 
Chapter2 j2ee
Chapter2 j2eeChapter2 j2ee
Chapter2 j2ee
 
2014 database - course 3 - PHP and MySQL
2014 database - course 3 - PHP and MySQL2014 database - course 3 - PHP and MySQL
2014 database - course 3 - PHP and MySQL
 
Introduccion muy básica a Python
Introduccion muy básica a PythonIntroduccion muy básica a Python
Introduccion muy básica a Python
 
Cybercam 2014
Cybercam 2014Cybercam 2014
Cybercam 2014
 
Scapy: Crear un Frankenstein de red y hacerlo pasar por el príncipe azul
Scapy: Crear un Frankenstein de red y hacerlo pasar por el príncipe azulScapy: Crear un Frankenstein de red y hacerlo pasar por el príncipe azul
Scapy: Crear un Frankenstein de red y hacerlo pasar por el príncipe azul
 
Topera: Evadiendo Snort con IPv6
Topera: Evadiendo Snort con IPv6Topera: Evadiendo Snort con IPv6
Topera: Evadiendo Snort con IPv6
 
Cybercamp 2015 - Python, hacking y sec-tools desde las trincheras
Cybercamp 2015 - Python, hacking y sec-tools desde las trincherasCybercamp 2015 - Python, hacking y sec-tools desde las trincheras
Cybercamp 2015 - Python, hacking y sec-tools desde las trincheras
 
Identificando y rompiendo servicios de las 4 capas de TCP/IP
Identificando y rompiendo servicios de las 4 capas de TCP/IPIdentificando y rompiendo servicios de las 4 capas de TCP/IP
Identificando y rompiendo servicios de las 4 capas de TCP/IP
 
Hacking y python: Hacking de redes con Python
Hacking y python: Hacking de redes con PythonHacking y python: Hacking de redes con Python
Hacking y python: Hacking de redes con Python
 
El poder de los reptiles: Hacer herramientas de hacking es fácil
El poder de los reptiles: Hacer herramientas de hacking es fácilEl poder de los reptiles: Hacer herramientas de hacking es fácil
El poder de los reptiles: Hacer herramientas de hacking es fácil
 
RootedCON 2016 - Broker & MQ injection
RootedCON 2016 - Broker & MQ injectionRootedCON 2016 - Broker & MQ injection
RootedCON 2016 - Broker & MQ injection
 
The art of disguise - Antifingerprinting techniques
The art of disguise - Antifingerprinting techniquesThe art of disguise - Antifingerprinting techniques
The art of disguise - Antifingerprinting techniques
 
Qué es el fingerprinting: Definición, peligros y medidas mitigadoras
Qué es el fingerprinting: Definición, peligros y medidas mitigadorasQué es el fingerprinting: Definición, peligros y medidas mitigadoras
Qué es el fingerprinting: Definición, peligros y medidas mitigadoras
 
XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?XSS - Do you know EVERYTHING?
XSS - Do you know EVERYTHING?
 
Extreme security in web servers
Extreme security in  web serversExtreme security in  web servers
Extreme security in web servers
 
Безопасность Node.js / Илья Вербицкий (Независимый консультант)
Безопасность Node.js / Илья Вербицкий (Независимый консультант)Безопасность Node.js / Илья Вербицкий (Независимый консультант)
Безопасность Node.js / Илья Вербицкий (Независимый консультант)
 
GoLismero: The Web Knife
GoLismero: The Web KnifeGoLismero: The Web Knife
GoLismero: The Web Knife
 

Similar to Security in NodeJS applications

Hacking 101 (Session 2)
Hacking 101  (Session 2)Hacking 101  (Session 2)
Hacking 101 (Session 2)Nitroxis Sprl
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsFrancois Zaninotto
 
The top 10 security issues in web applications
The top 10 security issues in web applicationsThe top 10 security issues in web applications
The top 10 security issues in web applicationsDevnology
 
Node.js API 서버 성능 개선기
Node.js API 서버 성능 개선기Node.js API 서버 성능 개선기
Node.js API 서버 성능 개선기JeongHun Byeon
 
Evolution Of Web Security
Evolution Of Web SecurityEvolution Of Web Security
Evolution Of Web SecurityChris Shiflett
 
Web Application Firewall: Suckseed or Succeed
Web Application Firewall: Suckseed or SucceedWeb Application Firewall: Suckseed or Succeed
Web Application Firewall: Suckseed or SucceedPrathan Phongthiproek
 
Applications secure by default
Applications secure by defaultApplications secure by default
Applications secure by defaultSlawomir Jasek
 
Applications secure by default
Applications secure by defaultApplications secure by default
Applications secure by defaultSecuRing
 
07 application security fundamentals - part 2 - security mechanisms - data ...
07   application security fundamentals - part 2 - security mechanisms - data ...07   application security fundamentals - part 2 - security mechanisms - data ...
07 application security fundamentals - part 2 - security mechanisms - data ...appsec
 
Drive chrome(headless) with puppeteer
Drive chrome(headless) with puppeteerDrive chrome(headless) with puppeteer
Drive chrome(headless) with puppeteerVodqaBLR
 
FwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.jsFwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.jsTimur Shemsedinov
 
Whatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the processWhatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the processguest3379bd
 
OWASP Top 10 - DrupalCon Amsterdam 2019
OWASP Top 10 - DrupalCon Amsterdam 2019OWASP Top 10 - DrupalCon Amsterdam 2019
OWASP Top 10 - DrupalCon Amsterdam 2019Ayesh Karunaratne
 
Web Application Security in Rails
Web Application Security in RailsWeb Application Security in Rails
Web Application Security in RailsUri Nativ
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxFernandoVizer
 
Do you know what your drupal is doing? Observe it!
Do you know what your drupal is doing? Observe it!Do you know what your drupal is doing? Observe it!
Do you know what your drupal is doing? Observe it!Luca Lusso
 
Methods to Bypass a Web Application Firewall Eng
Methods to Bypass a Web Application Firewall EngMethods to Bypass a Web Application Firewall Eng
Methods to Bypass a Web Application Firewall EngDmitry Evteev
 

Similar to Security in NodeJS applications (20)

Hacking 101 (Session 2)
Hacking 101  (Session 2)Hacking 101  (Session 2)
Hacking 101 (Session 2)
 
Bonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node jsBonnes pratiques de développement avec Node js
Bonnes pratiques de développement avec Node js
 
The top 10 security issues in web applications
The top 10 security issues in web applicationsThe top 10 security issues in web applications
The top 10 security issues in web applications
 
Node.js API 서버 성능 개선기
Node.js API 서버 성능 개선기Node.js API 서버 성능 개선기
Node.js API 서버 성능 개선기
 
Evolution Of Web Security
Evolution Of Web SecurityEvolution Of Web Security
Evolution Of Web Security
 
Web Application Firewall: Suckseed or Succeed
Web Application Firewall: Suckseed or SucceedWeb Application Firewall: Suckseed or Succeed
Web Application Firewall: Suckseed or Succeed
 
Security in Node.JS and Express:
Security in Node.JS and Express:Security in Node.JS and Express:
Security in Node.JS and Express:
 
Applications secure by default
Applications secure by defaultApplications secure by default
Applications secure by default
 
Applications secure by default
Applications secure by defaultApplications secure by default
Applications secure by default
 
07 application security fundamentals - part 2 - security mechanisms - data ...
07   application security fundamentals - part 2 - security mechanisms - data ...07   application security fundamentals - part 2 - security mechanisms - data ...
07 application security fundamentals - part 2 - security mechanisms - data ...
 
Drive chrome(headless) with puppeteer
Drive chrome(headless) with puppeteerDrive chrome(headless) with puppeteer
Drive chrome(headless) with puppeteer
 
FwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.jsFwDays 2021: Metarhia Technology Stack for Node.js
FwDays 2021: Metarhia Technology Stack for Node.js
 
Whatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the processWhatever it takes - Fixing SQLIA and XSS in the process
Whatever it takes - Fixing SQLIA and XSS in the process
 
OWASP Top 10 - DrupalCon Amsterdam 2019
OWASP Top 10 - DrupalCon Amsterdam 2019OWASP Top 10 - DrupalCon Amsterdam 2019
OWASP Top 10 - DrupalCon Amsterdam 2019
 
Web Application Security in Rails
Web Application Security in RailsWeb Application Security in Rails
Web Application Security in Rails
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptx
 
Do you know what your drupal is doing? Observe it!
Do you know what your drupal is doing? Observe it!Do you know what your drupal is doing? Observe it!
Do you know what your drupal is doing? Observe it!
 
Methods to Bypass a Web Application Firewall Eng
Methods to Bypass a Web Application Firewall EngMethods to Bypass a Web Application Firewall Eng
Methods to Bypass a Web Application Firewall Eng
 
Day8
Day8Day8
Day8
 
Hacking 101 3
Hacking 101 3Hacking 101 3
Hacking 101 3
 

More from Daniel Garcia (a.k.a cr0hn)

Rooted con 2020 - from the heaven to hell in the CI - CD
Rooted con 2020 - from the heaven to hell in the CI - CDRooted con 2020 - from the heaven to hell in the CI - CD
Rooted con 2020 - from the heaven to hell in the CI - CDDaniel Garcia (a.k.a cr0hn)
 
Rooted 2018 - Crawlino: The next level of crawling systems
Rooted 2018 - Crawlino: The next level of crawling systemsRooted 2018 - Crawlino: The next level of crawling systems
Rooted 2018 - Crawlino: The next level of crawling systemsDaniel Garcia (a.k.a cr0hn)
 
Ingenieria social aplicada: Mucho mas fácil de lo que parece
Ingenieria social aplicada: Mucho mas fácil de lo que pareceIngenieria social aplicada: Mucho mas fácil de lo que parece
Ingenieria social aplicada: Mucho mas fácil de lo que pareceDaniel Garcia (a.k.a cr0hn)
 
Ingeniería social aplicada: Mucho más fácil de lo que parece
Ingeniería social aplicada: Mucho más fácil de lo que pareceIngeniería social aplicada: Mucho más fácil de lo que parece
Ingeniería social aplicada: Mucho más fácil de lo que pareceDaniel Garcia (a.k.a cr0hn)
 
Tu DevOp me da trabajo: Soy auditor de seguridad
Tu DevOp me da trabajo: Soy auditor de seguridadTu DevOp me da trabajo: Soy auditor de seguridad
Tu DevOp me da trabajo: Soy auditor de seguridadDaniel Garcia (a.k.a cr0hn)
 
III Hack and beers: evadiendo técnicas de fingerprinting en Linux y Wordpress
III Hack and beers: evadiendo técnicas de fingerprinting en Linux y WordpressIII Hack and beers: evadiendo técnicas de fingerprinting en Linux y Wordpress
III Hack and beers: evadiendo técnicas de fingerprinting en Linux y WordpressDaniel Garcia (a.k.a cr0hn)
 

More from Daniel Garcia (a.k.a cr0hn) (9)

Sonatype DevSecOps Leadership forum 2020
Sonatype DevSecOps Leadership forum 2020Sonatype DevSecOps Leadership forum 2020
Sonatype DevSecOps Leadership forum 2020
 
Rooted con 2020 - from the heaven to hell in the CI - CD
Rooted con 2020 - from the heaven to hell in the CI - CDRooted con 2020 - from the heaven to hell in the CI - CD
Rooted con 2020 - from the heaven to hell in the CI - CD
 
12 tricks to avoid hackers breaks your CI / CD
12 tricks to avoid hackers breaks your  CI / CD12 tricks to avoid hackers breaks your  CI / CD
12 tricks to avoid hackers breaks your CI / CD
 
Security in AWS Lambdas - NavajaNegra CON 2018
Security in AWS Lambdas - NavajaNegra CON 2018Security in AWS Lambdas - NavajaNegra CON 2018
Security in AWS Lambdas - NavajaNegra CON 2018
 
Rooted 2018 - Crawlino: The next level of crawling systems
Rooted 2018 - Crawlino: The next level of crawling systemsRooted 2018 - Crawlino: The next level of crawling systems
Rooted 2018 - Crawlino: The next level of crawling systems
 
Ingenieria social aplicada: Mucho mas fácil de lo que parece
Ingenieria social aplicada: Mucho mas fácil de lo que pareceIngenieria social aplicada: Mucho mas fácil de lo que parece
Ingenieria social aplicada: Mucho mas fácil de lo que parece
 
Ingeniería social aplicada: Mucho más fácil de lo que parece
Ingeniería social aplicada: Mucho más fácil de lo que pareceIngeniería social aplicada: Mucho más fácil de lo que parece
Ingeniería social aplicada: Mucho más fácil de lo que parece
 
Tu DevOp me da trabajo: Soy auditor de seguridad
Tu DevOp me da trabajo: Soy auditor de seguridadTu DevOp me da trabajo: Soy auditor de seguridad
Tu DevOp me da trabajo: Soy auditor de seguridad
 
III Hack and beers: evadiendo técnicas de fingerprinting en Linux y Wordpress
III Hack and beers: evadiendo técnicas de fingerprinting en Linux y WordpressIII Hack and beers: evadiendo técnicas de fingerprinting en Linux y Wordpress
III Hack and beers: evadiendo técnicas de fingerprinting en Linux y Wordpress
 

Recently uploaded

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 

Recently uploaded (20)

Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 

Security in NodeJS applications

  • 2. SECURE CODING WITH NODE.JS OBJECTIVE ▸The purpose of the following micro-course is learning by examples the major security flaws in code in NodeJS, possible solutions and good security practices.
  • 3. SECURE CODING WITH NODE.JS INDEX
  • 4. SECURE CODING WITH NODE.JS OWASP TOP 10 WITH 1 PICTURE
  • 5. SECURE CODING WITH NODE.JS CORRESPONDENCIA CON OWASP TOP 10
  • 6. SECURE CODING WITH NODE.JS VULNERABLE NODE.JS PROJECT ▸ https://github.com/cr0hn/vulnerable-node
  • 7. A1 - INJECTION: INJECTION FLAWS, SUCH AS SQL, OS, AND LDAP INJECTION OCCUR WHEN UNTRUSTED DATA IS SENT TO AN INTERPRETER AS PART OF A COMMAND OR QUERY. THE ATTACKER’S HOSTILE DATA CAN TRICK THE INTERPRETER INTO EXECUTING UNINTENDED COMMANDS OR ACCESSING DATA WITHOUT PROPER AUTHORIZATION. OWASP TOP 10 A1 - INJECTION
  • 8. TEXTO CODE INJECTION: DEFINITION ▸Those application points with input information, usually from the user, which must be treated as untrusted by default. ▸Assimilate and understand the expression: This code smells injection
  • 9. A1 - INJECTION :: SQL INJECTION (1/5) SQL INJECTION function do_auth(username, password) { var db = pgp(config.db.connectionString); var q = "SELECT * FROM users WHERE name = '" + username + "' AND password ='" + password + "';"; return db.one(q); } /model/auth.js:4
  • 10. A1 - INJECTION :: SQL INJECTION (2/5) SQL INJECTION function do_auth(username, password) { var db = pgp(config.db.connectionString); var q = "SELECT * FROM users WHERE name = '" + username + "' AND password ='" + password + "';"; return db.one(q); } /model/auth.js:4
  • 11. A1 - INJECTION :: SQL INJECTION (3/5) SQL INJECTION - ATTACK (1/2)
  • 12. A1 - INJECTION :: SQL INJECTION (4/5) SQL INJECTION - ATTACK (2/2)
  • 13. A1 - INJECTION :: SQL INJECTION (5/5) SQL INJECTION - SOLUTION Prepared statement
  • 14. A1 - INJECTION :: LOG INJECTION (1/3) LOG INJECTION router.post('/login/auth', function(req, res) { var user = req.body.username; var password = req.body.password; var returnurl = req.body.returnurl; logger.error("Tried to login attempt from user = " + user); /model/login.js:25
  • 15. A1 - INJECTION :: LOG INJECTION (1/3) LOG INJECTION router.post('/login/auth', function(req, res) { var user = req.body.username; var password = req.body.password; var returnurl = req.body.returnurl; logger.error("Tried to login attempt from user = " + user); /model/login.js:25
  • 16. A1 - INJECTION :: LOG INJECTION (1/3) LOG INJECTION - ATTACK (1/2)
  • 17. A1 - INJECTION :: LOG INJECTION (1/3) LOG INJECTION - ATTACK (2/2)
  • 18. A1 - INJECTION :: LOG INJECTION (1/3) LOG INJECTION - SOLUTION Use a logging framework, adding variables as parameters If you can’t use a framework, remove CR & LR
  • 19. A1 - INJECTION :: EVIL REGEX (1/4) EVIL REGEX - EXPLANATION Regex: ^(a+)+$ Denial Of System (DoS)
  • 20. A1 - INJECTION :: EVIL REGEX (2/4) EVIL REGEX var re = /^([a-zA-Z0-9])(([-.]|[_]+)?([a-zA-Z0-9]+))*(@){1}[a-z0-9]+[.]{1}(([a-z]{2,3})|([a- z]{2,3}[.]{1}[a-z]{2,3}))$/ if (!re.test(cart.mail)){ throw new Error("Invalid mail format"); } /routers/products.js:120
  • 21. A1 - INJECTION :: EVIL REGEX (3/4) EVIL REGEX - ATTACK 30 seconds
  • 22. ▸ https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_-_ReDoS A1 - INJECTION :: EVIL REGEX (4/4) EVIL REGEX - SOLUTION Use regex as simple as you can Check each regex before go to production
  • 23. A2 - BROKEN AUTHENTICATION AND SESSION MANAGEMENT: APPLICATION FUNCTIONS RELATED TO AUTHENTICATION AND SESSION MANAGEMENT ARE OFTEN NOT IMPLEMENTED CORRECTLY, ALLOWING ATTACKERS TO COMPROMISE PASSWORDS, KEYS, OR SESSION TOKENS, OR TO EXPLOIT OTHER IMPLEMENTATION FLAWS TO ASSUME OTHER USERS’ IDENTITIES. OWASP TOP 10 A2 - BROKEN AUTHENTICATION AND SESSION MANAGEMENT
  • 24. A2 - BROKEN AUTHENTICATION AND SESSION MANAGEMENT :: COOKIES (1/3) COOKIES app.use(session({ secret: 'ñasddfilhpaf78h78032h780g780fg780asg780dsbovncubuyvqy', cookie: { secure: false, maxAge: 99999999999 } })); /model/app.js:43
  • 25. A2 - BROKEN AUTHENTICATION AND SESSION MANAGEMENT :: COOKIES (2/3) COOKIES
  • 26. A2 - BROKEN AUTHENTICATION AND SESSION MANAGEMENT :: COOKIES (3/3) COOKIES - SOLUTION Enable HTTP-Only Limite expire time of cookie
  • 27. A3 - CROSS-SITE SCRIPTING XSS FLAWS OCCUR WHENEVER AN APPLICATION TAKES UNTRUSTED DATA AND SENDS IT TO A WEB BROWSER WITHOUT PROPER VALIDATION OR ESCAPING. XSS ALLOWS ATTACKERS TO EXECUTE SCRIPTS IN THE VICTIM’S BROWSER WHICH CAN HIJACK USER SESSIONS, DEFACE WEB SITES, OR REDIRECT THE USER TO MALICIOUS SITES.OWASP TOP 10 A3 - CROSS-SITE SCRIPTING
  • 28. A3 - CROSS-SITE SCRIPTING (1/4) XSS router.get('/products/search', function(req, res, next) { var url_params = url.parse(req.url, true).query; var query = url_params.q; db_products.search(query) .then(function (data) { res.render('search', { in_query: query, products: data }); }) /routers/products.js:62
  • 29. A3 - CROSS-SITE SCRIPTING (2/4) XSS router.get('/products/search', function(req, res, next) { var url_params = url.parse(req.url, true).query; var query = url_params.q; db_products.search(query) .then(function (data) { res.render('search', { in_query: query, products: data }); }) /routers/products.js:62
  • 30. A3 - CROSS-SITE SCRIPTING (3/4) XSS - ATTACK
  • 31. A3 - CROSS-SITE SCRIPTING (4/4) XSS - SOLUTION ▸https://github.com/mdevils/node-html-entities HTML Entities
  • 32. A4 - INSECURE DIRECT OBJECT REFERENCES A DIRECT OBJECT REFERENCE OCCURS WHEN A DEVELOPER EXPOSES A REFERENCE TO AN INTERNAL IMPLEMENTATION OBJECT, SUCH AS A FILE, DIRECTORY, OR DATABASE KEY. WITHOUT AN ACCESS CONTROL CHECK OR OTHER PROTECTION, ATTACKERS CAN MANIPULATE THESE REFERENCES TO ACCESS UNAUTHORIZED DATA. OWASP TOP 10 A4 - INSECURE DIRECT OBJECT REFERENCES
  • 33. A4 - INSECURE DIRECT OBJECT REFERENCES INSECURE DIRECT OBJECT REFERENCES (1/2) router.all('/products/buy', function(req, res, next) { cart = { mail: params.mail, address: params.address, ship_date: params.ship_date, phone: params.phone, product_id: params.product_id, product_name: params.product_name, username: req.session.user_name, price: params.price.substr(0, params.price.length - 1)} db_products.purchase(cart) /routers/products.js:108
  • 34. A4 - INSECURE DIRECT OBJECT REFERENCES INSECURE DIRECT OBJECT REFERENCES (2/2) function purchase(cart) { var db = pgp(config.db.connectionString); var q = "INSERT INTO purchases(mail, product_name, user_name, product_id, address, phone, ship_date, price) VALUES('" + cart.mail + "', '" + cart.product_name + "', '" + cart.username + "', '" + cart.product_id + "', '" + cart.address + "', '" + cart.ship_date + "', '" + cart.phone + "', '" + cart.price + "');"; return db.one(q); } /model/products.js:34 • User ownership check? • Price check?
  • 35. A4 - INSECURE DIRECT OBJECT REFERENCES INSECURE DIRECT OBJECT REFERENCES - ATTACK (1/2)
  • 36. A4 - INSECURE DIRECT OBJECT REFERENCES INSECURE DIRECT OBJECT REFERENCES - SOLUTION Check database & object references
  • 37. A6 - SENSITIVE DATA EXPOSURE MANY WEB APPLICATIONS DO NOT PROPERLY PROTECT SENSITIVE DATA, SUCH AS CREDIT CARDS, TAX IDS, AND AUTHENTICATION CREDENTIALS. ATTACKERS MAY STEAL OR MODIFY SUCH WEAKLY PROTECTED DATA TO CONDUCT CREDIT CARD FRAUD, IDENTITY THEFT, OR OTHER CRIMES. SENSITIVE DATA DESERVES EXTRA PROTECTION SUCH AS ENCRYPTION AT REST OR IN TRANSIT, AS WELL AS SPECIAL PRECAUTIONS WHEN EXCHANGED WITH THE BROWSER. OWASP TOP 10 A6 - SENSITIVE DATA EXPOSURE
  • 38. A6 - SENSITIVE DATA EXPOSURE (1/4) SENSITIVE DATA EXPOSURE router.post('/login/auth', function(req, res) { var returnurl = req.body.returnurl; auth(user, password) }) .catch(function (err) { res.redirect("/login?returnurl=" + returnurl + "&error=" + err.message); }); /routers/login:39
  • 39. A6 - SENSITIVE DATA EXPOSURE (2/4) SENSITIVE DATA EXPOSURE - ATTACK (1/3)
  • 40. A6 - SENSITIVE DATA EXPOSURE (3/4) SENSITIVE DATA EXPOSURE - ATTACK (2/3)
  • 41. A6 - SENSITIVE DATA EXPOSURE (4/4) SENSITIVE DATA EXPOSURE - ATTACK (3/3)
  • 42. A8 - CROSS-SITE REQUEST FORGERY A CSRF ATTACK FORCES A LOGGED-ON VICTIM’S BROWSER TO SEND A FORGED HTTP REQUEST, INCLUDING THE VICTIM’S SESSION COOKIE AND ANY OTHER AUTOMATICALLY INCLUDED AUTHENTICATION INFORMATION, TO A VULNERABLE WEB APPLICATION. THIS ALLOWS THE ATTACKER TO FORCE THE VICTIM’S BROWSER TO GENERATE REQUESTS THE VULNERABLE APPLICATION THINKS ARE LEGITIMATE REQUESTS FROM THE VICTIM.OWASP TOP 10 A8 - CROSS-SITE REQUEST FORGERY
  • 43. A8 - CROSS-SITE REQUEST FORGERY (1/6) CROSS-SITE REQUEST FORGERY router.all('/products/buy', function(req, res, next) { cart = { mail: params.mail, address: params.address, ship_date: params.ship_date, phone: params.phone, product_id: params.product_id, product_name: params.product_name, username: req.session.user_name, price: params.price.substr(0, params.price.length - 1) } db_products.purchase(cart) .catch(function (err) { return res.json({message: "Product purchased correctly"}); }); /routers/products:89
  • 44. A8 - CROSS-SITE REQUEST FORGERY (2/6) CROSS-SITE REQUEST FORGERY router.all('/products/buy', function(req, res, next) { cart = { mail: params.mail, address: params.address, ship_date: params.ship_date, phone: params.phone, product_id: params.product_id, product_name: params.product_name, username: req.session.user_name, price: params.price.substr(0, params.price.length - 1) } db_products.purchase(cart) .catch(function (err) { return res.json({message: "Product purchased correctly"}); }); /routers/products:89 Token?
  • 45. A8 - CROSS-SITE REQUEST FORGERY (3/6) CROSS-SITE REQUEST FORGERY
  • 46. A8 - CROSS-SITE REQUEST FORGERY (4/6) CROSS-SITE REQUEST FORGERY Buy by GET Request No token
  • 47. A8 - CROSS-SITE REQUEST FORGERY (5/6) CROSS-SITE REQUEST FORGERY - ATTACK
  • 48. A8 - CROSS-SITE REQUEST FORGERY (6/6) CROSS-SITE REQUEST FORGERY - SOLUTION Use POST requests for actions that modifies the system. Use a unique token (CSRF Token) for each requests that modify the system.
  • 49. A10 - UNVALIDATED REDIRECTS AND FORWARDS WEB APPLICATIONS FREQUENTLY REDIRECT AND FORWARD USERS TO OTHER PAGES AND WEBSITES, AND USE UNTRUSTED DATA TO DETERMINE THE DESTINATION PAGES. WITHOUT PROPER VALIDATION, ATTACKERS CAN REDIRECT VICTIMS TO PHISHING OR MALWARE SITES, OR USE FORWARDS TO ACCESS UNAUTHORIZED PAGES. OWASP TOP 10 A10 - UNVALIDATED REDIRECTS AND FORWARDS
  • 50. A10 - UNVALIDATED REDIRECTS AND FORWARDS (1/4) UNVALIDATED REDIRECTS AND FORWARDS router.post('/login/auth', function(req, res) { var returnurl = req.body.returnurl; auth(user, password) .then(function (data) { if (returnurl == undefined || returnurl == ""){ returnurl = "/"; } res.redirect(returnurl); }) /routers/login.js:36
  • 51. A10 - UNVALIDATED REDIRECTS AND FORWARDS (2/4) UNVALIDATED REDIRECTS AND FORWARDS router.post('/login/auth', function(req, res) { var returnurl = req.body.returnurl; auth(user, password) .then(function (data) { if (returnurl == undefined || returnurl == ""){ returnurl = "/"; } res.redirect(returnurl); }) /routers/login.js:36
  • 52. A10 - UNVALIDATED REDIRECTS AND FORWARDS (3/4) UNVALIDATED REDIRECTS AND FORWARDS - ATTACK
  • 53. A10 - UNVALIDATED REDIRECTS AND FORWARDS (4/4) UNVALIDATED REDIRECTS AND FORWARDS - SOLUTION Only allow relative to domain redirection White list for redirections
  • 54. SECURE CODING WITH NODE.JS REFERENCIAS ▸OWASP Top 10: https://www.owasp.org/index.php/Top_10_2013-Top_10 ▸NodeJS Security check list: https://blog.risingstack.com/node-js-security-checklist/ ▸Evil regex: https://www.owasp.org/index.php/Regular_expression_Denial_of_Service_- _ReDoS ▸Detect potentially evil regex: https://github.com/substack/safe-regex