Technology1 min read

CodeSOD: Death of the Auth-Er

By · Published by Everything Blog

In short

The inherited authentication function originally verified user credentials, welcoming valid logins and redirecting failed attempts to the sign-in page. Later modifications systematically broke the route by introducing hard stops after success checks, failure checks, and finally at the function's entry point with a "Hello" output. Although these intrusive termination commands resembled troubleshooting measures, typical debugging relies on print statements rather than widespread hard stops. The neglected function was never cleaned up, leaving disabled code running live for years.

Key points

  • Program-terminating commands frequently used in languages like Perl were improperly deplo…: Program-terminating commands frequently used in languages like Perl were improperly deployed to disrupt the entire authentication process.
  • The disabled authentication function escaped cleanup during development and sat untouched…: The disabled authentication function escaped cleanup during development and sat untouched in a production environment for years.
  • The unusual placement of hard stops resembled an atypical and aggressive troubleshooting…: The unusual placement of hard stops resembled an atypical and aggressive troubleshooting effort rather than standard debugging practices.

Sources checked by our analysis pipeline: 1

When writing Perl, it's not unusual to want to die

. The die

function ends your Perl program with an error string, and you'll often see code like: die "My error" unless $i > 5

or die "Other error" if check()

, because Perl just loves the backwards conditionals. What's even more fun with die

is how it behaves with eval

blocks, so it doesn't always kill your program, sometimes it is how you pass error strings back out of sections of your program.

And poor Bobby has inherited some Perl that just really loves to die

.

public function store()

{

echo 'Hello'; die;

if (Auth::attempt(Input::only('email', 'password')))

{

echo 'done'; die;

// return "welcome ".Auth::user()->username

}

echo "Oops! Fails"; die;

return Redirect::back()->with_input();

}

Bobby didn't send the source control history here, but I have a sense of what it likely was like, once. If they authenticate successfully, print a welcome message. If they don't, redirect back to the logon page and let them try again. I suspect they wanted to disable the route. So first they disabled the success…

Technology