6 ways to hack you
CEO at WebbyLab
JS FEST 2019
● CEO at WebbyLab
● 15 years in software development
Why I talk about security?
1. I switched to software development from IT security
2. I work with software engineers for many years and this topic is highly
3. I work with different businesses for many years and risks are highly
4. Governmental regulations (GDPR, PCI DSS etc)
5. It makes you a better software engineer
6. It is FUN!!
What I will talk about?
1. Not about OWASP (Open Web Application Security Project) Top 10 report
2. Not about security tools (metasploit, sqlmap etc)
3. Not about content security policy.
4. Only practical cases that we’ve met in real life.
6. Real cases simulated in environment
a. React frontend
b. NodeJs backend
c. Set of exploits
Let’s play a game
1. I show you a piece of application code with vulnerability.
2. Who sees the vulnerability?
3. I run exploit
4. You guess the exploits algorithm
5. I go through exploit in details
1. Prepare payloads for any object creation and password restore link
2. Send them simultaneously.
3. Use got ObjectId of newly created object as base
4. Increment counters (at first) and timestamp (it is in seconds,+-1 is enough in
5. Use the new object id for password recovery
A lot of frameworks had this vulnerability
ACSII: CHAR “.” = DEC 46 = HEX 2E = %2E (in URL)
Main reason: validate, then escape (should be escape, then validate)
1. Prepare path where do you expect to have sensitive data (configs).
2. Replace dots in relative paths with “%2e”
3. Get configs with JWT keys
4. Create own session for any user
Very popular modules can be vulnerable (11k weekly downloads)
Use npm audit (NODEJS DEVS ARE LUCKY TO HAVE IT)
Check your dependencies
Security is a question of trust
JWT vulnerability example (next slides)
Case 3: Takeaways
1. Prepare zip archive and pack symlink which references server configuration.
2. Upload zip archive to server
3. Download the uploaded file (which is symlink in real). It will return server
4. Create own session using a key from the config
Case 5: Takeaways
IF YOU SEE WYSIWYG, CHECK YOUR CODE FOR XSS
Do not use regex for extracting script tags
Use sanitizer with tags and attrs white-listing
CORS will allow you do cross domain request
XSS worms issues
Case 6: The most popular vulnerability in
Case 6: Takeaways
Know HTML page parsing (inline JS not the same as external JS)
Think about data usage context
Case 7: Takeaways
Think about communication
Get the whole picture
Use HTTPS everywhere
Case 8: Clickjacking
Case 9: Tabnapping
Case 10: CSRF (cookie, basic auth)
Case 11: SQL Injection (pass through ORM)
Case 12: ORM Injection
Case 13: Unsafe HTTPS Redirect
Case 14: Target=_blank (without rel="noopener noreferrer")
Do you know how these things work?
Meltdown and Spectre
Why I like information security?
Information security is about understanding how things work
It makes you a better developer
You can create more complex projects
It is fun!