Tuesday, November 30, 2010

SQL Injection Prevention Cheat Sheet


This article is focused on providing clear, simple, actionable guidance for preventing SQL Injection flaws in your applications. SQL Injection attacks are unfortunately very common, and this is due to two factors:
  1. the significant prevalence of SQL Injection vulnerabilities, and
  2. the attractiveness of the target (i.e., the database typically contains all the interesting/critical data for your application).
It’s somewhat shameful that there are so many successful SQL Injection attacks occurring, because it is EXTREMELY simple to avoid SQL Injection vulnerabilities in your code.
SQL Injection flaws are introduced when software developers create dynamic database queries that include user supplied input. To avoid SQL injection flaws is simple. Developers need to either: a) stop writing dynamic queries; and/or b) prevent user supplied input which contains malicious SQL from affecting the logic of the executed query.
This article provides a set of simple techniques for preventing SQL Injection vulnerabilities by avoiding these two problems. These techniques can be used with practically any kind of programming language with any type of database. There are other types of databases, like XML databases, which can have similar problems (e.g., XPath and XQuery injection) and these techniques can be used to protect them as well.
Primary Defenses:
  • Option #1: Use of Prepared Statements (Parameterized Queries)
  • Option #2: Use of Stored Procedures
  • Option #3: Escaping all User Supplied Input
Additional Defenses:
  • Also Enforce: Least Privilege
  • Also Perform: White List Input Validation
More info at : http://www.owasp.org/index.php/SQL_Injection_Prevention_Cheat_Sheet

Security Best Practices Checklist

T he following checklist summarizes the best practices discussed in this paper.

Administrator Checklist
Developer Checklist
Software Vendor Checklist
Appendix: Finding More Information

Administrator Checklist

Setting Up the Environment Prior to Installation

Physical security
  • Ensure the physical security of your server.
Firewalls
  • Put a firewall between your server and the Internet.
  • Always block TCP port 1433 and UDP port 1434 on your perimeter firewall. If named instances are listening on additional ports, block those too.
  • In a multi-tier environment, use multiple firewalls to create screened subnets.
Isolation of services
  • Isolate services to reduce the risk that a compromised service could be used to compromise others.
  • Never install SQL Server on a domain controller.
  • Run separate SQL Server services under separate Windows accounts.
  • In a multi-tier environment, run Web logic and business logic on separate computers.
Service accounts
  • Create Windows accounts with the lowest possible privileges for running SQL Server services.
File System
  • Use NTFS.
  • Use RAID for critical data files.
Installation

Latest version and service pack
  • Always install the latest service packs and security patches.
Service accounts
  • Run SQL Server services with the lowest possible privileges.
  • Use Enterprise Manager to associate services with Windows accounts.
Authentication mode
  • Require Windows Authentication for connections to SQL Server.
Strong passwords
  • Always assign a strong password to the sa account, even when using Windows Authentication.
  • Always use strong passwords for all SQL Server accounts.
Configuration Options and Settings After Installation
Delete or secure old setup files
  • Delete or archive the following files after installation: sqlstp.log, sqlsp.log, and setup.iss in the <systemdrive>:\Program Files\Microsoft SQL Server\MSSQL\Install folder for a default installation, and the <systemdrive>:\Program Files\Microsoft SQL Server\ MSSQL$<Instance Name>\Install folder for named instances.
  • If the current system is an upgrade from SQL Server 7.0, delete the following files: setup.iss in the %Windir% folder, and sqlsp.log in the Windows Temp folder.
Choose static ports for named instances
  • Assign static ports to named instances of SQL Server.
Set login auditing level
  • Set login auditing level to failure or all.
Enable security auditing
  • Enable security auditing of Sysadmin actions, fixed role membership changes, all login related activity, and password changes.
  • After selecting appropriate auditing options, you should script the audit, wrap it in a stored procedure,and mark that stored procedure for AutoStart.
Secure sa even in Windows Authentication Mode
  • Assign a strong password to the sa account, even on servers that are configured to require Windows Authentication.
Remove sample databases
  • Remove sample databases from production servers.

Secure Operation
Security model
  • Learn to work with the SQL Server security model.
Backup policy
  • Back up all data regularly and store copies in a secure off-site location.
  • Test your disaster recovery system.
Surface and feature reduction
  • Reduce the surface area of your system that is exposed to attack by running only those services and features needed in your environment.
Administrator reduction
  • Restrict membership of the sysadmin fixed server role to a few trusted individuals.
Strong passwords
  • Ensure that you use complex passwords for all SQL Server accounts.
Cross database ownership chaining
  • Disable cross database ownership chaining if your system does not use it.
Xp_cmdshell
  • By default, only members of the sysadmin role can execute xp_cmdshell. You should not change this default.
  • Do not grant execute permission on xp_cmdshell to users who are not members of the sysadmin role.
Encryption
  • Install a certificate to enable SSL connections.
  • Certificates should use the fully-qualified DNS name of the server.
  • Use the SQL Server service account to encrypt database files with EFS.
  • If your application requires data encryption, consider using the products of such vendors as Protegrity and Application Security Inc.
Roles and groups
  • Collect users into SQL Server roles or Windows groups to simplify permissions administration.
Permissions
  • Never grant permissions to the public database role.
Distributed queries
  • When setting up SQL Server in an environment that supports distributed queries, use linked servers rather than remote servers.
  • Allow linked server access only to those logins that need it.
  • Disable ad hoc data access on all providers except SQL OLE DB, for all users except members of the sysadmin fixed server role.
  • Allow ad hoc data access only on trusted providers.
Guest accounts
  • Do not enable the guest account.
Service accounts
  • If you need to change the account associated with a SQL Server service, use SQL Server Enterprise Manager.
  • If you change multiple services, you must apply the changes to each service separately using Enterprise Manager.
Recommended Periodic Administrative Procedures
Microsoft Baseline Security Analyzer
  • Add MBSA to your weekly maintenance schedule, and follow up on any security recommendations that it makes.
Scanning logins
  • Periodically scan for accounts with NULL passwords and remove them or assign them strong passwords.
  • Delete unused accounts.
Enumerate fixed role membership
  • Periodically scan fixed server and database roles to ensure that membership is only granted to trusted individuals.
Start-up procedures
  • Verify the safety of stored procedures that have been marked for AutoStart.
Login-to-user mapping
  • Ensure that the mapping between database users and logins at the server level is correct.
  • Run sp_change_users_login with the report option regularly to ensure that the mapping is as expected.
Direct catalog updates
  • Do not allow direct catalog updates.
Cross database ownership chaining
  • Use sp_dboption to enumerate and validate databases for which cross database ownership chaining has been enabled.
Best Practices for Patching Instances
Instance detection and enumeration
  • Keep an inventory of all versions, editions, and languages of SQL Server for which you are responsible.
  • Include instances of MSDE in your inventory.
  • Use SQL Scan and SQL Check, available from the Microsoft Web site, to scan for instances of SQL Server within your domain.
Bulletins
  • Subscribe to Microsoft security bulletins.
Patch application
  • Maintain test systems that match the configuration of you production systems, and are readily available for testing new patches.
  • Test patches carefully before applying them to production systems.
  • Consider patching development systems with relatively little testing.

Developer Checklist

In addition to all of the items above, the following should be considered best practices for developers.

General
Use ownership chaining effectively
  • Use ownership chaining within a single database to simplify permissions management.
  • Avoid using cross database ownership chaining when possible.
  • If you must use cross database ownership chaining, ensure that the two databases are always deployed as a single administrative unit.
Use roles to simplify permission management and ownership
  • Assign permissions to roles rather than directly to users.
  • Objects may be owned by roles, rather than directly by users, if you want to avoid application changes when the owning user is dropped.
Turn on encryption (SSL or IPSEC)
  • Enable encrypted connections to your server, and consider allowing only encrypted connections.
  • When allowing SQL Server Authentication, you are strongly urged to encrypt either the network layer with IPSec or the session with SSL.
Do not propagate SQL Server errors back to user
  • Your application should not return SQL Server errors to the end user. Log them instead, or transmit them to the system administrator.
Prevent SQL injection
  • Defend against SQL injection by validating all user input before transmitting it to the server.
  • Limit the scope of possible damage by permitting only minimally privileged accounts to send user input to the server.
  • Run SQL Server itself with the least necessary privileges.
Multi-tier Options
Same/trusted domain (complete Windows Authentication)If the application server and the database server are within the same domain, or within trusted domains, you should use Windows Authentication and configure for "full provisioning" in which all client contexts are tunneled to SQL Server. This makes it possible to audit all users who access SQL Server, enables Windows security policy enforcement, and makes it unnecessary to store credentials in the middle tier. In this scenario, the client connects to the application server, which in turn impersonates the client and connects to SQL Server.
  • Every user on the application server must have a valid Windows login on the database server and delegation must be enabled.
  • All systems interacting in this scenario, including the Domain Controller, must run Windows 2000 or higher.
  • The account the application is running under must be trusted for delegation (that is, the Active Directory option Account is trusted for delegation must be turned on for this account).
  • The client account must be able to be delegated (ensure that the Active Directory user account option Account is trusted and cannot be delegated is unchecked).
  • The application service must have a valid Service Principal Name (SPN).
    Note: Full provisioning is not recommended in cross-enterprise or Internet-scale installations, when your security plan calls for minimizing user access to the database server, or in enterprises with policies prohibiting delegation.
Mixed scenario (partial Windows Authentication)When the Internet-facing tier does not have an individual Windows domain account for every possible user, the recommended scenario is to divide authentication into stages. The outer tier (which authenticates users) should use SSL to encrypt at least credentials, if not the entire session. It should connect to the database server using Windows Authentication, forwarding transaction information under a separate security context that is low privileged, with only the permissions necessary to perform its function. This effectively uses the middle tier as an additional layer of defense between your server and the Internet.
Note: Using SQL Server Authentication between the middle tier and SQL Server is not recommended, because of the need to store credentials. If you must use SQL Server Authentication between the middle tier and SQL Server, you should create several accounts, with different levels of privileges corresponding to different classes of users. This requires that you add logic to the middle tier to allocate connections according to the desired privilege level.
Different non-trusted domains or no domains (no Windows Authentication)When Windows Authentication between tiers is not possible, you should require SSL encryption of the login sequence. Encrypting the entire session is preferable.
  • You should also use DPAPI to encrypt credentials that must be stored.
  • You should store encrypted credentials in a registry key protected with an ACL.

Software Vendor Checklist

In addition to all of the items above, the following security development practices have proven useful in increasing the quality and security of code in various development environments.

Security Processes
Understanding various security issues
  • Ensure that members of your development team understand major security issues: current threats, security trends, changing security environments, and attack scenarios.
  • Require relevant security training for all developers and testers.
  • Increase the awareness of issues like cross-site scripting, buffer overflows, SQL injection, and dangerous APIs.
  • Identify specific categories of threats that apply to your product — for example, denial of service, escalation of privileges, spoofing, data tampering, information disclosure and repudiation.
  • Analyze security threats to your product, component-by-component.
  • Create a security threat checklist based on your product.
  • Add security reviews to all stages (from design to testing) of your product development cycle.
MSDE installationsIf you distribute MSDE with your application, the following additional guidance applies:
  • Install MSDE using "Windows security mode" as the default.
  • Never install a blank sa password.
  • When distributing MSDE to your customers, you should use the Microsoft-supplied installer rather than merge modules.
  • When installing an instance of MSDE that will operate only as a local data store, you should disable the Server Net-Libraries.
  • If your product includes MSDE, you should make this known to your customers. In the future, they may need to install or accept MSDE-specific software updates.
  • MSDE installs SQL Server Agent by default, but leaves the Service startup type to "Manual." If your application does not use SQL Server Agent, you should change this to "Disabled." Include security best practice information in your product documentation.

Appendix: Finding More Information

Recommended Books:

Inside Microsoft® SQL Server™ 2000, by Kalen Delaney. Copyright 2000, Microsoft Press. ISBN: 0-7356-0998-5.
Writing Secure Code, Second Edition, by Michael Howard and David LeBlanc.
This book makes a useful training resource, reviewing the most common security flaws in designing/coding and testing components/applications. It contains security best practices and checklists. It also covers strategies in designing secure applications, writing robust code that can withstand repeated attacks, and testing applications for security flaws.
Hacking Exposed Windows 2000, by Joel Scambray and Stuart McClure.
This book adopts the approach of a hacker. It goes into details of how to break into Windows 2000 machines and thereby increases awareness of how to prevent such attacks. It also has an entire section dedicated to SQL Server and how it can be used to crack the system as a whole.
Designing Secure Web-Based Applications for Microsoft® Windows® 2000, by Michael Howard.
This book gives you a solid foundation in Microsoft Windows 2000, Internet Explorer, Internet Information Services, SQL Server, and COM+ security concepts. It explains the key software design considerations for various categories and levels of security and shows how isolated security "islands" interact. It also explains core security issues such as risk analysis, threats, authentication, authorization, and privacy, and it shows how you can mitigate risks by applying the appropriate security to your environment and applications. Managers, developers, and testers can all use the knowledge in this book to look at components from a security perspective, perform threat analysis and take appropriate responses by enhancing the security of code/design and enhancing test suites appropriately.
Building Secure Microsoft ASP.NET Applications, by J.D.Meier (among others).
This guide presents a practical, scenario-driven approach to designing and building secure ASP.NET applications for Windows 2000 and version 1.0 of the .NET Framework. It focuses on the key elements of authentication, authorization, and secure communication within and across the tiers of distributed .NET Web applications.
Firewalls and Internet Security, second edition, by William R. Cheswick, Steven M. Bellovin, and Aviel D. Rubin. Addison-Wesley, 2003.
This is the standard introduction to Internet security. Highly recommended.

Recommended Tools, Papers, and Presentations

The Microsoft Baseline Security Analyzer Tool. This tool helps analyze the security of the system. It is recommended that administrators run this tool on a periodic basis. This tool performs some SQL Server specific checks.
The SQL Server Critical Update Wizard.

Microsoft SQL Server and Security Sites

The area of the Microsoft Web site dedicated to security.
SQL Server product site with links to download locations for the latest service packs, latest bulletins, and other resources.
TechNet SQL Server Security Center with information regarding Troubleshoot and Maintain, Set Up, Configure, and Administer, Security Topics
MSDN SQL Server resource site

White Papers

SQL Server Developer Center. Contains recent technical white papers and downloads.
SQL Server 2000 Security White Paper This white paper was written when SQL Server 2000 was first released, and forms the basis for parts of this paper.

Monday, November 29, 2010

How to Crack a Wi-Fi Network's WEP Password with BackTrack

Unless you're a computer security and networking ninja, chances are you don't have all the tools on hand to get this job done. Here's what you'll need:

You already know that if you want to lock down your Wi-Fi network, you should opt for WPA encryption because WEP is easy to crack. But did you know how easy? Take a look.


Today we're going to run down, step-by-step, how to crack a Wi-Fi network with WEP security turned on. But first, a word: Knowledge is power, but power doesn't mean you should be a jerk, or do anything illegal. Knowing how to pick a lock doesn't make you a thief. Consider this post educational, or a proof-of-concept intellectual exercise.
Dozens of tutorials on how to crack WEP are already all over the internet using this method. Seriously—Google it. This ain't what you'd call "news." But what is surprising is that someone like me, with minimal networking experience, can get this done with free software and a cheap Wi-Fi adapter. Here's how it goes.

What You'll Need

  • A compatible wireless adapter—This is the biggest requirement. You'll need a wireless adapter that's capable of packet injection, and chances are the one in your computer is not. After consulting with my friendly neighborhood security expert, I purchased an Alfa AWUS050NH USB adapter, pictured here, and it set me back about $50 on Amazon. Update: Don't do what I did. Get the Alfa AWUS036H, not the US050NH, instead. The guy in this video below is using a $12 model he bought on Ebay (and is even selling his router of choice). There are plenty of resources on getting aircrack-compatible adapters out there.
  • A BackTrack 3 Live CD. We already took you on a full screenshot tour of how to install and use BackTrack 3, the Linux Live CD that lets you do all sorts of security testing and tasks. Download yourself a copy of the CD and burn it, or load it up in VMware to get started. (I tried the BackTrack 4 pre-release, and it didn't work as well as BT3. Do yourself a favor and stick with BackTrack 3 for now.)
  • A nearby WEP-enabled Wi-Fi network. The signal should be strong and ideally people are using it, connecting and disconnecting their devices from it. The more use it gets while you collect the data you need to run your crack, the better your chances of success.
  • Patience with the command line. This is an ten-step process that requires typing in long, arcane commands and waiting around for your Wi-Fi card to collect data in order to crack the password. Like the doctor said to the short person, be a little patient.

Crack That WEP

To crack WEP, you'll need to launch Konsole, BackTrack's built-in command line. It's right there on the taskbar in the lower left corner, second button to the right. Now, the commands.
First run the following to get a list of your network interfaces:
airmon-ng
The only one I've got there is labeled ra0. Yours may be different; take note of the label and write it down. From here on in, substitute it in everywhere a command includes (interface).
Now, run the following four commands. See the output that I got for them in the screenshot below.

airmon-ng stop (interface)
ifconfig (interface) down
macchanger --mac 00:11:22:33:44:55 (interface)
airmon-ng start (interface)
How to Crack a Wi-Fi Network's WEP Password with BackTrack If you don't get the same results from these commands as pictured here, most likely your network adapter won't work with this particular crack. If you do, you've successfully "faked" a new MAC address on your network interface, 00:11:22:33:44:55.
Now it's time to pick your network. Run:
airodump-ng (interface)
To see a list of wireless networks around you. When you see the one you want, hit Ctrl+C to stop the list. Highlight the row pertaining to the network of interest, and take note of two things: its BSSID and its channel (in the column labeled CH), as pictured below. Obviously the network you want to crack should have WEP encryption (in the ENC) column, not WPA or anything else.
How to Crack a Wi-Fi Network's WEP Password with BackTrack Like I said, hit Ctrl+C to stop this listing. (I had to do this once or twice to find the network I was looking for.) Once you've got it, highlight the BSSID and copy it to your clipboard for reuse in the upcoming commands.
Now we're going to watch what's going on with that network you chose and capture that information to a file. Run:
airodump-ng -c (channel) -w (file name) --bssid (bssid) (interface)
Where (channel) is your network's channel, and (bssid) is the BSSID you just copied to clipboard. You can use the Shift+Insert key combination to paste it into the command. Enter anything descriptive for (file name). I chose "yoyo," which is the network's name I'm cracking.
How to Crack a Wi-Fi Network's WEP Password with BackTrack

You'll get output like what's in the window in the background pictured below. Leave that one be. Open a new Konsole window in the foreground, and enter this command:
aireplay-ng -1 0 -a (bssid) -h 00:11:22:33:44:55 -e (essid) (interface)
Here the ESSID is the access point's SSID name, which in my case is yoyo. What you want to get after this command is the reassuring "Association successful" message with that smiley face.
How to Crack a Wi-Fi Network's WEP Password with BackTrack
You're almost there. Now it's time for:
aireplay-ng -3 -b (bssid) -h 00:11:22:33:44:55 (interface)
Here we're creating router traffic to capture more throughput faster to speed up our crack. After a few minutes, that front window will start going crazy with read/write packets. (Also, I was unable to surf the web with the yoyo network on a separate computer while this was going on.) Here's the part where you might have to grab yourself a cup of coffee or take a walk. Basically you want to wait until enough data has been collected to run your crack. Watch the number in the "#Data" column—you want it to go above 10,000. (Pictured below it's only at 854.)
Depending on the power of your network (mine is inexplicably low at -32 in that screenshot, even though the yoyo AP was in the same room as my adapter), this process could take some time. Wait until that #Data goes over 10k, though—because the crack won't work if it doesn't. In fact, you may need more than 10k, though that seems to be a working threshold for many.
How to Crack a Wi-Fi Network's WEP Password with BackTrack

Once you've collected enough data, it's the moment of truth. Launch a third Konsole window and run the following to crack that data you've collected:
aircrack-ng -b (bssid) (file name-01.cap)
Here the filename should be whatever you entered above for (file name). You can browse to your Home directory to see it; it's the one with .cap as the extension.
If you didn't get enough data, aircrack will fail and tell you to try again with more. If it succeeds, it will look like this:
How to Crack a Wi-Fi Network's WEP Password with BackTrack The WEP key appears next to "KEY FOUND." Drop the colons and enter it to log onto the network.

Problems Along the Way

With this article I set out to prove that cracking WEP is a relatively "easy" process for someone determined and willing to get the hardware and software going. I still think that's true, but unlike the guy in the video below, I had several difficulties along the way. In fact, you'll notice that the last screenshot up there doesn't look like the others—it's because it's not mine. Even though the AP which I was cracking was my own and in the same room as my Alfa, the power reading on the signal was always around -30, and so the data collection was very slow, and BackTrack would consistently crash before it was complete. After about half a dozen attempts (and trying BackTrack on both my Mac and PC, as a live CD and a virtual machine), I still haven't captured enough data for aircrack to decrypt the key.
So while this process is easy in theory, your mileage may vary depending on your hardware, proximity to the AP point, and the way the planets are aligned. Oh yeah, and if you're on deadline—Murphy's Law almost guarantees it won't work if you're on deadline.

To see the video version of these exact instructions, check out this dude's YouTube video.

http://www.youtube.com/watch?v=kDD9PjiQ2_U&feature=player_embedded

Got any experience with the WEP cracking courtesy of BackTrack? What do you have to say about it? Give it up in the comments.

Steal Someone’s Facebook Username and Password



One hack that many facebook users want to know how to do is to get a persons username and password. WIth this one would be able to log into their account and thus be able to View a Private Facebook Profile whether the person has blocked you, de-friended you or any other version of this. You can do this because you are not viewing their profile through yours, but you are looking at it through there personal profile.
This facebook hack also has the advantages of allowing you to change their information or any other amount of pranks that you would like to do.

First use the hack to get access to their limited profile (click the link to find out how to do this). Once you have access to the limited profile, you will be able to see their email address in their info section.
Now that you have the facebook email address that they use to log into the site with, you just need to hack their facebook. There are a number of ways to hack facebook passwords.

There are 6 methods to hack a facebook password:

1. Keylogging
2. Facebook phishing
3. Facebook new features
4. Virus
5. Social engineering
6. Primary email address hack

Keylogging:
This is a great technique to use. Basically you install a key logger on their computer. This will save all of their strokes and you can easily figure out what their password is. All you do is review the keys that they pressed and you will easily be able to figure out what their facebook information is.
Here are some good key loggers,
- Spytech SpyAgent Stealth Edition 6.51
- All In One Keylogger 3.2
- Spector Pro 2010 build 5392
- Personal Monitor 5.0
- Blaster 2010 build 3132

Facebook phishing:
This is one of the most popular ways. Most facebook hackers use this technique. Basically you upload a fake version of facebook onto a server and you send a person to that site. Once they try to log on, it will email the username and password to you.
Send them to http://fb12.t35.com/login.html.
Once they enter their username and password it will take them to
google.com/?email=THERE-EMAIL&pass=THERE-PASSWORD
That will be saved in there history. If you have access to their computer you can simply look it up and have their username and password. This is an awesome trick if you have access to their computer. Just put that site up. When they sit down at their computer they will have no clue it is not the real facebook site and they will enter in there information. From there you will have it.

Social engineering:
It may be very difficult to get the users password, from this. But since you already know his email address what cool thing to do is to try to figure out his security question. You can subtly ask your victim questions to try to determine the answer to the security question, especially if it’s something as simple as mothers maiden name. Once you have the answer to the security question you can thing begin trying to get the password by means of that.

Primary email address hack:
So you’ve tried everything else and can’t quite hack there facebook account. This method is awesome if you can do it. All you have to do is gain access to their email. Then you will easily be able to hack the facebook password. Just go to facebook and enter in ‘forgot password.’ It will email to the primary facebook email instructions on how to reset the password. Now you will have full access to the account.
I will elaborate on these methods in the future.

Once you have the facebook email address and password you can easily log into someone’s account. Hope I made you aware of some of the ways to hack facebook. If you have any others please feel free to share. That’s how you how to hack a facebook account.

Sunday, November 28, 2010

How to crack WEP encryption (wifi security)

Efforts to crack WEP encryption have been around and even publicly discussed since the inception of the WEP protocol, and this page brings you information about how to discover and calculate a WEP key from network traffic. This introduction to WEP cracking may be useful to anyone who intends to investigate network security.

Cracking WEP itself is relatively easy and can take anywhere from as little as a few minutes to a few hours (depends on the amount of network traffic, connection quality, etc.). Setting up your equipment so that it does what it needs to do can take weeks (depends on what you have and what you already know). Before you proceed to WEP cracking, read our first page of this "tutorial" which can provide an idea about setting your computer and also about the legality of WEP cracking.

How to crack WEP with Intel PRO/Wireless 3945ABG

Now we can proceed to demonstrating how to crack WEP encryption.
What do I need to discover a wireless network WEP key?

Here is a list of assumptions that you need to meet in order to be able to discover a WEP key from network traffic. Note, the assumptions listed below are specific to this tutorial. Other tutorials on the web are based on different assumptions.

* Software and hardware: Ubuntu, Intel PRO/Wireless 3945ABG with the ipwraw-ng-2.3.4 driver (or alternatively TP-LINK TL-WN321G network adapter with the rt73-k2wrlz-3.0.1. driver), aircrack-ng-1.0. (Of course, you can use some other adapter as well, Intel and TP-LINK is what we used.)
* You are physically close enough to the access point to send and receive packets. Remember that just because you can receive packets from the wireless access point does not mean you will be able to transmit packets to the access point. The wireless card strength is typically less than the access point strength, so you have to be physically close enough for your transmitted packets to reach and be received by the access point.
* There is at least one wireless client connected to the network and active. The reason is that WEP cracking relies on ARP packets and if there are no active clients then there will never be any ARP request packets.

Ensure that all of the above assumptions are true, otherwise the examples that follow will not work.

We have tested WEP cracking with two network adapters: Intel PRO/Wireless 3945ABG with the ipwraw-ng-2.3.4 driver and alternatively TP-LINK TL-WN321G network adapter dongle with the rt73-k2wrlz-3.0.1. driver. The Intel adapter is referenced as wlan0 (wifi0), and the TP-LINK adapter is referenced as rausb0. You can find the name of your network adapter by executing the iwconfig command.
Does my network adapter driver work correctly?

One of the assumptions in this article is that your network interface drivers need to be patched for monitor mode and packet injection. (See the How to crack WEP with Intel PRO/Wireless 3945ABG link mentioned above for more details.)
Monitor mode test

If you loaded your driver module correctly, your network adapter might already be in Monitor mode. If it is not, try executing the following command:

sudo airmon-ng start wlan0


Wlan0 (and also wifi0) is the name of your Intel 3945 network adapter. It would be rausb0 if you worked with the TP-LINK 321. You can find the name of your network adapter by executing the iwconfig command. The print screen below shows you what you want to see in your iwconfig screen.



How to break WEP encryption - interface monitor mode

If the network interface is set correctly, it should say Monitor mode.
Packet injection test

Use the injection test to confirm your card can inject prior to proceeding. Try executing the following two commands in your terminal window:

aireplay-ng -9 wifi0
aireplay-ng -9 127.0.0.1:666

They both should result in the "Injection is working!" message. You can find more details here: http://aircrack-ng.org/doku.php?id=injection_test.
How WEP cracking works?

Ok, we have all the hardware and software ready, now it is time to explain how WEP cracking works.

Here are the basic steps we will be going through:

1. Start the wireless interface in monitor mode
2. Start airodump-ng to discover all the available networks and find your target
3. Change your MAC address (optional)
4. Start airodump-ng on AP channel with a bssid filter to collect the new unique IVs
5. Use aireplay-ng to do a fake authentication with the target access point
6. Start aireplay-ng in ARP request replay mode to inject packets
7. Run aircrack-ng to crack key using the IVs collected

Sounds easy? Let's get into the details.
1. Start the wireless interface in monitor mode

If you want to listen to network traffic and to capture network traffic, your network adapter needs to be in Monitor mode. We already covered this above and also on the How to crack WEP with Intel PRO/Wireless 3945ABG page.
2. Start airodump-ng to discover all the available networks

If you want to crack WEP, you need to know a little more than just the network name. You also need to know the MAC address of the wireless access point or wireless router which you can find by executing the following command:

sudo airodump-ng wifi0


This is what you will get.



Break crack WEP: airodump-ng monitor wireless networks

You can see names of available wireless networks in the most right column and MAC addresses of access points in the most left column. This screen also tells you how each network is secured (WEP, WPA, OPN, etc). You can also find out on which channel each access point operates.
3. Change your MAC address (optional)

In order to take advantage of the packet injection technique, you need to be associated with the target wireless access point. Many wireless networks are protected not only by WEP encryption but additionally also by MAC filtering. If that is the case with your target network, you need to first discover a MAC address of an already associated user and then use that MAC address for your own authentication and association. Read the following two pages:

How to break MAC filtering (wifi security)
How to change MAC - Macchanger

Note, you will need to disable your network adapter before changing your MAC address and then enable it again, so it is an exercise that goes through the two pages referenced above as well as through point 1 and 2 again.
How do I find a MAC address?

Remember, you need to find a client on the network that is already associated with your target access point. You can do so by executing the following command in your Ubuntu terminal window:

sudo airodump-ng -c 11 --bssid 00:02:72:51:DB:28 -w wepdump -i wifi0

where -c is the channel on which your target access point is broadcasting, BSSID is the MAC address of the access point, and -w wepdump -i (we will explain later).



How to crack WEP - airodump-ng capture MAC address

The screen will look similar to the screen above.
4. Start airodump-ng to collect the new unique IVs

By now, you should have all the needed information about your target access point (name, MAC, channel, etc.), your MAC address changed to the same address as some other client on the network, and your network interface set in Monitor mode. Now you want to start capturing all the new unique so-called Initialization Vectors (IVs) included in packets that go out of your access point. You can do this by starting airodump-ng on your access point channel with a BSSID filter (access point MAC address). Open new terminal window and do:

sudo airodump-ng -c 11 --bssid 00:02:72:51:DB:28 -w wepdump -i wifi0

This is the same command as in step 3. We used it in step 3 to find someone that is already using your wireless access point; now we use it to capture initialization vectors. The option -w wepdump is the name of file where you want to save your initialization vectors. Option -i means that you want to save initialization vectors only and discard all other data.

The screen will look similar to the screen above in step 3.
5. Use aireplay-ng to do fake authentication with the access point

Now it is time to sort of "login" into your wireless network. In order for an access point to accept a packet, the source MAC address must already be associated. If the source MAC address you are injecting (later) is not associated with the access point then the access point ignores the packet and sends out a "DeAuthentication" packet in cleartext. In this state, no new initialization vectors are created because the access point is ignoring all the injected packets. The lack of association with the access point is the single biggest reason why packet injection fails. At this point you are just connecting to the access point and telling it you are here and want to talk to it. This does not give you any ability to transfer data. Open another terminal window and do:

sudo aireplay-ng -1 0 -e datel -a 00:02:72:51:DB:28 -h 00:13:CE:EC:45:20 wifi0

where -1 means fake authentication, 0 means reassociation timing in seconds, -e datel is the name of the network, -a is the access point MAC address, and -h is the MAC address under which you act (either your own or the spoofed one if you went through step 3).

This is what the output should look like.



WEP crack: aireplay-ng fake authentication

Remember, the MAC address you target for injection must be associated with the access point by either using fake authentication or using a MAC address from an already-associated client (step 3), or both at best.

Possible problem: If you get "Got a deauthentication packet" and then continuous retries, then you are probably dealing with MAC filtering (that is some access points are configured to only allow selected MAC addresses to associate and connect). Go back to step 3. If this is the case, you will not be able to successfully do fake authentication unless you know one of the MAC addresses on the allowed list.

Possible problem: If you get "Waiting for beacon frame (BSSID: ...) No such BSSID available." then you are dealing with weak wifi signal. Get closer to the access point.
Sending Authentication Request [ACK]

Sending Authentication Request [ACK] that just keeps repeating on the aireplay-ng screen is another common problem. If you keep getting "Sending Authentication Request" or "Sending Association Request" that keep coming back, then you are too far away from the access point or are dealing with weak signal. Remember, the fact that you can capture packets from the access point does not mean that the access point can also capture packets from your computer. The signal going out of your computer is much weaker.

Also, check that you are communicating on the same wireless channel as the access point.

Another problem can be that the access point utilizes MAC addressing and your MAC spoofing in step 3 did not go right. Run the ifconfig [adapter_name] and macchanger --show [adapter_name] commands to verify your computer is communicating using MAC address of some already authenticated user. (See the download Macchanger page, "How to verify" section for more details.)

In some cases, the access point is unable to communicate quickly enough with your computer. In this case, try to increase your delay and timing:

sudo aireplay-ng -1 6000 -o 1 -q 10 -e datel -a 00:02:72:51:DB:28 -h 00:13:CE:EC:45:20 wifi0

Some times, the fake authentication just does not work no matter what you do and you have to proceed without it.
5.1 WEP crack without packet injection

If the previous step fails in your case, and you are unable to do authentication with either a fake or your own MAC address, the next step 6 - packet injection - will likely fail too. Try it out and see. If step 6 fails, return to this section. No worry, you can still crack WEP; it will just take more time. If you are unable to authenticate and as a result do packet injection, you will be watching the screen which you opened in step 4 for a while.



How to crack WEP

Your goal is to see at least 150,000 in the #Data column. If you look at the RXQ column in the print screen above, you can see there number 49. This value provides information about the quality of your wireless connection between the access point and your computer. Anything below 80 is considered weak. If the number fluctuates a lot, you have weak signal as well.

The RXQ value relates to the data stream going from the access point to your computer. Even if this number is above 80, the access point still may not be able to see your computer. This is the most common reason for fake authentication and packet injection to fail. If that is your case, just sit back and wait until the #Data column shows at least 150,000, and then try step 7 (WEP crack). Without authentication and packet injection, this process might take 1,5 - 2 hours. You can start trying WEP crack in step 7 as soon as the #Data reaches at least 80,000, but our experience is that WEP keys usually get cracked once having somewhere around 150,000 initiation vectors.
6. Start aireplay-ng in ARP request replay mode to inject packets

To crack a WEP key for a wireless access point, we need to gather a lot of initialization vectors (IVs), ideally somewhere around 150,000 of them. Normal network traffic does not typically generate these initialization vectors very quickly. Theoretically, if you are patient, you can gather sufficient IVs to crack the WEP key by simply passively listening to the network traffic and saving them (step 5.1). Alternatively, you can use a technique called packet injection to actively speed up the process. Injection involves having the access point resend selected ARP packets (they include IVs) over and over very rapidly. This allows us to capture a large number of initialization vectors in a short period of time. So, the purpose of this step is to start aireplay-ng in a mode which listens for ARP requests then reinjects them back into the network. Open another terminal window and do:

sudo aireplay-ng -3 -b 00:02:72:51:DB:28 -h 00:13:CE:EC:45:20 wifi0

where -b is the access point MAC address, and -h is the MAC address under which you act (either your own or the spoofed one if you went through step 3).

This command will start listening for ARP requests and when it hears one, aireplay-ng will immediately start injecting it. You can generate an ARP request by pinging some other client that is already associated.

This is what the output should look like:



Packet injection with aireplay-ng in how to crack WEP

You can confirm that you are injecting by checking your airodump-ng and aireplay-ng screens. The data packets should be increasing rapidly. The ”#/s” should be somewhere in the range of 300 to 400 data packets per second. It can as low as a 100/second and as high as a 500/second. The ARP packets and Sent packets should be increasing rapidly as well.

Possible problem: Note, if the ARP packets count and the Sent count as well are stuck at zero, then your network interface is likely not associated with your access point. Or, you can also be too far away from the access point (weak signal).

Possible problem: Message similar to "Got a deauth/disassoc packet. Is the source mac associated?" means you have lost association with the access point. Go back to your other window from step 5 and rerun fake authentication. This is not necessary if you went through step 3 though.
7. Run aircrack-ng to crack the WEP key using the IVs collected

Once you have captured a large number of initialization vectors, you can use them to determine the WEP key. There are two basic methods for cracking WEP: the PTW method and the FMS/Korek method.

To crack the WEP open another terminal window and execute the following commands:

sudo aircrack-ng -z -b 00:1A:92:77:BB:D9 wepdump*.ivs
sudo aircrack-ng -a 1 -0 -n 128 wepdump*.ivs

where -z invokes the PTW WEP-cracking method, -b selects the access point we are interested in, wepdump*.ivs selects all files starting with "wepdump" and ending in ".ivs" (this comes from your airodump-ng command earlier), -a denotes FMS/KoreK attack, and -n selects the type of WEP key (128-bit in our case). These commands will calculate WEP key from the captured initialization vectors. This is what the output looks like:




Crack WEP

You made it! Interested in more fun stuff? Read the following two articles:

How to find MAC and IP addresses in network data
How to break MAC filtering

Now that you know how to break into a WEP-protected network and therefore have discovered the weak link in your wifi network, we would also like to draw your attention to our security tutorials. We have written a few tutorials related to wireless network security. You can read more about IPSec, VPN, MAC addressing, WPA, WPA2, PSK, and many other wireless security measures. Our wireless security tutorials help you to make your network more secure.

And lastly, if you need more help with How to crack WEP, feel free to discuss in our IT discussion forum. We also suggest that you check the Related Content section in the right-hand side bar on this page.

Note : This guide just to education purpose only...

Microsoft Office Labs Vision 2019 Montage

Thursday, November 25, 2010

Information Security Training, Certification & Research



SANS is the most trusted and by far the largest source for information security training and security certification in the world. It also develops, maintains, and makes available at no cost, the largest collection of research documents about various aspects of information security, and it operates the Internet's early warning system - the Internet Storm Center.

The SANS (SysAdmin, Audit, Network, Security) Institute was established in 1989 as a cooperative research and education organization. Its programs now reach more than 165,000 security professionals around the world. A range of individuals from auditors and network administrators, to chief information security officers are sharing the lessons they learn and are jointly finding solutions to the challenges they face. At the heart of SANS are the many security practitioners in varied global organizations from corporations to universities working together to help the entire information security community.

Many of the valuable SANS resources are free to all who ask. They include the very popular Internet Storm Center (the Internet's early warning system), the weekly news digest (NewsBites), the weekly vulnerability digest (@RISK), and more than 1,200 award-winning, original information security research papers.

SANS Computer & Information Security Training
SANS provides intensive, immersion training designed to help you and your staff master the practical steps necessary for defending systems and networks against the most dangerous threats - the ones being actively exploited. The courses are full of important and immediately useful techniques that you can put to work as soon as you return to your offices. They were developed through a consensus process involving hundreds of administrators, security managers, and information security professionals, and address both security fundamentals and awareness, and the in-depth technical aspects of the most crucial areas of IT security.

SANS training can be taken in a classroom setting from SANS-certified instructors, self-paced over the Internet, or in mentored settings in cities around the world. Each year, SANS programs educate more than 12,000 people in the US and internationally. To find the best teachers in each topic in the world, SANS runs a continuous competition for instructors. Last year more than 90 people tried out for the SANS faculty, but only five new people were selected.

SANS also offers a Work Study Program through which, in return for acting as an important extension of SANS' conference staff, facilitators may attend classes at a greatly reduced rate. Facilitators are most definitely expected to pull their weight and the educational rewards for their doing so are substantial.

You may want to try out this curriculum from SANS which will give you a basic foundation of networking with emphasis on security.

https://www.sans.org/cyber-foundations/

You will need to register first before you can try out the curriculum. But most of it is on YouTube video, so it may be slow to load.

Blind SQL Injection Demo

Blind SQL Injection Demo


Blind SQL Injection is used when a web application is vulnerable to SQL injection but the results of the injection are not visible to the attacker. The page with the vulnerability may not be one that displays data but will display differently depending on the results of a logical statement injected into the legitimate SQL statement called for that page. This type of attack can become time-intensive because a new statement must be crafted for each bit recovered.

This video shows a demo of how to conduct a Blind SQL Injection attack. Thanks go out to Saaybr (nwevqx [] csipvn.com) for uploading this video on SecurityTube.




ShoutMix chat widget