NOTE The /GS switch enables Microsoft??™s implementation of stack canary
protection, which is quite effective in stopping buffer overflow attacks. To
learn about existing vulnerabilities in software (before this feature was
available),we will disable it with the /GS- flag.
C:\grayhat>cl /Zi /GS- meet.c
??¦output truncated for brevity??¦
C:\grayhat>meet Mr Haxor
Hello Mr Haxor
Bye Mr Haxor
Great, now that you have an executable built with debugging information, it??™s time to
install the debugger and see how debugging on Windows compares with the Unix
debugging experience.
NOTE If you use the same compiler flags all the time, you may set the
command-line arguments in the environment with a set command as follows:
C:\grayhat>set CL=/Zi /GSDebugging
on Windows with Windows Console Debuggers
In addition to the free compiler, Microsoft also gives away their debugger. You can download
it from www.microsoft.com/whdc/devtools/debugging/installx86.mspx. This is a
10MB download that installs the debugger and several helpful debugging utilities.
When the debugger installation wizard prompts you for the location where you??™d like
the debugger installed, choose a short directory name at the root of your drive.
Gray Hat Hacking: The Ethical Hacker??™s Handbook
246
The examples in this chapter will assume your debugger is installed in c:\debuggers
(much easier to type than C:\Program Files\Debugging Tools for Windows).
Pages:
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456