Resolve vulnerability VDP-3315
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- javascript, postgresql, python
Research direction
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.
Written by the indexing model from the issue text.
Description
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.
- Dominant language
- JavaScript
- Stars
- 3
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from NASA-AMMOS/anms
-
bug CRIT-3
Difficulty 1/5 Under an hour Newbie friendliness 70/100
NASA-AMMOS/anms#426 ·
-
bug CRIT-4
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
NASA-AMMOS/anms#424 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
NASA-AMMOS/anms#412 ·
-
enhancement javascript
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
NASA-AMMOS/anms#263 ·
-
bug CRIT-4
Difficulty 4/5 3-5 days Newbie friendliness 48/100
NASA-AMMOS/anms#428 ·
Similar issues
-
01 type: bug 41 lvl: easy
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 2 days
-
accessibility bug dark-mode dashboards
Difficulty 1/5 Under an hour Newbie friendliness 84/100
quarto-dev/quarto-cli#15447 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 1/5 Under an hour Newbie friendliness 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 duePossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
Maintainers usually reply within 1 day