SQL injection attacks
SQL injection attacks
2:58

SQL injection attacks

Culture
[ Music ] ^M00:00:09 >> In the book, "Daemon," Brian Gragg uses an SQL injection attack to hack into a server in order to join a secret society run by a dead man. Good book. SQL injection attacks are real, though. I've consulted with several experts, who remain anonymous, in order to help give you a very basic explanation of what they are. Let's start with blog software, as an example. A lot of people run it, but they don't really understand how it works. And that's okay, as long as you regularly update and don't expose administrative functions to the Internet. When you type your log in ID and password into a web page, it is passed as a string of text into a variable. And that variable is then interpreted as part of a command. Let's say the statement's like this, a select command looking for a user name. This tells the application to select from a table called "users" the name that equals the string "user name." So, let's say you type your user name "4thelulz," the string will look like this. And only the name "4thelulz" will be selected. Normal SQL injection is often detected by fuzzing a parameter with malicious characters like this. So you've got your example log in sending some post-data that's malicious, and the application will return a 500 internal server error, and SQL error, or both. Now, a clever hacker could enter something like, "a' or 't' = 't, with the apostrophes, as the user name. Then that's gonna turn the command to this. And the request is gonna look like this. Do you see how the single quotes are used to surround what becomes an argument? Since "t" always equals "t," the selection comes back as evaluated "true," even though a real user name has not been entered. This could work for a password, too. Now, the problem here is allowing multiple statements within one call. Your query API should not allow this. The injection attack in Daemon is what is sometimes known as a "magic string." This one's clever because unlike the injection we just talked about, a magic string can potentially give you admin access, not just generic user access. The attacker simply enters 'or 1 = 1. As far as an example, here's your login, and the post data is passed as so. This causes the statement to be interpreted as this. Where it's saying "name = blank or 1 = 1." Well, this selects for all the users in the table and allows you to be logged in at the user at the top of the table because 1 always equals 1. There are many more injection types than this, including blind SQL injections and vulnerabilities inside the server, but this should give you a fair idea of what these attacks are and how they work. The experts I consulted recommending using manual code reviews and enforcing the use of parameterized statements to ward off these kinds of attacks. Thanks for watching Hacks. Stay safe out there. ^M00:02:54 [ Music ]

Up Next

Hacks@Home: How to install a smart plug
hackshome-how-to-install-a-smart-plug0

Up Next

Hacks@Home: How to install a smart plug

Worst hacks of the year
gettyimages-527099783

Worst hacks of the year

Tweak MiFi to charge
hk_MiFiUSB720.jpg

Tweak MiFi to charge

Elevator hacks
hk_elevators720.jpg

Elevator hacks

Share your purchased iPhone apps on multiple devices
hk_shareapps720.jpg

Share your purchased iPhone apps on multiple devices

Add an external hard drive to your TiVo HD
hk_tivoexternal720.jpg

Add an external hard drive to your TiVo HD

Why AT&T blocked 4Chan
hk_ATT4Chan720.jpg

Why AT&T blocked 4Chan

Break into Gmail
hk_GmailSecurity720.jpg

Break into Gmail

Make your own batteries
hk_MakeBatteries720.jpg

Make your own batteries

Tether your iPhone on OS 3.0
hk_tetheriphone720.jpg

Tether your iPhone on OS 3.0

Tech Shows

The Apple Core
apple-core-w

The Apple Core

Alphabet City
alphabet-city-w

Alphabet City

CNET Top 5
cnet-top-5-w

CNET Top 5

The Daily Charge
dc-site-1color-logo.png

The Daily Charge

What the Future
what-the-future-w

What the Future

Tech Today
tech-today-w

Tech Today

Latest News All latest news

Purple Mattress Guide: Which Bed Should You Sleep On?
The Purple Restore mattress against a colorful background and a man in a sweatshirt in the front.

Purple Mattress Guide: Which Bed Should You Sleep On?

Digital Heroes: Connecting New Yorkers to Affordable, High-Speed Internet Access
230922-yt-nyc-mesh-v01b

Digital Heroes: Connecting New Yorkers to Affordable, High-Speed Internet Access

TV Buying Guide: Sizes, Prices and When to Buy to Get a Good Deal
tv-buying-guide-cnet-seq-00-08-50-25-still008

TV Buying Guide: Sizes, Prices and When to Buy to Get a Good Deal

Brain-Computer Interface: No Open Brain Surgery Required
demo3

Brain-Computer Interface: No Open Brain Surgery Required

First Look: Microsoft Surface Studio 2 and Surface Go 3 Laptops
surface-laptops-1080-seq-00-05-17-28-still005

First Look: Microsoft Surface Studio 2 and Surface Go 3 Laptops

10 Must-Try Hidden iOS 17 Features on Your iPhone
230921-site-ios-17-hidden-features

10 Must-Try Hidden iOS 17 Features on Your iPhone

Most Popular All most popular

TV Buying Guide: Sizes, Prices and When to Buy to Get a Good Deal
tv-buying-guide-cnet-seq-00-08-50-25-still008

TV Buying Guide: Sizes, Prices and When to Buy to Get a Good Deal

Amazon Announces New Ring and Blink Cameras for the Home
amazon-reveals-new-ring-and-blink-cameras-00-04-09-02-still001

Amazon Announces New Ring and Blink Cameras for the Home

Amazon Shows Off New Fire TV Soundbar, 4K Stick
amazon-seq-00-00-08-14-still001

Amazon Shows Off New Fire TV Soundbar, 4K Stick

iPhone 15 Pro Max vs. Galaxy S23 Ultra: Spec Comparison
iphone15promax-vs-galaxys23ultra-site

iPhone 15 Pro Max vs. Galaxy S23 Ultra: Spec Comparison

First Look: Microsoft Surface Studio 2 and Surface Go 3 Laptops
surface-laptops-1080-seq-00-05-17-28-still005

First Look: Microsoft Surface Studio 2 and Surface Go 3 Laptops

Surprises From First Days of iPhone 15 and Apple Watch Series 9
230921-site-one-more-thing-revelations-of-the-reviews-2

Surprises From First Days of iPhone 15 and Apple Watch Series 9

Latest Products All latest products

Vizio's New Quantum Pro TVs Could Be a Strong Value Play
new-vizio-tvs-cnet-00-00-41-11-still001.png

Vizio's New Quantum Pro TVs Could Be a Strong Value Play

Amazon Announces New Ring and Blink Cameras for the Home
amazon-reveals-new-ring-and-blink-cameras-00-04-09-02-still001

Amazon Announces New Ring and Blink Cameras for the Home

Amazon Unveils Echo Pop Kids, Fire HD 10 Kids Tablets for Young Users
cnet-thumbnail-amazonevent-kids-site

Amazon Unveils Echo Pop Kids, Fire HD 10 Kids Tablets for Young Users

Review: The iPhone 15 Pro, 15 Pro Max Are Impressive
iphone15pro-promax-review-clean

Review: The iPhone 15 Pro, 15 Pro Max Are Impressive

Bose Debuts QuietComfort Ultra Headphones and Ultra Earbuds (Hands-On)
bosehandson-00-00-21-12-still001

Bose Debuts QuietComfort Ultra Headphones and Ultra Earbuds (Hands-On)

Apple Watch Ultra 2: First Look
handson-applewatch-ultra2-clean

Apple Watch Ultra 2: First Look

Latest How To All how to videos

10 Must-Try Hidden iOS 17 Features on Your iPhone
230921-site-ios-17-hidden-features

10 Must-Try Hidden iOS 17 Features on Your iPhone

How to Record Your Screen in Windows 11
how-to-record-your-screen-in-windows-11-00-00-48-13-still002

How to Record Your Screen in Windows 11

Windows Copilot Preview: How to Manage Your PC With the AI Assistant
copilot-clean

Windows Copilot Preview: How to Manage Your PC With the AI Assistant

How to Build a Portable AC Unit in Minutes
diy-portable-ac-for-youtube-00-02-55-23-still001

How to Build a Portable AC Unit in Minutes

How to Blur Your Home or an Object in Google Maps
how-to-blur-your-house-in-google-maps-1b

How to Blur Your Home or an Object in Google Maps

How to Clone Your Own Voice with AI
230620-site-how-to-make-an-ai-voice-clone

How to Clone Your Own Voice with AI