> For the complete documentation index, see [llms.txt](https://rfc1918.gitbook.io/offsec/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rfc1918.gitbook.io/offsec/services/ms-sql-server/sql-injection.md).

# SQL Injection

## Overview

> MS SQL injection is a type of web application security vulnerability that occurs when an attacker can manipulate user input in a web application that interacts with a Microsoft SQL Server database. This vulnerability can allow an attacker to execute malicious SQL statements, such as dropping tables, modifying data, or extracting sensitive information, by exploiting the application's failure to properly sanitize or validate user input.

## Example code

{% hint style="info" %}
See refences for examples and useful tips.
{% endhint %}

### Union All Select

Example of union all select:

```sql
artist=' UNION ALL SELECT @@Version,NULL--
artist=' UNION SELECT (SELECT is_srvrolemember('sysadmin')),NULL--
```

## Refences

{% embed url="<https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/SQL%20Injection/MSSQL%20Injection.md>" %}
