CVE-2018-7269: Yii SQL injection vulnerability in yiisoft/yii2-dev

yiisoft/yii2-dev Updated 02 Oct 2025

Summary

24/05/2022
Yes i
Critical
9.8

CVE-2018-7269: Yii SQL injection vulnerability. Affects yiisoft/yii2-dev across 3 version ranges.

< 2.0.12.1 >= 2.0.13, < 2.0.13.2 >= 2.0.14, < 2.0.15

Fixed in 2.0.12.1, 2.0.13.2 or 2.0.15, depending on the release line you run. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

Yii is a high-performance PHP framework used for developing web applications. The yiisoft/yii2-dev package is a development version of Yii 2.x. It provides various tools and features for developers to build robust and secure web applications. However, this package is vulnerable to a SQL injection attack due to a flaw in the findByCondition function in the framework/db/ActiveRecord.php file.

Vulnerability Detail

The vulnerability allows remote attackers to conduct SQL injection attacks by exploiting the findOne() or findAll() calls in the Yii framework. This can lead to unauthorized access, data leakage, and potential manipulation of the database. The issue arises when array input is not properly sanitized, which can be overlooked by developers who are unaware of the need to sanitize such input.

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 2.0.12.1 2.0.12.1
    composer require yiisoft/yii2-dev:2.0.12.1
  • >= 2.0.13, < 2.0.13.2 2.0.13.2
    composer require yiisoft/yii2-dev:2.0.13.2
  • >= 2.0.14, < 2.0.15 2.0.15
    composer require yiisoft/yii2-dev:2.0.15

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

A workaround for this vulnerability is to manually sanitize the array input before using the findOne() or findAll() functions. Here is an example of how to sanitize the input using the Yii framework's built-in methods:

$condition = Yii::$app->db->createCommand()->bindParam(':param', $param)->getRawSql();
$model = Model::findOne($condition);

By using the bindParam() method, the input is properly sanitized and the vulnerability is mitigated.

Conclusion

The Yii SQL injection vulnerability in the yiisoft/yii2-dev package can lead to unauthorized access, data leakage, and potential manipulation of the database. It is crucial for developers to upgrade to the fixed versions of the package (2.0.12.1, 2.0.13.2, or 2.0.15) or manually sanitize the array input to mitigate the vulnerability. For further support on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for yiisoft/yii2-dev →

Share this vulnerability

FAQ

The vulnerability allows remote attackers to execute arbitrary SQL queries, potentially leading to unauthorized access, data leakage, and manipulation of the database.

You can use the Vulert Playground (https://vulert.com/scanner) to check if your application is affected by this vulnerability. Simply provide your composer.lock file, and Vulert will analyze it for any open-source vulnerabilities, including this Yii SQL injection vulnerability.

At the time of this report, there are no known public exploits specifically targeting this vulnerability. However, it is important to patch your application as soon as possible to prevent any potential attacks.

Yes, the CVSS score for this vulnerability is 9.8, indicating a critical severity level.

You can find more information about this vulnerability, including the affected versions and fixed versions, in the GitHub Advisory Database: https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2022/05/GHSA-hhg2-g6h6-c266/GHSA-hhg2-g6h6-c266.json

Related vulnerabilities

Recent vulnerabilities recorded for yiisoft/yii2-dev.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Fixed versions by release line

The minimum fixed version depends on the release line you run.

  • < 2.0.12.1 2.0.12.1
    composer require yiisoft/yii2-dev:2.0.12.1
  • >= 2.0.13, < 2.0.13.2 2.0.13.2
    composer require yiisoft/yii2-dev:2.0.13.2
  • >= 2.0.14, < 2.0.15 2.0.15
    composer require yiisoft/yii2-dev:2.0.15

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback

Follow Vulert in Google

Get more Vulert vulnerability and dependency-security updates in Google Search and AI results.