whoisjoe.com

Finding Your Inner Evildoer (3/4): A Good Imagination

  

April 16, 2012

Home About Projects Blog LinkedIn ReThink Security

In my previous posts I talked about what an overview of what makes a great security tester, and in depth about what it means to have complete knowledge of the system. If you haven’t read those yet, I suggest you do so now, that’ll help set the stage for the following post.

A great imagination extends beyond the ability to imagine a system as it could be, but extends to envision the truly interesting bugs and vulnerabilities in a system. You need to be able to ask yourself “what’s really going on here?” and “how would I build this”?

Many of our security assessments are performed “blackbox” - without source code or direct access to internal systems. When we approach an assessment we have to make leaps of inference to make educated guesses about how the application is developed and what kinds of mistakes could be made. Ask yourself how you’d develop this solution, and what kinds of mistakes might be made in this type of system.

Take for example an AJAX-enabled Web application. Things that are immediately obvious may be the use of JavaScript, the server language, or the use of SSL. The tester must then imagine what the server topology looks like and ask him/herself a few questions:

  • Are they using Microsoft SQL server or MySQL, or are they storing everything in an XML datastore?
    • If they’re using SQL, are they using Stored Procedures or Parameterized Queries?
    • How can we discover whether this is or is not the case?
    • If it isn’t what assumptions about the system can we make?
  • Where/What is the input checking being done?
    • On the client in JavaScript?
    • On the server?
    • Did they write their own input validation routines or are they relying on controls provided by the language or framework?

There are many other questions that a seasoned security tester will ask to better understand what is going on behind the scenes in this software system. Just as we did earlier, each time we prod the application we will gain some understanding of what’s going on behind the scenes. If there are still questions about what’s going on then we can use our imagination to fill in the gaps and reason about mistakes that could be made. SQL injection is an exceptional example of a vulnerability that requires a creative imagination to be discovered. It’s possible, but usually very difficult to discover the exact SQL query that is used on a system. However with enough poking and prodding we can reconstruct an approximation of the query to understand mistakes and weaknesses that we can use to attack the system further.

Let’s take a login control that requests a username and a password from the user and uses that information to query the database to locate and login the user as an example. What would the SQL look like that would perform this function? A naïve solution would be to simply query the ‘users’ table for the right username and password like this:

 SELECT * FROM users WHERE username = ‘[USERINPUT]’ AND password = ‘[USERINPUT]’

After constructing a hypothesis of the query we can verify the guess against the live system by trying certain inputs in the username and password fields. If the query does follow the form above a simple test like a single quote in a username field will cause an unclosed quotation mark error, which vets our earlier hypothesis. We can use this additional information to construct a more complex SQL injection string that may allow us to read or write arbitrary values in the database.

Without the ability to imagine the SQL statement or the backend architecture of the system, this attack may be missed. Even if a less imaginative tester were to stumble across this vulnerability he/she may miss other vulnerabilities with higher risk. With a good imagination we can think about all the different components and how they may be misconfigured, developed improperly then find and exploit their weaknesses!

Discuss on HackerNews


Security Innovation, the company I work for, is hiring! If you think you’ve got the three qualities I describe above and aren’t completely and utterly excited about the job you currently have come work for us. We have some of the best perks in the industry and you’ll be having as much fun as you’ve ever had at work.

To Apply send an e-mail to [email protected] or try your hand at our challenge website at http://challenge.si.vc if you get stuck on the challenge just send an e-mail to the e-mail address above and we’ll give you a hint. The challenge is supposed to be fun, so have fun with it!

Posted By: Joe Basirico

  • 81 More Posts
  • So, You're a Manager Now
  • A Mixtape in 2022
  • The Middle Path of Planning and Reflection
  • Micromanagement and Trust
  • On Giving Advice
  • Emergency Preparedness During Coronavirus Frenzy
  • Mind Map Your Life
  • Start With the Hard Part
  • Delight in the Details
  • Introducing ReThink Security
  • Newsletter & Recommendations
  • Take a Moment
  • Triage Decision Making
  • Show Your Work
  • Getting Back Up
  • Max Out vs. Continuous Development
  • Mental Diet and Exercise
  • Asking for Help Part 2 - Alerting
  • High Water Mark
  • Who Do You Want to Be
  • Presentation Tips
  • Asking for Help
  • China Hijacking the Internet
  • Recording Audio with AirPods in Imovie
  • Active Decisions
  • Create/Publish Scripts
  • Specialize or Do Not Specialize
  • Exactis Breach
  • Optimizing Images
  • What I Track
  • What I’m Thinking About May
  • What I’m Thinking About March
  • What I’m Thinking About January
  • Building a Collaborative & Social Application Security Program
  • Lazy Days in the Cloud
  • Delegate Then Do
  • So you want to be a better programmer
  • Project Success
  • Don't Short Circuit a Lesson
  • Scale Your Solution to the Problem
  • Digital Currencies
  • Fortnightly
  • Why You Should Have Trust Issues with Pokemon Go, and Every Other App on Your Phone
  • In Defense of Reverse Engineering and Responsible Disclosure
  • Ruby open allows command injection if user controlled
  • New Mac Install Guide
  • Understanding Customer Needs and Helping Them Mature
  • My Experiences with IOS8 and Yosemite so far
  • The Importance of Vulnerability Disclosure Programs and Bug Bounties
  • My New Record Player and Beck - Morning Phase (The Vinyl Experience)
  • An Hour of Code with Code.org
  • Gmail Changes to Displays Images by Default
  • Why I Donated to Help Jailbreak iOS7 & You Should Too
  • Email Strategy
  • Shutdown
  • Anatomy of a Distributed Denial of Service (DDoS) Attack
  • NASA Forced to Suspend All Public Outreach & Education Programs
  • Joe_CMS Open Source!
  • Mobile Application Security Testing FAQs: Post #1
  • How Much Security Does Obfuscation Get You?
  • Why Privacy Matters Even if You Have 'Nothing to Hide'
  • What LinkedIn Should Have Done with Your Passwords
  • Constant Vigilance
  • Boeing Paying Hackers to Break into Their Systems
  • My Reading Cycle
  • Developing Tools for Professional Hackers
  • Finding Your Inner Evildoer (4/4): An Evil Streak
  • Finding Your Inner Evildoer (3/4): A Good Imagination
  • When to Rebuild Your Process from Scratch
  • Finding Your Inner Evildoer (2/4): Complete Knowledge of the System
  • Continuous Incremental, Personal Improvement
  • Finding Your Inner Evildoer: Part 1
  • CISCO Password Revealer
  • Battling with Word and Excel
  • Which is More Secure: Windows or Linux?
  • The High Cost of an Application Security Data Breach
  • Using the ConfigurationManager to Access your ConnecitonStrings in the Web.Config
  • New WikiRater Features
  • When is it OK to Build up Technical Debt
  • Time Management with the Pomodoro Technique
  • Manage Energy Not Time
  • Goals, Results and Activities - defining your productivity
© 2022 whoisjoe.com