The Silicon Underground
  Welcome to Dave Farquhar's Silicon Underground Tuesday, November 24 2009 @ 05:01 PM CST  
Theme Changer
Change the look of the site by selecting a theme below:

What's New
STORIES
No new stories

COMMENTS last 48 hrs
No new comments

LINKS last 2 wks
No recent new links

Google Ads

User Functions
Username:

Password:

Don't have an account yet? Sign up as a New User

Firefox


An explanation of buffer overflows   
Tuesday, September 23 2008 @ 08:28 PM CDT
By David L. Farquhar

I'm taking a class for Security+ certification. Today one of the topics we covered was buffer overflows. The textbook explanation was confusing. For that matter I think it was wrong, but I was so confused by the end that I'm not sure.

I'm going to give a simplified example and explanation of a buffer overflow, similar to the one I gave to the instructor, and then to the class.

I drew a diagram on the board of a very simple program. It occupied a single continuous area of memory, divided into three blocks. The top and bottom blocks contained code, while the block somewhere in the middle contained data.

This is an especially bad design, because if you pass the program more data than the data block can hold, you overwrite the code in the bottom block.

That's precisely what a buffer overflow does. Someone wanting to exploit this writes a program that does something bad--perhaps changing the administrator or root password, installing some other software, scrambling data, or formatting a hard drive--and then determines the size of that data buffer. The person then passes that exact amount of data to the program, plus the bad-guy code he wants the system to run.

The bad-guy code overwrites some of the original program's code, so when the program gets to those instructions, instead of doing what it's supposed to do, it runs the bad-guy code instead.

Modern compilers and programming techniques make buffer overflow vulnerabilities a lot rarer than they used to be, but they still happen sometimes. I know that at least once in the last two years, Microsoft had to recall and reissue one of its monthly hotfixes because the hotfix had a buffer overflow vulnerability in it. So at least in theory, a system was more secure without that patch than it was with it. (I had fun trying to explain that to the higher-ups.) So they aren't unheard of.

The textbook gave several remedies to prevent buffer overflows: Use firewalls, disable all unnecessary services and software, and keep all the latest security patches applied (which works unless the patches themselves are flawed).

My favorite remedy, though, is to try not to put Intel/AMD x86 boxes directly on the Internet if I can avoid it. Although many commercial firewalls these days are x86-based, the ideal firewall uses something else. And whenever possible, run things like mail, DNS, and other things that anyone can access on something other than x86. If your client demands Exchange, that's fine. Just set up a Linux box running on something weird (an old PowerPC Macintosh is a good choice, but if you want something newer and more reliable, a Sony Playstation 3 would work well) and configure its SMTP server to forward everything to your Exchange server running inside the firewall.

Yes, I'm saying there's a role in your enterprise for Sony Playstation 3 videogame consoles.

When a script kiddie tries to pass an Intel buffer overflow to a different CPU architecture, the results will be unpredictable, but I can guarantee the overflow won't do what the script kiddie intends, since the Intel instructions are gibberish to a PowerPC or MIPS or ARM or Alpha CPU.

So that's what a buffer overflow is, and a few textbook answers about how to deal with them, plus a real-world solution that isn't likely to find its way into any books any time soon.

  [ Views: 708 ]  


An explanation of buffer overflows | 0 comments | Create New Account
The following comments are owned by whomever posted them. This site is not responsible for what they say.
No user comments.
What's Related
  • More by DaveF
  • More from Software

  • Story Options
  • Mail Story to a Friend
  • Printable Story Format


  • Calendar
    November 2009
    SuMoTuWeThFrSa
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    1
    2
    3
    4
    5
    Click on any day to see postings and events for that date.

    Referrals

    Top 10 by Comments
    Story TitleComments
    Cheap laptops from Sotec 253
    An untrustworthy vendor 164
    Upgrading an eMachine 125
    eMachine upgrade advice 99
    Why I dislike Microsoft 51
    Upgrade diary: Gateway G6-400 35
    And we're live 30
    The day after the Columbia 22
    How to pray 22
    CD-ROM troubleshooting under Windows 9x 20

    Top 10 Read
    Story TitleViews
    eMachine upgrade advice 74352
    Upgrading an eMachine 63104
    How to view a blg file in Windows 2000 50661
    Cheap laptops from Sotec 32806
    Upgrade diary: Compaq Presario 7360 20003
    Upgrade diary: Gateway G6-400 19880
    CD-ROM troubleshooting under Windows 9x 15558
    Finding an open-source alternative to Ghost 14300
    Big trouble 13827
    Salary cap? Baseball needs something 11806

    Topics
    Home
    Apache (2)
    Baseball (63)
    Book reviews (2)
    Business (1)
    Christianity (57)
    Cooking (1)
    Copyright (16)
    Curmudgeonry (1)
    Design (7)
    DOS (6)
    Games (4)
    Genealogy (11)
    General (507)
    Hardware (168)
    Health (13)
    Human Interest (9)
    Humor/Satire (19)
    Investing (4)
    Journalism (1)
    Linux (93)
    Macintosh (22)
    Model Building (3)
    Music (33)
    net.culture (40)
    Personal (88)
    Photography (6)
    Politics (3)
    Retro Computing (26)
    Saving money (72)
    Servers and Networking (18)
    Society (49)
    Software (55)
    Spam (13)
    St. Louis (23)
    This weblog (14)
    Toy trains (74)
    Troubleshooting (7)
    Useless Trivia (1)
    Vendors (6)
    Video (21)
    Viruses (12)
    Windows (120)
    Writing (16)

    Older Stories
    Wednesday 30-Sep
  • 401(K) Paperwork (0)

  • Sunday 27-Sep
  • First impressions: HP Mini 110 (1)

  • Saturday 26-Sep
  • Getting more screen real estate in Firefox (0)

  • Wednesday 23-Sep
  • Barfy. (4)

  • Monday 21-Sep
  • Why I quit my job (2)

  • Saturday 12-Sep
  • Slimming down Windows XP for SSDs and nettops (0)

  • Thursday 10-Sep
  • And... bailing out. (3)

  • Friday 04-Sep
  • End of the innocence (0)

  • Monday 31-Aug
  • Installing Windows off USB (1)

  • Friday 21-Aug
  • Diving into real estate (0)

  • Who's Online
    Guest Users: 9

    Syndicate!
    Get your RSS/RDF fix here.

    List of all stories
    Click here for a list of all the entries on this site


    Created this page in 0.91 seconds


     Copyright © 2009 Dave Farquhar's Silicon Underground
     All trademarks and copyrights on this page are owned by their respective owners.

    Powered by GL 1.3.x