CVE-2021-23404
SQLite-web CSRF attacks due to lack of source validation in SQL dashboard
- CVSS 8.8
- CWE-352 Cross-Site Request Forgery (CSRF)
- Configuration Issues
- Remote
This affects all versions of package sqlite-web. The SQL dashboard area allows sensitive actions to be performed without validating that the request originated from the application. This could enable an attacker to trick a user into performing these actions unknowingly through a Cross Site Request Forgery (CSRF) attack.
- CVSS base score
- 8.8
- Published
- 2021-09-08
- OWASP
- A07 Identification and Authentication Failures
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Configuration Issues
- Subcategory
- Cross-Site Request Forgery (CSRF)
- Accessibility scope
- Remote
- Impact
- Unauthorized Access
- Affected component
- sqlite-web
- Fixed by upgrading
- Yes
Solution
Update sqlite-web to version with Cross Site Request Forgery (CSRF) protection.
Vulnerable code sample
from flask import Flask, request, redirect, url_for
app = Flask(__name__)
@app.route('/perform_action', methods=['POST'])
def perform_action():
# Perform sensitive action without CSRF protection
return redirect(url_for('success'))
@app.route('/success')
def success():
return "Action performed successfully!"
if __name__ == '__main__':
app.run()Patched code sample
from flask import Flask, request, redirect, url_for, session
from flask_wtf.csrf import CSRFProtect
app = Flask(__name__)
app.secret_key = 'your_secret_key'
csrf = CSRFProtect(app)
@app.route('/perform_action', methods=['POST'])
@csrf.exempt # This line should be removed to enable CSRF protection
def perform_action():
# Perform sensitive action
return redirect(url_for('success'))
@app.route('/success')
def success():
return "Action performed successfully!"
if __name__ == '__main__':
app.run()Cite this entry
@misc{vaitp:cve202123404,
title = {{SQLite-web CSRF attacks due to lack of source validation in SQL dashboard}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2021},
note = {VAITP Python Vulnerability Dataset, entry CVE-2021-23404},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2021-23404/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
