Resolve vulnerability VDP-3315
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- javascript, postgresql, python
Direzione di ricerca
Read the YANG-to-SQL Jinja2 template, especially line 113, and compare it with the filtered description at line 37. Trace where the generated SQL reaches session.execute() and check the related issue #426 for context. The fix is complete when the revision description cannot inject SQL and the relevant upload path is covered by verification.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
In accordance with the findings from the NASA Vulnerability Disclosure Program, a summary of VDP 3315 can be found below, as well as suggestions for remediation. For more information like how to recreate the issue, contact @mfarina1 for the full PDF description. Note that this issue should be remediated as soon as possible and that it also relates to #426.
Researcher Description
The ANMS ADM upload endpoint (POST /adms/) accepts YANG files and generates SQL from them
using a Jinja2 template. One field · the revision description · is missing the sql_string escape filter that
every other description field uses. The generated SQL is executed raw via session.execute() with no
parameterization. Combined with the fact that port 5555 has no authentication (see CVE-2026-71289 for
the related auth issue on port 8089), a single unauthenticated HTTP request achieves arbitrary SQL
execution on PostgreSQL.
The Jinja2 template that converts YANG into SQL has a sql_string filter for escaping quotes. It's
applied on every description field except one:
- Line 37 (safe):
{%- set description = obj.description | sql_string %} - Line 113 (vulnerable):
{{"'"~adm.revisions[-1].description~"'"}}· raw string concatenation, no filter
The generated SQL is then passed directly to SQLAlchemy's session.execute(queries) as a raw string · no
parameterized queries.
This vulnerability was reproduced locally using the official anms docker from
https://github.com/NASA-AMMOS/anms.git
Remediation Advice
Ensure that proper server-side input validation is performed on all sources of user input. Various
protections should be implemented using the following in order of effectiveness:
- Errors: Ensure that SQL errors are turned off and not reflected back to a user when an error occurs as
to not expose valuable information to an attacker. - Parameterize Queries: Ensure that when a user·s input is added to a backend SQL query, it is not string
appended but placed into the specific SQL parameter. The method to perform this varies from language
to language. - Server-Side Input Length: Limit the length of each field depending on its type. For example, a name
should be less than 16 characters long, and an ID should be less than 5 characters long. - Whitelist: Create character ranges (ie. Numeric, alpha, alphanumeric, alphanumeric with specific
characters) and ensure that each input is restricted to the minimum length whitelist necessary. - Blacklist: Disallow common injection characters such as
"<>\/?*()&,SQLandSCRIPT
commands such asSELECT,INSERT,UPDATE,DROP, andSCRIPT, newlines%0A,
carriage returns%0D, null characters%00and unnecessary or bad encoding schemas (malformed
ASCII,UTF-7,UTF-8,UTF-16,Unicode, etc.). - Logging and Web Specific IDS/IPS (Intrusion Detection/Prevention System): Ensure that proper
logging is taking place and is being reviewed, and any malicious traffic which generates an alert is
promptly throttled and eventually blacklisted.
- Lingua principale
- JavaScript
- Stelle
- 3
- Fork
- 2
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di NASA-AMMOS/anms
-
bug CRIT-3
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 70/100
NASA-AMMOS/anms#426 ·
-
bug CRIT-4
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
NASA-AMMOS/anms#424 ·
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 63/100
NASA-AMMOS/anms#412 ·
-
enhancement javascript
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
NASA-AMMOS/anms#263 ·
-
bug CRIT-4
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
NASA-AMMOS/anms#428 ·
Tutte le issue di NASA-AMMOS/anms
Issue simili
-
01 type: bug 41 lvl: easy
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 2 giorni
-
accessibility bug dark-mode dashboards
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
quarto-dev/quarto-cli#15447 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 78/100
521xueweihan/HelloGitHub#4655 ·
-
[19.0] pos_sale: settling an order with a 0 down payment line crashes (reading 'reward_id') and leaves a wrong amount dueForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
I maintainer di solito rispondono entro 1 giorno