Part A: Conceptual Questions
Answer each question concisely (approx. 150-200 words each). Clarity and the use of specific, real-world examples are key to earning full marks.
Part B: Hands-On Exercises
1. Code Review & Remediation
You are given the following Python Flask snippet:
##
from flask import Flask, request
import pickle
import base64
app = Flask(__name__)
@app.route(‘/unpack’, methods=[‘POST’])
def unpack_data():
data = request.form['data']decoded_data = base64.b64decode(data)# Deserialise the data to reconstruct the objectreconstituted_object = pickle.loads(decoded_data)return "Object deserialised!", 200
if __name__ == ‘__main__’:
(debug=True)
##
(a) Identify: Identify the critical security flaw(s) in this code. State the CWE (Common Weakness Enumeration) identifier if known.
(b) Exploit Description: Describe, with a code example, how an attacker could craft a malicious payload to exploit this flaw.
(c) Fix the Code: Rewrite the /unpack endpoint to securely handle the data. Your solution must use JSON for serialisation and include strict schema validation using a library like Pydantic or Marshmallow. Include comments in your code.
(d) Explanation: Explain why your fix effectively prevents the original vulnerability.
2. Fuzz Testing Lab
A vulnerable Python function is designed to process user-provided strings but contains a flaw.
##
def vulnerable_parser(input_string):
"""A supposedly safe function that processes a string."""# This condition is intended to check for a specific, safe commandif input_string.startswith("SAFE:"): command = input_string[5:] # Get the part after "SAFE:" # Intended to split the command, but has a flaw parts = command.split('|') if len(parts) == 2: # Simulate a command execution (this is a vulnerability) return f"Executing {parts[0]} with arg {parts[1]}"return "Invalid command
##
(a) Set up: Briefly outline the steps to configure a Python fuzzer (e.g., Atheris or pythonfuzz) to fuzz this function. What would be a good initial corpus of test inputs?
(b) Crash Analysis: Suppose the fuzzer reports a crash when the input string is “SAFE:” + “A” * 1000. Hypothesise the type of vulnerability that might be present (e.g., denial-of-service via excessive resource consumption, command injection) and explain why the crash occurs.
(c) Mitigation: Rewrite the vulnerable_parser function to safely handle arbitrary input. Your fix should address the hypothesised vulnerability and include input validation and safe processing logic.
3. CI/CD Security Integration
You are tasked with integrating security checks into an existing GitLab CI/CD pipeline for a Python project.
(a) Static Analysis: Name two open-source Static Application Security Testing (SAST) tools suitable for Python (e.g., Bandit, Semgrep). Justify your choice for one. Then, provide a YAML snippet to integrate one of these tools into a .gitlab-ci.yml file, defining a job named sast.
(b) Dynamic Scanning: Propose how to integrate the fuzzing test from Exercise 2 into the pipeline. Sketch the CI stage definition (YAML snippet) for a job named fuzz-test. Assume the fuzzer is set to run for a fixed duration (e.g., 5 minutes).
(c) Policy Enforcement: Describe how you would configure the sast and fuzz-test jobs to fail the pipeline if any high-severity security issues or crashes are detected, respectively.
Part C: Threat Model & Design Pattern Proposal
Working in teams of 2-3, choose a simple web service (e.g., a file-sharing app, a secure note-taking API, or a user profile manager). Deliver a 2-page maximum report that includes:
Report Guidelines:
Submission Guidelines
Submit your assignment as 2 submissions.
Select your paper details and see how much our professional writing services will cost.
Our custom human-written papers from top essay writers are always free from plagiarism.
Your data and payment info stay secured every time you get our help from an essay writer.
Your money is safe with us. If your plans change, you can get it sent back to your card.
We offer more than just hand-crafted papers customized for you. Here are more of our greatest perks.
Get instant answers to the questions that students ask most often.
See full FAQOur professional writing service focuses on giving you the right specialist so the one assigned will have the knowledge about the right topic. However, if you’ve used our essay service before, you can ask us to assign you the expert writer who used to complete papers for you in the past. We can easily do so if the specialist in question is available at the moment.
If you’re ordering from our essay writing service for the first time, we will assign you a suitable expert ourselves and ensure that your academic essay writer is a pro. Moreover, let us know how complex your assignment is so that we can find the best match for your order.
We’ve hired the best writers in 80+ academic subjects to complete any paper you need. As soon as we hear, “Write my essays,” our support team assigns you the writer who understands your needs and subject.
In case you need to make sure we’ve picked a great specialist to deal with your paper, you can chat with the expert writers directly. We do our best to make sure you’re happy with the writer we’ve selected for you.
We have been selling original essays for more than 15 years. To prove that we are a trustworthy custom essay writing company, we provide quick delivery and a money-back guarantee. If we can’t complete your paper for any reason, we’ll send your money back to the credit card. We want to deliver the finest services, so you can decide if the paper is good enough; from our side, we’ll edit it according to your primary requirements to make the writing perfect. Our online paper writing service is about both giving you the materials you need when you need them and ensuring that your private data is safe. Check out our guarantees to see how we control the quality of your assignment and protect you as a customer.