APPENDIX B
Answer Key

You can participate live in open dialogue online or view the videos afterward to discuss all of the exercises from this book. We don't want to leave you hanging!

Subscribe to the SheHacksPurple Newsletter for invites to the live discussions, newsletter.shehackspurple.ca, and subscribe to the SheHacksPurple YouTube channel to view the videos afterward: youtube.com/shehackspurple.

Chapter 1: Security Fundamentals

  1. Bob sets the Wi-Fi setting on his pacemaker to not broadcast the name of his Wi-Fi. What is this defensive strategy called?

    Security by obscurity

  2. Name an example of a value that could be hardcoded and why. (What would be the motivation for the programmer to do that?)

    Back in the day, the author used to hardcode connection strings for dev, QA, and prod environments so she could switch them when testing. She had no idea the security problems she caused as a dev so many years ago.

  3. Is a captcha usable security? Why or why not?

    No, it is not. Captchas are very difficult for people who are visually disabled to use, and even for fully abled people at times. They are annoying and bothersome as well; users detest them.

  4. Give one example of a good implementation of usable security.

    The password manager called 1Password can also be used as an MFA authenticator, meaning it will generate that code you get and need to enter into a site as an MFA challenge. It automatically copies it to your clipboard as soon as you have entered your username and password, so you can paste it directly in. After you've pasted it and have logged in to the site successfully, it replaces what was previously on the clipboard, in case you needed it. That is usable security. They are trying (and in the author's opinion succeeding) to make MFA challenges less time consuming, less unpleasant, and less error prone. It's still very secure, but much easier for the user.

  5. When using information from the URL parameters do you need to validate that data? Why or why not?

    Data in the URL parameters can easily be changed by the user and is therefore not trustworthy. If the user happens to be in a public café, and your website is not available over HTTPS, an attacker could easily change the parameters in an MITM attack (Man-In-The-Middle or Manipulator-In-The-Middle). There are many other situations that could lead to those inputs being changed, maliciously or even accidentally, that could cause those values to be dangerous to your application. Always validate all input.

  6. If an employee learns a trade secret at work and then sells it to a competitor, this breaks which part(s) of CIA?

    Confidentiality. They will most certainly have violated their terms of employment, any non-disclosure documents they have signed, and very likely the law.

  7. If you buy a “smart” refrigerator and connect it to your home network, then have a malicious actor connect to it and change the settings so that it's slightly warmer and your milk goes bad, which part(s) of CIA did they break?

    Integrity, because the data is still available, and the data may still have remained confidential (and likely the setting was not considered a secret), but changing the setting to an incorrect/damaging setting breaks the pillar of Integrity.

  8. If someone hacks your smart thermostat and turns off your heat, which part(s) of CIA did they break?

    Availability, because your heat is not available to you. Hopefully you don't live in Ottawa, Canada, and if you do, that it's not February!

  9. If a programmer adds an Easter egg (extra code that does undocumented functionality, as a “surprise” for users, which is unknown to management and the security team), does this qualify as an insider threat? If so, why? If not, why not?

    Yes, this is an insider threat. Practical jokes that happen inside your company and only affect those who work there can be fun and playful. Unapproved features or “surprise” functionality is a security team's worst nightmare.

  10. When connecting to a public Wi-Fi, what are some of the precautions that you could take to ensure you are doing “defense in depth”?

    You can ensure you only visit websites via HTTPS, so that your traffic is encrypted. You can use a VPN (virtual private network), which creates a “tunnel” to either a safe network or your work network (usually). You can install antivirus or antimalware on your machine. You could decide to just use your cellular data instead, if you feel the network you are joining may be particularly dangerous (for instance, if the café was in Las Vegas during Def Con).

  11. If you live in an apartment with several roommates and you all have a key to the door, is one of the keys considered to be a “factor of authentication”?

    No. The key identifies you as someone who lives at the apartment, but not which one of you it is. Authentication needs to identify an individual, not a member of a group.

Chapter 2: Security Requirements

  1. List two more potential security requirements for a web application (which are not already listed).

    1) Password resets for users cannot be done more than one time in a 24-hour period.

    2) Each API must connect using its own service account; they cannot share.

  2. List two more potential security requirements for an operating system in a car.

    1) If brakes, airbag, or any engine functionality has been tampered with, send an alert to the user and their designated garage immediately. Do not allow the car to drive until an authorized mechanic has issued an override command.

    2) Each driver of the car must have their own key to identify them, plus another factor of authentication (specifically a thumb print) in order to start the car. All other potential drivers are rejected.

  3. List two more potential security requirements for a “smart” toaster.

    1) Toaster cannot go over X degrees in temperature, if so, issue an alert and issue a shutdown override.

    2) Toaster admin module requires a second factor of authentication in order to override temperature settings to above manufacturer's recommended guidance.

  4. List two more potential security requirements for an application that handles credit cards.

    1) Application must be PCI (Payment Card Industry) compliant.

    2) The database that contains the credit card information must be labeled “confidential,” only one service account (the application's) can access it, unauthorized access attempts are logged and alerted upon, and access to this database is audited manually on a monthly basis.

  5. Which security requirement is the most valuable? Why is it the most valuable one to you and/or your organization?

    I would select “Trust no one: validate (and sanitize if special circumstances apply) all data, even from your own database.” I firmly believe that if every application performed strict input validation, the internet would instantly be a much safer place.

  6. If you had to remove one of the requirements from this chapter from a web app project, which one would it be? Why?

    I would remove HTTPS, because I know the business would put it back in. Browsers will stop users from visiting sites that do not have HTTPS on their sites, and from a business perspective that just will not fly. Thus, I would choose that one.

Chapter 3: Secure Design

  1. When should data be encrypted? (Select all that apply.)
    1. When an API sends data to another API
    2. On a virtual machine that is powered off
    3. When stored in a database
    4. When sent from the server to the browser

    All of them

  2. What are some possible ways that we can ensure the third-party components we use are secure? How can we minimize risk in this area?

    We can either review each one of them manually or use a software composition analysis tool.

  3. Where should you store your application's secrets? How should your application access your secrets?

    Using a secret store to hold your application's secrets is the best way to access and store your secrets safely (credentials, passwords, hashes, connection strings, etc.).

  4. Name three types of “secrets.”

    Credentials (username and password), connection strings, passwords, hashes.

  5. What are some of the potential threats that a mobile banking application would face? Name three threats and rate how likely they are to occur and how damaging they are based on a scale of low, medium, and high.

    1) People will try to log in as someone else by brute forcing credentials.

    Likelihood: High

    Risk: High

    Mitigation to make the risk low: Block after 10 attempts.

    2) Credential stuffing attacks (using stolen/breached credentials).

    Likelihood: High

    Risk: Critical

    Mitigation: Enforce MFA for users, sign up for a service that will alert your company when your user's credentials on other sites have been breached so you can force reset, allow use of password managers and “copy and paste” on password fields, do not force password rotation or security questions.

    3) Users attempting to create race conditions so they can “multiply” their money.

    Likelihood: Low

    Risk: Medium

    Mitigation: Test thoroughly for race conditions and implement “locking” on bank balances while performing such transactions.

  6. Name three threats that could apply to a “smart” car. Rate the threats (low, medium or high) in terms of likelihood and potential damage.

    1) Car operating system crashes, causing the owner to be unable to use their car. Threat to availability.

    Likelihood: Low

    Potential Damage: Very angry users who need to go somewhere but cannot. This would cause harm to the company's reputation.

    2) Car operating system contracts a virus or malware.

    Likelihood: Low

    Potential Damage: Very angry users who need to go somewhere but cannot. Could potentially attempt to ransom the control of the car to the user. This would cause harm to the company's reputation.

    3) Car's GPS data and other data is stolen. Threat to confidentiality.

    Likelihood: Low

    Potential Damage: Harm to company's reputation, potential great harm to the user. If the owner of the car goes to secret military bases, or has a stalker, their whereabouts could be very sensitive information.

  7. Name five different types of security functionality that would potentially be offered in a modern framework.

    1) Authorization

    2) Authentication

    3) Access Control

    4) Anti-CSRF token passing

    5) Input validation functions

Chapter 4: Secure Code

  1. When should you use your own identity on the network (user account) versus a service account? Give two examples for each and explain your reasoning.

    User Account:

    1) To read your email

    2) To access company files and log in to systems to use as an employee

    Service Account:

    1) To access the database from a web application

    2) To access online storage from an API

  2. Explain possible reasons or situations why C and C++ are still widely used in our industry when Rust (a memory-safe language) exists. Try to think of two or more.

    1) Companies don't have the money to re-write everything into a brand-new language just because it will be better for security. Budgets exist for a reason.

    2) Hiring Rust programmers may be more difficult than C/C++.

    3) Not everyone has heard of Rust and its benefits.

    4) “Because that's the way we've always done it.” Which is always the wrong answer, no matter the question.

  3. What is your favorite programming language and/or framework, and why?

    I prefer .Net, because I had the most experience with it, it's well supported, there is tons of documentation available, and it's a very secure framework.

  4. Which programming language and/or framework do you think is the most secure? Why?

    I would select .Net, because 1) I used to work at Microsoft and have first-hand knowledge of how seriously they take security, 2) because it is maintained by a company (rather than volunteers), there is more time and attention dedicated to it and it will never be “dropped” or left unmaintained, and 3) because it is proprietary, which means no one but a Microsoft employee could work on it, unlike open source frameworks. Each employee passes background checks and is given ethics and security training on a regular basis, ensuring the best possible outcome. People working on open source projects are rarely under such scrutiny before they are given access to the code.

    That said, you can still use lots of open source.

  5. Why do we need to protect user sessions?

    An unprotected user session can be “hijacked,” meaning a malicious actor could take it over and use the system as though they are you. With that power they could empty your bank account, order ugly shoes that you don't approve of, or use your Twitter account to ask people to send you bitcoin (but the bitcoin wallet, of course, is theirs, not yours). The possibilities are endless.

  6. If an attacker were able to get a hold of someone else's user session while they are logged in to their online banking, what could the attacker do?

    They can send your money anywhere they want, including to a terrorist group in order to frame you for a crime. A creative malicious actor can do quite a bit of damage in a short amount of time, with your user session.

  7. If you were going to explain the difference between authentication and authorization to a non-technical co-worker, how would you explain it?

    Authentication is a computer verifying you are the real you (and not someone else pretending to be you). Authorization is a computer deciding what you can and cannot do in its systems.

  8. Should C-level executives have special privileges on your network and other computer systems? If so, why? If not, why not? What types of privileges would you give them, if you gave them any?

    C-level executives will often argue that they “deserve” special systems and network access, but often there is no technical reason that they need them. As they are often the targets of spear-phishing campaigns, it is extremely important you apply least privilege to their access. That said, they have the power to fire you, so do the best you can to protect your organization, without getting fired. Explaining the risks to them will definitely help.

  9. Should network system administrators have special privileges on your network and other computer systems? If so, why? If not, why not? What types of privileges would you give them, if you gave them any?

    Network administrators need special privileges in order to perform their job duties. Ideally, they would log in to their email and use the internet with a regular set of credentials (no admin powers) and then use their account(s) with special powers separately. Either by logging in again or using the feature in Windows OS where you can right-click something and say “run as administrator.” They will need access to all network settings and systems, as a bare minimum.

  10. Should help desk employees have special privileges on your network and other computer systems? If so, why? If not, why not? What types of privileges would you give them, if you gave them any?

    Help Desk personnel need special privileges in order to perform their job duties. Ideally, they would log in to their email and use the internet with a regular (non-admin) set of credentials and then use their account(s) with special powers separately. Either by logging in again or using the features in Windows OS where you can right-click something and say “run as administrator.” They would need access to reset user passwords, access control, and quite a bit more in order to perform their job functions.

  11. Your boss tells you that turning on logging and monitoring will cost too much. How do you explain its value and importance from a security perspective? Write a paragraph to convince your boss. Remember to make sure you explain what the potential risk is to the business, in a way your boss can understand (who is a smart, but not overly technical, person). If you speak over your audience's head, you will not pass this question, nor will you convince your boss.

    Dear Boss,

    When we had an incident last month and you asked me to investigate, I could not. There were no logs to look at, and I was unable to explain how our data got onto the dark web; we only knew that it was there. I had received an alert from my application, saying something was wrong, but having no logs, I could not further our investigation. It was very frustrating to not be able to provide you an answer. I want to protect our organization the best I can, and to do that I need to know what happens during an incident, so I can prevent it from ever happening again. With this in mind, I ask you to help me find the budget so that we can turn on logging.

    Thank you,

    The AppSec Team

Chapter 5: Common Pitfalls

  1. Someone on your project team wants to accept serialized objects from an untrusted source. You know this is a bad idea. How do you explain the risk effectively to your teammate? Write down your answer. Be persuasive and clear.

    Dear Teammate,

    I was reviewing your design document and noticed you are going to accept serialized objects from the public and this has me concerned, from a security perspective. Usually when we accept data or anything else from the public, we validate it, scan it, and treat it as though it's radioactive, until proven otherwise. If something is in a serialized state, that means we need to deserialize it in order to start that process. When we deserialize an object it could easily contain an attack within it, and we would have let them right into our network. Insecure deserialization is so scary it's on the OWASP Top Ten; it's very serious. Could we plan a meeting to find a less risky way to get you the data you need? I'm sure we can find a compromise that works for both of us.

    Cheers,

    The AppSec Team

  2. Is the OWASP Top Ten a standard? Yes or no.

    No. It is a great awareness document, a place to start, and an excellent lesson to teach, but it is not a standard.

  3. Name three of the OWASP Top Ten that we already covered in this book, before Chapter 5.

    Cross-Site Scripting, Injection, and Logging. (There are more than three.)

  4. Does the XXE vulnerability apply to JSON? Does it apply to YAML? If so, why? If not, why not?

    No, it only applies to XML. That said, deserialization does apply to JSON, YAML, and even my beloved .Net.

  5. Name an example of a race condition (it does not need to be computer related).

    Starbucks had a great race condition reported to their bug bounty. The security researcher (Egor Homakov) could get unlimited fancy coffee doing several transfers from one card to a second card, at almost the same time. The verification did not create a “lock” on the account balance, so when they all checked at the same time the money had not yet been removed from card #1, allowing many transfers to happen despite the balance on the first card being zero.

  6. Why do we roll back incomplete transactions? Why does that matter? Give an example of when not rolling back an incomplete transaction would be problematic.

    Alice is trying to buy a coffee on a mobile app, but part way through, her cellular signal dies. The steps are: she presses “buy,” it removes the money from her account, it sends the order to the local coffee shop, then it sends a confirmation to her. If she lost signal after it took her money, but before it sent the order, Alice has paid for a coffee but 1) doesn't get the coffee and 2) is unaware they took her money. She only knows that she did not get the coffee. Rolling everything back means the app can tell Alice to order again, and she will only be charged once.

Chapter 6: Testing and Deployment

  1. If you could only choose one type of testing to perform on your application, which type would it be and why?

    User Acceptance Testing. Although this is a book about security, we cannot ignore the fact that the app has to work. Next up would be a security assessment or penetration test, but, ideally, we are able to perform all sorts of testing to ensure the app is in good shape.

  2. Which type of testing do you think would be the fastest? Why?

    Unit testing, because it's automated and made to run fast.

  3. Which type of testing do you think would be the slowest? Why?

    Penetration testing, because it must be thorough.

  4. What types of vulnerabilities would you want to look for in regression testing? Name at least two, and why you chose each one.

    Injection, because it is the most dangerous. XSS, because it is the most pervasive.

  5. Does your workplace have a zero-trust network design? If you don't know the answer, your homework is to find out.

    Only you can answer this.

  6. Does your workplace allow use of a CI/CD pipeline? If you don't know the answer, your homework is to find out.

    Only you can answer this.

  7. In a CI/CD environment, should you implement a Static Application Security Testing (SAST) tool and run a complete scan of all of the code, every time there is a new build? Why? Why not?

    No! SAST is very slow and produces many false positives. Instead choose one of the following: run SAST only on the brand new code or 2) run SAST outside the pipeline, analyze the results yourself, and then put the results into the bug tracker. Try putting secret scanning, SCA, or passive DAST scans into your pipeline instead.

  8. Why is it critical to put all new changes into a code repository?

    If you do not check your code changes into version control, eventually someone else will check in their changes and push to prod and copy over your changes. All your hard work disappears in an instant. Talk about a bad day.

  9. Why do we test integration points between different systems? Is it more or less valuable than testing the rest of each system?

    I believe that integration testing is equally important as testing the system itself. This is because if the systems don't work together, then it will appear to the end user as though it is broken. The end user doesn't usually care why they can't use a system, just that it's broken.

  10. Why do we test databases, even though they aren't publicly accessible?

    Your data is extremely valuable, so of course you need to protect it. Also, your app touches your database, and if your app is not secure your database could still defend itself.

  11. Why do we test APIs, even though they aren't publicly accessible? (This might be a trick question.)

    You need to secure all of your tech, even if it is not public facing, due to insider threats, the possibility of someone getting into the network from the outside, or an insecure system reaching inside the network and contacting your system.

  12. When does it make sense to do a penetration test versus a security assessment of a system? Explain your answer.

    If you have less time, doing a security assessment makes sense. If the system is very delicate, a security assessment might make more sense. If you need to have full validation of your results, if you need to get management's attention, a penetration test is better.

Chapter 7: An AppSec Program

  1. Give one reason why maintaining an up-to-date application inventory is valuable for any organization.

    When an incident happens and the application that was attacked is on the inventory page (in the configuration management DB), you have all the information possible to help you investigate in a timely manner.

  2. Give one example of an alert that your application could give. What type of behavior would cause such an alert, and why is it a problem?

    If a call to an API has a <script> tag in it, you issue an alert because someone is attempting to inject code into your system.

  3. Is testing the most important part of an AppSec program? If so, why? If not, why not?

    Testing is the verification that your efforts to secure your application have been effective (or not). I do not feel it is the most important part to ensure you software is secure, but it does provide evidence that your efforts were effective. It also catches all the things you have missed.

  4. Is it more valuable to buy a RASP or WAF tool (a shield for your application) or to spend that money on ensuring your code is secure? Explain your choice.

    Ensuring your code is secure is always #1. A WAF or RASP is an additional layer of defense.

  5. Describe a type of security incident that would require the assistance of developer. What would be needed of the developer?

    If an application has had an SQL injection attack, we would need to developer to help us fix the bug, get access to the correct logs, and understand what happened.

  6. If you could give software developers one tool to help them, what would it be? Explain your choice.

    DAST, because it's easy to use and finds low-hanging fruit. Specifically, I would choose OWASP Zap because it's free and a great tool.

  7. If you could give developers one learning resource, what would it be? Explain your choice.

    I would give them this book! ;-D

  8. What is the difference between SAST and SCA?

    SAST analyzes the code your team wrote for security issues. SCA looks only at the third-party components (the code you did not write).

  9. What is the difference between SAST and DAST?

    SAST is a static analysis of your code, while DAST is dynamic analysis of your running application.

  10. Set a potential goal for your application security program at your office, a school project, or in a made-up place that you hope to work at some day. What goal did you set? Why did you choose this? How will you measure your progress?

    Only you can answer this.

Chapter 8: Securing Modern Applications and Systems

  1. What does the term shared responsibility mean?

    It means that some of the responsibility in ensuring your cloud instance is yours, and some is your provider/vendor's. It's about who has to do what, so that nothing gets missed.

  2. What is the difference between Infrastructure as a Service (IaaS) and Platform as a Service (PaaS)? Which one(s) do you have to patch and maintain yourself?

    IaaS is a VM provided by a cloud provider that you need to patch and maintain. PaaS is a platform provided by a cloud provider that hosts your app, that you do not need to patch.

  3. Why is there (or is there not) more risk to online storage? Which of the CIA Triad can apply to online storage?

    If you are using online storage, it is likely that it's always Available (CIA). But if it's online, there is more risk that if it's been misconfigured that it could be more easily found in order to be broken into.

  4. Name one new risk that the cloud has that a traditional or on-premises data center does not have.

    You are risking external resources having access and/or control over your systems (the cloud provider employees).

  5. What is the difference between a container, a virtual machine, and a physical server?

    A container is a virtualized, bare-minimum operating system for running one application. A virtual machine is a complete, virtualized operating system, to run one or more applications. A physical server is a machine that can hold one operating system, many operating systems (via virtualization), or many containers.

  6. Name one advantage of Infrastructure as Code.

    If there's a mechanical server failure you can deploy your server OS again in seconds! Also, you can use version control to do change management. There are many, many benefits; try to think of a few more yourself.

  7. Name one advantage of DevOps over Waterfall SDLC.

    Releasing small changes often means you can fix a security bug very quickly. Win!

  8. Which of the modern tooling options sounded most interesting to you? Why?

    Only you can answer this.

  9. Which of the modern tactics sounded most interesting to you? Why?

    Only you can answer this.

  10. After reading this chapter, what do you see missing in your organization? What can you improve, and how can you do it?

    Only you can answer this.

Chapter 9: Good Habits

  1. What are some of the risks of technical debt?

    1) Being so far behind in your version of a framework that you need to re-write your entire app in order to upgrade.

    2) Having everything so far behind that it is near-impossible to release bug fixes.

    3) Having 11 different versions of the same framework released in prod for your programming language, a zero day comes out, and you have no idea which one(s) are vulnerable.

  2. Should you post private information on social media if you only have friends following you?

    Anything that might embarrass or harm you or your loved ones, get you fired, or can be used against you, should not be put on the internet. Data can be leaked or breached, mistakes can happen, and friends can prove untrustworthy. Also: the internet never forgets.

  3. Why are multi-factor authentication adoption rates so low? Name three ways we could increase adoption.

    Adoption rates are low because it's extra work and people are lazy and because most people don't understand how much more it protects them and how much risk they are accepting when they put information online.

    We could increase adoption of MFA by

    1) Making it less complex to implement;

    2) Making it mandatory at work;

    3) Providing user training on its value and how to use it.

  4. Which password manager do you use? (Note: “I don't use one” is the wrong answer here.)

    I use 1Password, but any password manager is better than none.

  5. Which security policy at your office makes it hard to get your job done? Have you spoken to the security team about updating it? Is there a potential compromise that could be made?

    This is something you must answer for yourself. However, an example could be password rotation. It makes it very difficult for the average user to remember their passwords, so they often write them down or use a system of adding a number to the end, which makes the entire situation less-secure.

  6. Name an activity you think might make a good “fire drill.”

    Rolling back a database or application, testing out your Business Continuity (BCP) or Disaster Recovery (DR) plans.

Chapter 10: Continuous Learning

All of the questions in Chapter 10 need to be answered by you.

Good luck!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.159.195