Software engineer, team lead at DA-14
Cyber Security - beginning for beginners
NodeJS Vulnerabilities
It's show time (c) Ben Richards
Painkiller
CONTENTS
Okay, now it's secure enough (c) noone ever
CYBER SECURITY - BEGINNING FOR BEGINNERS
Application evolution
Before
Now
CYBER SECURITY - BEGINNING FOR BEGINNERS
What's now
CYBER SECURITY - BEGINNING FOR BEGINNERS
Is this application secure enough?
CYBER SECURITY - BEGINNING FOR BEGINNERS
Is this application secure enough?
CYBER SECURITY - BEGINNING FOR BEGINNERS
User can:
CYBER SECURITY - BEGINNING FOR BEGINNERS
User/Attacker can initiate a process of:
CYBER SECURITY - BEGINNING FOR BEGINNERS
BEFORE WE START
Good developers code; Best developers copy (c) stack overflow
3rd party dependencies
your code
APP
MODERN JAVA SCRIPT APPLICATION
The most guaranteed but time-consuming method to crack a password
BRUTE-FORCE ATTACK
Guess:
Conditions:
BRUTE-FORCE ATTACK
Guess:
Conditions:
Result:
BRUTE-FORCE ATTACK
Guess:
Result:
BRUTE-FORCE ATTACK
Best Practice:
BRUTE-FORCE ATTACK
Painkiller
BRUTE-FORCE ATTACK
DB injection has been around for almost 20 years and is still a big issue
DATABASE INJECTIONS
Examples:
DELETE /users/?id=<userId>
UserModel.remove({ _id: req.query.id });
DATABASE INJECTIONS
UserModel.remove({ _id: { '$exists': true } });
DELETE /users/?id={ '$exists': true }
Examples:
DELETE /users/?id=<userId>
UserModel.remove({ _id: req.query.id });
DATABASE INJECTIONS
Examples:
.find( { $where: "this.<key> == 'a; sleep(1000000)'" } );
.find( { $where: "this.<key> == <value>" } );
DATABASE INJECTIONS
Best Practice:
DATABASE INJECTIONS
DATABASE INJECTIONS
RE implementations may reach extreme situations
REGULAR EXPRESSION DOS
What the hell is the state machine and NFA?
REGULAR EXPRESSION DOS
Regular Expression: ^(a+)+$
Result:
aaaaX - 16 possible paths
aaaaaaaaaaaaaaaaX - 65536 possible paths
REGULAR EXPRESSION DOS
Evil Regular Expressions:
REGULAR EXPRESSION DOS
Painkiller:
Helpers:
REGULAR EXPRESSION DOS
Tracking down memory leaks has always been a challenge
MEMORY LEAKS
heap
stack
resident set
retained size
shallow size
mark-sweep
scavenge
old space
new space
MEMORY LEAKS
Common Reasons:
MEMORY LEAKS
Painkiller:
MEMORY LEAKS
Hooking all asynchronous core methods is definitely possible
HIJACKING THE REQUIRE CHAIN
HIJACKING THE REQUIRE CHAIN
A
B
C
HIJACKING THE REQUIRE CHAIN
A
B
C
D
C
E
HIJACKING THE REQUIRE CHAIN
A
B
C
D
C
E
PATCH
HIJACKING THE REQUIRE CHAIN
HIJACKING THE REQUIRE CHAIN
B
A
D
C
E
C
APPLICATION
CACHED
HIJACKING THE REQUIRE CHAIN
HIJACKING THE REQUIRE CHAIN
Rain Bow Table attack must be weird enough...
RAINBOW TABLE
Theory:
RAINBOW TABLE
RAINBOW TABLE
The fourth letter of your password is wrong, please try again
TIMING ATTACK
TIMING ATTACK
HASH TABLE COLLISION (FLOOD) ATTACK
That moment when you realize we're in trouble
HASH TABLE COLLISION (FLOOD) ATTACK
Hash table?
HASH TABLE COLLISION (FLOOD) ATTACK
Hash table?
HASH TABLE COLLISION (FLOOD) ATTACK
Hash table collision :(
HASH TABLE COLLISION (FLOOD) ATTACK
Hash table collision :(
HASH TABLE COLLISION (FLOOD) ATTACK
Hash table collision :(
HASH TABLE COLLISION (FLOOD) ATTACK
Hash table collision :(
HASH TABLE COLLISION (FLOOD) ATTACK
Hash table collision attack?
HASH TABLE COLLISION (FLOOD) ATTACK
Best Practice:
BEFORE YOU GO
The thing to show I've got for you (c) Yoda parodist
BEFORE YOU GO
// package.json
"config": {
"ghooks": {
"pre-push": "npm test && npm audit",
"pre-commit": "npm run lint"
}
},
Security starts from quality
BEFORE YOU GO
Security starts from quality
May the 4th be with you
BEST PRACTICE
BEST PRACTICE
Let off some steam
HELPFUL MODULES
Rate Limiting
Memory Check
Other
HELPFUL MODULES
Do they speak English in What?
ARTICLES
Security 'musts'
Memory Leak
Require Chain
ARTICLES
*and again I couldn't find a funny meme for this page
roman.sachenko@gmail.com
roman.sachenko
https://twitter.com/rsachenko
https://github.com/roman-sachenko/