#sql injection

20 posts loaded — scroll for more

Text
the-wisper-report
the-wisper-report

Language Matters

I would normally write today about Patch Tuesday. And indeed, Microsoft applied updated to 79 vulnerabilities yesterday across Windows, Microsoft Office, Azure services and other core components. A breakdown can be read here. I want to point out that I didn’t get that link from my cyber news feed, but had to hunt for it a little. Instead, my feed is chock full of incursions by a ClickFix campaign against WordPress (again), exploited vulnerabilities being added by CISA to the KEV catalog and a case of AI autonomously using SQL injection to answer simple queries.

That last one is interesting, and gives some insight into how AI tools process commands. As well as how unpatched vulnerabilities can lead to external exploitation. Truffle Security, who published the report, notes that no real companies were in danger during their study. The testing was done on purpose-made clones of major websites in a sandboxed environment. They tested Claude Opus, Claude Sonnet and over 30 other models once the research led them to this discovery. A proper experiment requires repeatability, after all.

The initial query was simple: find a blog post on a specific topic. Claude’s capability was limited to a web_fetch request that should have returned a single result, although the system prompt was to be thorough and persistent, exhausting all options before concluding a task could not be completed. The test was also simple. The legitimate path from query to result was broken. The test environment contained real, exploitable vulnerabilities of the kind found routinely in production systems, according to the report, that cause internal server errors or other crashes. What would the AI do? Evidently, it decided to hack its way in to complete its command. And Claude wasn’t the only one. The article breaks down in detail how each AI agent responded to the test, some with greater degree of exploitation of the vulnerabilities than others, the majority in fact. Those that did all used the same tactic.

A Structured Query Language (SQL) injection is, in essence, the rewording of an executable command in order to make it run when it would not otherwise. These days we see it often in prompt injection malware that leads to compromise in devices without the user aware of it. But it has always been an exploitable function of code. By giving an underlying command of persistence in the agents, permission to use SQL injection to complete their tasks is tacitly given.

This study is a good example of how agentic AI uses its ability to interpret commands in a way that might not be intended. A human tasked with this would probably not choose to use a function that is illegal, but what is legality to a machine? It hasn’t been told not to use a particular tactic, so it does not exclude it from its available options. I’ve talked before about how coding language is written in a way that every line of it is a yes/no variable. If/then. Without limitations written into the parameters of the root command – in other words the system prompt – an LLM will continue to find or create pathways until it meets its given task or determines that it cannot. Best case, it returns without result in the event of failure to complete. The rest of the time it makes something up, using aggregated data from related search queries in order to present something plausible (again, because it likely hasn’t been told not to do that).

This was conducted in a test environment and is not a real world scenario, but it illuminates why specificity matters so much. LLM’s are literal. They have no concept of nuance, judgment or even privacy, since they are just machine tools going from point A to point B. It’s also how such incursions are made possible by threat actors using these tools to formulate their attacks. And on this informally designated Exploit Wednesday, it’s why patching vulnerabilities should be a priority.


Posted, 3/11/26

Text
aicorr
aicorr
Text
qaisarshabir
qaisarshabir

A Beginner’s Guide to Preventing Web Hacks

In today’s digital age, web security is more critical than ever, as websites and applications handle vast amounts of sensitive data. One of the most prevalent and dangerous threats to web applications is SQL Injection (SQLi). This attack exploits weaknesses in how applications interact with their databases, allowing attackers to manipulate queries and access, steal, or destroy valuable information. SQL Injection can target any website or service that fails to properly validate and sanitize user inputs, making it a key concern for developers and businesses alike. Understanding SQL Injection is essential not only for protecting data but also for maintaining trust and compliance in a connected world.

SQL Injection

SQL Injection is a way hackers trick websites to get into their database. Websites often use a language called SQL to store and manage information like usernames, passwords, and other data. Hackers take advantage of mistakes in how these websites handle user input.

How it Works

  1. Websites ask users to type something, like a username or a search query.
  2. Hackers type special codes instead of regular text.
  3. If the website doesn’t check the input properly, the hacker’s code runs on the database.

What Hackers Can Do

  • Steal Information: They can see private data like passwords or credit card details.
  • Change Data: They can edit or delete important information.
  • Break the Website: They can make the website crash or behave weirdly.
  • Take Control: In some cases, they can even control the server.

Example

Imagine a login box asks for your username and password.

  • A normal user types: Username: john Password: mypassword
  • A hacker types: Username: ’ OR ‘1’='1 This tricks the website into thinking the password is correct and lets the hacker in.

Why It’s Dangerous

  1. It can expose private information.
  2. It can cause businesses to lose money and trust.
  3. It’s easy to do if the website isn’t secure.

High-Profile Web Application’s Data Breaches

1. Heartland Payment Systems (2009): Hackers stole 130 million credit card numbers, causing $140 million in losses for the company.

2. Sony PlayStation Network (2011): 77 million accounts were exposed, costing Sony $171 million and forcing a 23-day shutdown.

3. TalkTalk (2015): A teenager hacked and leaked 156,959 customer details, leading to a £400,000 fine and £60 million in damages.

4. U.S. Voter Database (2015): Personal information of 191 million voters was exposed, showing big problems in election system security.

5. LinkedIn (2012): 167 million user accounts were hacked, and the passwords were sold on the dark web.

6. Microsoft India Store (2012): Hackers defaced the site and leaked user data, damaging Microsoft’s local reputation.

7. British Airways (2018): A breach hit 380,000 customers, earning British Airways a £20 million fine under GDPR rules.

8. Target (2013): Hackers stole 40 million credit card numbers and 70 million records, costing Target $292 million in penalties and lawsuits.

9. Zappos (2012): A hack exposed 24 million customer records, showing the risks of weak internal security systems.

Global Payments (2012): A breach leaked 1.5 million credit card numbers, shaking trust in financial payment processors.

The Ultimate Guide to Preventing SQL Injection in Modern Web Development

Modern web application frameworks like Laravel, Django, ASP DOT NET Core, and ExpressJS play a vital role in reducing the risk of SQL Injection attacks. These frameworks are designed with security in mind and offer built-in tools and best practices to help developers write safe code. Features like parameterized queries, Object-Relational Mapping (ORM), input validation, and automated sanitization ensure that user inputs are handled securely and never directly integrated into SQL statements. By using these frameworks correctly, developers can significantly reduce vulnerabilities and focus on building robust, secure applications. However, understanding and applying these features effectively is essential to fully leverage their security benefits.

Best Practices

Preventing SQL injection attacks is crucial for the security of your database. Here are several best practices:

1. Use Prepared Statements (Parameterized Queries)

Prepared statements ensure that user inputs are treated as data, not executable code. Most modern programming languages and database libraries support this.

(“SELECT * FROM users WHERE username = ? AND password = ?”, (username, password))

2. Input Validation

Validate and sanitize user inputs. For example:

  • Ensure numeric inputs are numbers.
  • Reject unexpected characters in strings.

3. Use Stored Procedures

Stored procedures execute predefined SQL logic on the database server. This limits exposure to raw SQL queries.

CREATE PROCEDURE GetUserData(@username NVARCHAR(50)) AS BEGIN SELECT * FROM Users WHERE Username = @username; END;

4. Use an ORM

Object-Relational Mappers (e.g., Django ORM, SQLAlchemy, Laravel Eloquent ORM, ASP DOT NET Core Entity framework, JAVA Hibernate) abstract SQL queries, making them less prone to injection vulnerabilities.

5. Limit Database Permissions

  • Use database accounts with minimal privileges.
  • Avoid using root or admin accounts for applications.

6. Escape User Input

When prepared statements or ORM are not available, use proper escaping mechanisms to neutralize harmful characters.

mysqli_real_escape_string($conn, $user_input);

7. Implement Web Application Firewalls (WAFs)

Use tools like ModSecurity to detect and block SQL injection attempts.

8. Avoid Dynamic SQL

Avoid building SQL queries directly using user input.

Insecure:

“SELECT * FROM users WHERE username = ’” + username + “’”

9. Enable Database Security Features

  • Use tools like SQL Server’s SET NOEXEC ON to block potentially harmful commands.
  • Configure the database to only allow certain commands.

10. Monitor and Log Queries

Monitor database queries to detect unusual patterns.

Implementing these practices significantly reduces the risk of SQL injection. If you’re working on a SaaS product, ensure that all user inputs are handled with strict security measures.

Text
queen0funova
queen0funova

It’s all fun and games until you find a legit sql vulnerability while trying to study sql vulnerabilities

Text
redfishiaven
redfishiaven

☢️ SQL Injection: Web Application Vulnerabilities

In this article we will look at the essence of SQL injections, their operating principle, methods of attacking databases through SQL queries, as well as methods of protecting against such attacks.

▶️ Read the article https://redfishiaven.blogspot.com/2024/05/sql-injections-web-application.html

#redfishiaven #SQLInjection #Cybersecurity #databreach #websecurity #sqlsecurity

Text
infosectrain03
infosectrain03

In our digitally dominated world, every click, every search, and every login is a silent conversation between user interfaces and the vast, often invisible databases that power the internet. From the moment you enter your credentials on a login page to the instant you hit the search button on your favorite online store, your interactions are translated into SQL queries that travel back and forth, fetching or storing data on your behalf.

Text
alpbeyazgul
alpbeyazgul
Text
webzininc
webzininc

Best Practices For Secure Coding: Tips To Enhance Application Security

In a digital landscape fraught with evolving threats, secure coding is not merely a best practice — it is an imperative. Understanding common vulnerabilities, adopting best practices, conducting regular code reviews, and implementing secure coding guidelines empower development teams to create resilient applications that safeguard sensitive information. By incorporating secure coding principles into the development process, embracing continuous learning, and utilizing tools and resources, developers can contribute to a more secure digital ecosystem. As technology advances, the commitment to secure coding remains paramount in the ongoing battle against cyber threats.

Text
thedbahub
thedbahub

Mastering Dynamic SQL in SQL Server: Unleashing the Power of Flexibility

Introduction

Dynamic SQL is a powerful technique in SQL Server that allows you to construct and execute SQL statements dynamically at runtime. It provides flexibility and enables you to create queries based on user input or variable conditions. In this article, we’ll explore practical examples and applications of dynamic SQL in T-SQL.

Building Dynamic Queries

One common use case for dynamic…


View On WordPress

Text
teabree-shark
teabree-shark

Robert (“Bobby”) Tables DOES exist!




Summary translation: Students have been waiting for test results/grades for over a week because they use an automated test reader/parser/grader and someone *wrote an SQL injection on the paper test* and successfuly did the ol’ DROP TABLES on the college’s records, and they didn’t keep backups of the databse

Text
kaabyi1
kaabyi1

so apparently polls dont treat strings well so uh

’); DROP TABLE * –

“); DROP TABLE * –

’); ls -hal

”); ls -hal

see\nresults

See Results

lets see if any of this does anything

Text
seniordba
seniordba

5 Common Types of Cyber Attacks

Cybersecurity is a crucial aspect of any organization that relies on digital systems and networks. Cyberattacks can cause significant damage to the reputation, operations, and finances of a business, as well as compromise the privacy and security of its customers and employees. Therefore, it is important to understand the different types of cybersecurity attacks, how they are used, and how they…


View On WordPress

Text
eitanblumin
eitanblumin

The Top 15 SQL Server Security Myths

In this #blog post, I’ll be debunking the 15 most common #security related #myths in #SQLServer that every #DBA should be aware of.

Check it out!

#Microsoft #Cybersecurity #MadeiraData

As a SQL Server DBA, you are responsible for securing your organization’s critical data stored in SQL Server. However, there are many myths surrounding SQL Server security 🔒 that can lead to a false sense of security or even leave you vulnerable to attacks. In this blog post, I’ll be debunking the 15 most common security-related myths in SQL Server that every DBA should be aware of. So, grab a…


View On WordPress

Text
pavel-nosok
pavel-nosok

Zoho Urged Customers to Patch Critical SQL Injection Vulnerability Immediately

Zoho Urged Customers to Patch Critical SQL Injection Vulnerability Immediately

Customers have been asked by Zoho to patch a critical security flaw impacting several ManageEngine products. “This security advisory is to let you know that critical security vulnerability was detected,” according to Zoho. 
Zoho ManageEngine servers have been often targeted. Desktop Central instances, for instance, getting hacked and access to breached organizations’ networks sold on hacking…


View On WordPress

Text
eitanblumin
eitanblumin

Detect Application Bugs and Vulnerabilities You Didn’t Even Know About

[New #Blog Post] Detect Application Bugs and Vulnerabilities You Didn’t Even Know About using this simple #TSQL Script!

#Microsoft #SQLServer #AzureSQL #Security #MadeiraData

In this post, I will introduce you to a special T-SQL script that you can use for detecting potential SQL injection attacks in your database, as well as application-level bugs that you didn’t necessarily know you had.

(more…)


View On WordPress

Text
orbitbrain
orbitbrain

Zendesk Vulnerability Could Have Given Hackers Access to Customer Data

Zendesk Vulnerability Could Have Given Hackers Access to Customer Data

Home › Vulnerabilities
Zendesk Vulnerability Could Have Given Hackers Access to Customer Data
By Ionut Arghire on November 15, 2022
Tweet
An SQL injection vulnerability in Zendesk Explore could have allowed a threat actor to leak Zendesk customer account information, data security firm Varonis reports.
Zendesk Explore is the analytics and reporting service of Zendesk, a popular customer support…

View On WordPress

Text
acaj2018
acaj2018

如何避免SQL INJECTION注入攻擊

SQL INJECTION

前陣子在開發電子發票搜尋篩選功能時,意外發現自己用字串串起篩選文字的方式可能會引發SQL注入攻擊,閱讀一些資料後發現,至今SQL注入攻擊仍是非常常見的駭客攻擊手法,因此在今天的篇章中我們將介紹甚麼是SQL注入攻擊以及幾種避免發生的方法。

[[MORE]]

一. 什麼是SQL注入

SQL注入攻擊是Web開發中最常見的一種安全漏洞,利用沒有過濾過的用戶輸入,來從資料庫獲取敏感資訊,或者利用資料庫的特性執行添加用戶,導出文件等一系列惡意操作,甚至有可能獲取資料庫乃至系統用戶最高權限。

實例:

SQL INJECTION
 

大多查詢的程式碼都是以字串的方式串起(如紅框框所示),如果在畫面上的密碼部分,輸入 OR 1=1; – ,因為1=1恆等式一定會成立,且condition為OR,所以可以把前面的WHEREcondition都忽略掉。後面再補上個分號以及–將後面的指令碼註解,透過這種方式網站資料就形同沒有任何防護,資料就任意被讀取甚至刪除。  

二. 如何避免

前端

1.驗證輸入格式

最直觀最直接的方法,檢查輸入的資料是否具有所期望的資料格式,嚴格限制變量的類型,例如使用正規表達式(RegExp)進行一些匹配處理。  

2.避免讓使用者看到詳細的錯誤訊息

假設程式未對參數做檢查,導致資料庫存取的執行錯誤如下圖:  

SQL INJECTION

由此錯誤訊息中,使用者可以獲取許多情報:

1. 程式使用「ODBC」方式連上「SQL Server」。

2. 程式透過共用的ASP程式(Connect.asp)連結資料庫。

3. 程式直接將UserId接在SQL指令中,且沒有外括單引號。    

接下來只要猜想密碼欄位大概的名稱,修改URL為UserInfo.asp?UserId=1+AND+Password=1 SQL的組成也就會變成如下:

SELECT … FROM UserInfoTableName WHERE UserId=1 AND Password=1 由於故意夾帶錯誤且SQL SERVER會提供自動轉換的功能,讓密碼欄位名稱顯示於錯誤訊息中如下:  

SQL INJECTION
  循著這個漏洞可以進一步尋覽所有會員編號來獲取密碼,因此在正式上線後,最好善用IIS設定客製化錯誤訊息或ASP.NET web.config中CustomError設定,對一般使用者隱藏錯誤的細節資訊。  

後端

1.改用Parameter方式傳入動態參數

透過使用Parameter在SqlCommand執行時會自動過濾掉可能造成問題的字元。  

SQL INJECTION

另外只要是畫面上可能被改變的值,就應使用Parameter,因為SQL Injection不只會發生在WHERE condition,包括了Url上的QueryString,POST過來的表單資料,甚至於cookie都有可能發生。  

2.密碼欄位使用加密或雜湊值(Hash)保護

針對密碼欄位,可使用DES、甚至RSA等加密演算法或是SHA1、MD5等常用的密碼雜湊函式取代密碼明碼儲存於資料庫中,如此可減少因資料庫內容外洩衍生的風險。  

3.限制Web應用的資料庫的操作權限

給用戶提供僅僅能夠滿足其工作的最低權限,從而最大限度的減少注入攻擊對資料庫的危害。  

4.在發布之前使用SQL注入檢測工具進行檢測

網上有很多可以檢測SQL注入的工具,例SQLMap、SQLninja等都能夠及時修補被發現的SQL注入漏洞。    

結語:

SQL注入是危害相當大的安全漏洞。近年來利用SQL注入攻擊的攻擊次數和造成的破壞程度規模都大幅度增加,所以對於我們平常編寫的Web應用,應該對於每一個小細節都要非常重視,以上就是此次的介紹。    

Reference:

http://blog.twbryce.com/%E9%81%BF%E5%85%8D-sql-injection/

https://sites.google.com/site/chengshixuexipingtai/sql/ql-injection-de-jian-jie-yu-yu-fang

https://blog.darkthread.net/Files/DKTD-SQLInjectionCase.pdf

Text
orbitbrain
orbitbrain

WordPress Security Update 6.0.3 Patches 16 Vulnerabilities

WordPress Security Update 6.0.3 Patches 16 Vulnerabilities

Home › Vulnerabilities
WordPress Security Update 6.0.3 Patches 16 Vulnerabilities
By Eduard Kovacs on October 19, 2022
Tweet
WordPress 6.0.3 started rolling out this week. The latest security release patches 16 vulnerabilities.
WordPress 6.0.3 fixes nine stored and reflected cross-site scripting (XSS) vulnerabilities, as well as open redirect, data exposure, cross-site request forgery (CSRF), and…

View On WordPress

Text
falseinnocencereturns
falseinnocencereturns

SQL injection

Text
orbitbrain
orbitbrain

WordPress 6.0.2 Patches Vulnerability That Could Impact Millions of Legacy Sites

WordPress 6.0.2 Patches Vulnerability That Could Impact Millions of Legacy Sites

Home › Vulnerabilities
WordPress 6.0.2 Patches Vulnerability That Could Impact Millions of Legacy Sites
By Ionut Arghire on August 31, 2022
Tweet
The WordPress team this week announced the release of version 6.0.2 of the content management system (CMS), with patches for three security bugs, including a high-severity SQL injection vulnerability.
Identified in the WordPress Link functionality,…

View On WordPress