# Security-related rules

The four rule types included in the SonarQube quality model are:

* Reliability (bug)
* Maintainability (code smell)
* Security (vulnerability)
* Security Hotspot

Security-related rules include Security rules and Security Hotspot rules. They are divided into two types: security-injection and security-configuration rules.

{% hint style="info" %}
Security is a lively world where new types of attacks and vulnerabilities appear very often, so we welcome any suggestions for new security rules. You can read the [Adding coding rules](/sonarqube-server/2025.2/extension-guide/adding-coding-rules.md) page to see how to develop a new rule or propose a new one on our [Community forum](https://community.sonarsource.com/c/suggestions/rules/13).
{% endhint %}

## Security-injection rules <a href="#security-injection-rules" id="security-injection-rules"></a>

Security-injection rules are used to detect injection vulnerabilities. An injection vulnerability (also known as injection flaw or taint vulnerability) occurs when the inputs handled by your application are controlled by a user (potentially an attacker) and not validated or sanitized. When this occurs, the flow from sources (user-controlled inputs) to sinks (sensitive functions) will be presented. Common types include SQL Injection, Deserialization, and Command Injection vulnerabilities.

To show the flow of tainted issues, SonarQube Server uses well-known taint analysis technology on source code which allows, for example, the detection of:

* [CWE-89](https://cwe.mitre.org/data/definitions/89.html): SQL Injection
* [CWE-79](https://cwe.mitre.org/data/definitions/79.html): Cross-site Scripting
* [CWE-94](https://cwe.mitre.org/data/definitions/94.html): Code Injection

{% hint style="info" %}

* Security-injection rules are supported only by SonarQube Server and Cloud. SonarQube for IDE pulls the injection vulnerabilities raised by these products during a project analysis.
* With SonarQube Server’s Security engine custom configuration, it’s possible to extend the taint analysis of security-injection rules by configuring new sources, sanitizers, validators and sinks within the homemade frameworks that you use.
  {% endhint %}

## Security-configuration rules <a href="#security-configuration-rules" id="security-configuration-rules"></a>

The security-configuration rules are used to raise a security issue when:

* A sensitive function is called with a wrong parameter (invalid cryptographic algorithm or TLS version).
* A check (for example, a check\_permissions() kind of function) is not done or is not in the correct order.\
  This problem is likely to appear often when the program is executed.

Examples:

* * [CWE-1004](https://cwe.mitre.org/data/definitions/1004.html): Sensitive Cookie Without ‘HttpOnly’ Flag
  * [CWE-297](https://cwe.mitre.org/data/definitions/297.html): Improper Validation of Certificate with Host Mismatch
  * [CWE-327](https://cwe.mitre.org/data/definitions/327.html): Use of a Broken or Risky Cryptographic Algorithm

## Differences between security issues (vulnerabilities) and hotspots <a href="#vulnerabilities-and-hotspots" id="vulnerabilities-and-hotspots"></a>

Security hotspots have been introduced for security protections that have no direct impact on the overall application’s security. With hotspots, we want to help developers understand information security risks, threats, impacts, root causes of security issues, and the choice of relevant software protections. In short, we really want to educate developers and help them develop secure, ethical, and privacy-friendly applications.

For more information about hotspots and vulnerabilities, see the [Managing Security Hotspots](/sonarqube-server/2025.2/user-guide/security-hotspots.md) page.

## Security standards covered <a href="#security-standards-covered" id="security-standards-covered"></a>

Our security rules are classified according to well-established security standards such as:

* [OWASP Top 10](https://owasp.org/Top10/) (versions 2021 and 2017)

<details>

<summary>OWASP Top 10 security standards covered by Sonar for version 2021</summary>

|                                                 |                                                |                                                |                                                |                                                |                                                |                                                |
| ----------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- |
| **Category**                                    | **Python**                                     | **JS/TS**                                      | **Java**                                       | **C#**                                         | **C/C++**                                      | **PHP**                                        |
| A01:Broken Access Control                       | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) |
| A02: Cryptographic Failures                     | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) |
| A03: Injection                                  | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) |
| A04: Insecure Design                            | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) |
| A05: Security Misconfiguration                  | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) |
| A06: Vulnerable and Outdated Components         | <p><br></p>                                    | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    |
| A07: Identification and Authentication Failures | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) |
| A08: Software and Data Integrity Failures       | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) |
| A09: Security Logging and Monitoring Failures   | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) |
| A10: Server-Side Request Forgery                | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) |

</details>

* [CWE Top 25](https://cwe.mitre.org/top25/archive/2023/2023_top25_list.html) (versions 2023, 2022, and 2021)

<details>

<summary>CWE Top 25 security standards covered by Sonar for version 2023</summary>

|                                                                                                                   |                                                |                                                |                                                |                                                |                                                |                                                |
| ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- | ---------------------------------------------- |
| **Category**                                                                                                      | **Python**                                     | **JS/TS**                                      | **Java**                                       | **C#**                                         | **C/C++**                                      | **PHP**                                        |
| CWE-787: Out-of-bounds Write                                                                                      | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    |
| <p>CWE-79: Improper Neutralization of Input During<br>Web Page Generation (‘Cross-site Scripting’)</p>            | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) |
| <p>CWE-89: Improper Neutralization of Special<br>Elements used in an SQL Command (‘SQL Injection’)</p>            | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) |
| CWE-416: Use After Free                                                                                           | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    |
| <p>CWE-78: Improper Neutralization of Special<br>Elements used in an OS Command<br>(‘OS Command Injection’)</p>   | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) |
| CWE-20: Improper Input Validation                                                                                 | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) |
| CWE-125: Out-of-bounds Read                                                                                       | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    |
| <p>CWE-22: Improper Limitation of a Pathname<br>to a Restricted Directory (‘Path Traversal’)</p>                  | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) |
| CWE-352: Cross-Site Request Forgery (CSRF)                                                                        | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) |
| <p>CWE-434: Unrestricted Upload of File with<br>Dangerous Type</p>                                                | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    |
| CWE-862: Missing Authorization                                                                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    |
| CWE-476: NULL Pointer Dereference                                                                                 | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    |
| CWE-287: Improper Authentication                                                                                  | <p><br></p>                                    | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    |
| CWE-190: Integer Overflow or Wraparound                                                                           | <p><br></p>                                    | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    |
| CWE-502: Deserialization of Untrusted Data                                                                        | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) |
| <p>CWE-77: Improper Neutralization of Special<br>Elements used in a Command (‘Command Injection’)</p>             | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) |
| <p>CWE-119: Improper Restriction of Operations<br>within the Bounds of a Memory Buffer</p>                        | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    |
| CWE-798: Use of Hard-coded Credentials                                                                            | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) |
| CWE-918: Server-Side Request Forgery (SSRF)                                                                       | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) |
| CWE-306: Missing Authentication for Critical Function                                                             | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    |
| <p>CWE-362: Concurrent Execution using Shared<br>Resource with Improper Synchronization<br>(‘Race Condition’)</p> | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    |
| CWE-269: Improper Privilege Management                                                                            | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    |
| <p>CWE-94: Improper Control of Generation of<br>Code (‘Code Injection’)</p>                                       | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) | <p><br></p>                                    | ![Checkmark icon](/files/VLvbxqoHTSaZuVE0vtQT) |
| CWE-863: Incorrect Authorization                                                                                  | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    |
| CWE-276: Incorrect Default Permissions                                                                            | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    | <p><br></p>                                    |

</details>

* [OWASP ASVS 4.0 Level 1, 2, 3](https://owasp.org/www-project-application-security-verification-standard/)
* [PCI DSS](https://www.pcisecuritystandards.org/) (versions 4.0 and 3.2.1)
* [CASA](https://appdefensealliance.dev/casa)
* [STIG](https://public.cyber.mil/stigs/)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sonarsource.com/sonarqube-server/2025.2/user-guide/rules/security-related-rules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
