Software Engineering Exercise

You are responsible for a software component for user authentication. Specifically, checking whether a user's password is correct. What factors do you need to consider?

Factors To Consider

This is a modern system, so it needs to be fully multilingual. ASCII is not acceptable.

Password Storage

If the hardware or environment offers some form of secure storage, that can be used to store the sensitive information. Classical multi-user operating systems were designed for scenarios where such secure storage was not generally available, so they typically store salted hashes of the passwords rather than the passwords themselves. This makes it computationally expensive (hopefully infeasible) to determine the stored passwords if the storage medium itself is exfiltrated.

Any beginner-level textbook on software security will cover the specifics of this topic.

Timing Attacks

Any computationally expensive operation (such as encryption and one-way hash functions) can be vulnerable to timing attacks. Most software and the hardware used to execute it are optimized for speed of execution. If an operation can be shown to be unnecessary, it will be skipped. In security applications, this can be a real problem because an attacker can submit many requests with varying data and time how long it takes for the answer to be returned, and use this along with knowledge of the specific algorithm being run to estimate which branches were taken, which can help narrow the search space significantly.

A simple counter is to make the operation always consume the same amount of time regardless of the outcome. For example, set a timer for one second, do the work to check the password, then wait until the timer expires before returning the result.

Advanced security textbooks would certainly cover this topic. Note that this only handles in-process timing attacks, side channel attacks are a separate issue that must be addressed differently.

Multi-Lingual Text

Suppose I want my password to be, "The naïve mice are nice." First, we need to make sure that the string type allows the character that is not simple ASCII. We could specify the API to accept UTF-8 or UCS-2 or something. But that is only the beginning. How do we know whether that "ï" is a precomposed character or created using combining diacritics? While both of those possibilities will render identically in the UI, they are fundamentally different data and will result in a password mismatch even though the user entered the correct sentence with the correct spelling. We are only responsible for the password authentication, the user interface is outside of our control and so we cannot depend on any particular behavior by the UI.

We will need to apply Unicode normalization to the input string for every request, and just provide an effusive apology for any user that enters their password using katakana when the stored password is in hiragana.

Biometrics

Biometrics suck. Never use biometrics for security. No exceptions, no excuses.

To view or add a comment, sign in

More articles by Kent Rosenkoetter

  • The Halting Problem

    Lately I have seen a lot of magical thinking around topics such as artificial intelligence. One that keeps resurfacing…

    5 Comments
  • Analyzing A Security Library

    When I was at Starbucks, there was a piece of “legacy” code that caught my attention. Like many brick-and-mortar…

  • API Comparison

    What makes a good API? One of the key aspects of making a good API is guiding users of the API to use it correctly…

  • Negative-Cost Abstractions

    Spend any amount of time in the C++ community, and you will hear about the idea of a "zero-cost abstraction". C++…

  • Software Estimates

    One of the most pernicious problems in the community of people that write software for a living is the problem of…

    1 Comment
  • Whom = Him. Who = He.

    This is a departure from my normal discussion topic of computer science. Today I want to provide a very simple but very…

  • Why Getters and Setters?

    I was just watching a conference presentation on MISRA C++, and the presenter said something that bothered me so much…

  • The War on Drugs Is Institutional Racism

    A lot of people do not understand the concept of institutional racism. Some sheltered people refuse to believe it…

  • Seeing the Forest Through the Trees

    I do not understand why you are having performance problems with Perforce. We used Perforce when I was at Amazon, and…

  • Thoughts on modern “AI”.

    Everywhere we look we are being bombarded with stories about the amazing things that have been done with AI lately…

Explore content categories