Bitpath

Boss lesson · Unit 04

Review a small app

Find, rank and fix the flaws in a login-and-upload service

13 exercisesabout 3 min

What you practise

  • Read a short login-and-upload service, find the flaws (injection, missing authorization, weak hashing, verbose errors, unchecked uploads), rank them, fix them

Try a question from this lesson

Pick one

You are reviewing the login of a small file-sharing service. A reviewer flags two flaws. Which pair?

Python
import hashlib

def md5(s):
    h = hashlib.md5(s.encode())
    return h.hexdigest()

def login(db, name, pw):
    q = ("SELECT id FROM users WHERE "
         "name = '" + name + "' AND "
         "pw_md5 = '" + md5(pw) + "'")
    return db.execute(q).fetchone()
Hint

Follow the name from the request into the query. Then look at how passwords are stored.

The idea

Concept cards are short on purpose. In the app they appear between questions, after you have met the idea.

Concept

Review by following the data

Start where input enters: forms, URLs, headers, uploaded files. Follow each piece to where it ends up: a query, a page, a file path, a shell, an outgoing request.

Then, for every endpoint, ask two questions. Who may call this? On which objects?

Write the findings down and rank them by likelihood and impact before fixing anything.

11 more exercises in the app

  • 2× fill the blanks
  • 5× multiple choice
  • 1× type the answer
  • 1× true or false
  • 1× match the pairs
  • 1× order the lines

Bitpath is an iOS app in development. Join the waitlist and you get one email when it is ready to try.

One email when Bitpath is ready to try. Nothing else. Privacy