Application Security and Hardening
Geekwise Academy
Week 12 - Secure Development and Testing
Instructors:
Corey Shuman
Slack Channel:
Github Repo:
https://github.com/coreyshuman/GeekwiseApplicationSecurity
Lecture Notes:
http://coreyshuman.github.io/GeekwiseApplicationSecurity/LectureNotes
Table of Contents:
[OWASP Developer Guide](https://github.com/OWASP/DevGuide)
[52% of All JavaScript npm Packages Could Have Been Hacked via Weak Credentials](https://www.bleepingcomputer.com/news/security/52-percent-of-all-javascript-npm-packages-could-have-been-hacked-via-weak-credentials/)
[I’m harvesting credit card numbers and passwords from your site. Here’s how.](https://hackernoon.com/im-harvesting-credit-card-numbers-and-passwords-from-your-site-here-s-how-9a8cb347c5b5)
[Part 2: How to stop me harvesting credit card numbers and passwords from your site](https://hackernoon.com/part-2-how-to-stop-me-harvesting-credit-card-numbers-and-passwords-from-your-site-844f739659b9)
[How to Reduce Risk and Improve Security Around npm](http://nodesource.com/blog/how-to-reduce-risk-and-improve-security-around-npm/)
The Node Security Platform maintains a record of NodeJS plugins with known security issues. It can be installed and run using the following lines:
[Security Fundamentals](https://github.com/OWASP/DevGuide/blob/master/01-Foundations/01-Security%20Fundamentals.md)
[Secure Development Lifecycle](https://github.com/OWASP/DevGuide/blob/master/01-Foundations/04-Secure%20Development%20Lifecycle.md)
[Secure Design Principles](https://github.com/OWASP/DevGuide/blob/master/02-Design/01-Principles%20of%20Security%20Engineering.md)
[OWASP Testing Project](https://www.owasp.org/index.php/OWASP_Testing_Project)
[OWASP Testing Guide v4](https://www.owasp.org/images/1/19/OTGv4.pdf)
Web Application Security Testing Topics:
Areas we will cover in class:
Read in class:
[XSS Game](https://xss-game.appspot.com/)
An important and often overlooked part of the maintenance process is having a system in place to report, manage, and fix vulnerabilities. This includes handling vulnerabilities reported by third parties.
First let's look at how not to do it. These are some examples of terrible vulnerability disclosure and management by companies you know.
[Paneral Bread Leaves User's Data Vulnerable for 8 Months](https://medium.com/@djhoulihan/no-panera-bread-doesnt-take-security-seriously-bf078027f815)
[Uber Concealed Massive Hack](https://www.theguardian.com/technology/2017/nov/21/uber-data-hack-cyber-attack)
The keys to properly managing vulnerability reports are the following:
If there is no process in place, it is easy for reported vulnerabilities to slip through the cracks and remain unfixed. Who do the reports go to? Who will verify the issue? Who is responsible for fixing the vulnerability? These are the questions your organization should have clear answers to.
Often the most challenging aspect for a user to report a vulnerability is finding an appropriate point of contact in the organization. It is important to have clear and obvious contact information for reporting vulnerabilities. Furthermore, it is important to follow up and acknowledge when a report has been received.
Additionally, add a [security.txt](https://securitytxt.org/) file to your website.
[Handling Security Reports](https://www.cio.com/article/3157698/security/how-to-handle-security-vulnerability-reports.html)
A responsible organization will disclose breaches to protect their user's data and interests. The following process will help your be ready in the case of a breach.
[OWASP: Vulnerability Disclosure Cheat Sheet](https://www.owasp.org/index.php/Vulnerability_Disclosure_Cheat_Sheet)
[Data Breach Disclosure 101](https://www.troyhunt.com/data-breach-disclosure-101-how-to-succeed-after-youve-failed/)
Determine the scope of security in your organization, have a process, and have a point of contact.
Have a [Disclosure Policy](https://www.hackerone.com/blog/Vulnerability-Disclosure-Policy-Basics-5-Critical-Components).
Here is a disclosure [Example](https://responsibledisclosure.nl/en/).
Document every step in the process of identifying, exploiting, and fixing a vulnerability.
[How to Write a Good Vulnerability Report](https://support.hackerone.com/hc/en-us/articles/211538803-Step-by-Step-How-to-write-a-good-vulnerability-report)
[Austrailian Red Cross](http://www.donateblood.com.au/media/news/blood-service-apologises-donor-data-leak)
[Other Examples](https://blog.cyberint.com/our-favorite-examples-of-how-ceos-respond-to-cyber-breaches)
To wrap up our time together, let's dig in a little more into web server hacking. In particular, we will practice acquiring shell access to a target machine.
[How I Hacked 40 Websites in 7 Minutes](https://hackernoon.com/how-i-hacked-40-websites-in-7-minutes-5b4c28bc8824)
via [Infosec Institute](http://resources.infosecinstitute.com/icmp-reverse-shell/): A reverse shell is a type of shell in which the target machine communicates back to the attacking machine. The attacking machine has a listener port on which it receives the connection, allowing code or command execution to be achieved.
[Reverse Shell Cheatsheet](http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet)
[Simple Reverse Shells](https://blog.ropnop.com/upgrading-simple-shells-to-fully-interactive-ttys/)
Here we will simulate creating and connecting to a Reverse Shell. In this case, we will be doing everything on the same machine. In a real-world scenario, you would be connecting to a victim machine's shell.
Start a Kali Linux docker image.
Make sure Netcat is installed.
Open a second terminal and connect to the Kali Linux container.
In one of the terminals, use Netcat to listen for connections on port `4444`. This represents your local machine.
In the second terminal, establish a reverse shell connection to your local machine.
**Challenge:** Try using one of the methods in the [Reverse Shell Cheatsheet](http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet) to establish your connection.
**Most Important Rule:** Don't access or attack someone else's property without their express permission! It is illegal!
Obviously, this makes reporting vulnerabilities a dubious proposition, especially if you've come accross them by chance.
[Penetration Testing by the Letter of the Law](https://www.securitymagazine.com/articles/88489-penetration-testing-by-letter-of-the-law)
[Legal Issues in Penetration Testing](https://securitycurrent.com/legal-issues-in-penetration-testing/)
[Troy Hunt](https://www.troyhunt.com/)
[Have I Been Pwned](https://haveibeenpwned.com/)
[Brian Krebs](https://krebsonsecurity.com/)
[Top Security Blogs 2018](https://onlinedegrees.sandiego.edu/top-cyber-security-blogs-websites/)