loopbackio / loopbackio/loopback-connector-mssql

CSRF Vulnerability in axios via mssql@6.4.1 and Loopback-Connector-MSSQL

Open
#250 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
JavaScript
Stars
52
Forks
80
PR merge metrics
No merged PRs in 30d

Description

## Steps to reproduce

1. Use the `platform@0.0.1` package with `loopback-connector-mssql@3.8.0`, which in turn uses `mssql@6.4.1`.
2. This package relies on `axios@0.21.4`, which is affected by a CSRF vulnerability.
3. Enable `withCredentials` setting, and if the `X-XSRF-TOKEN` header is inserted using the secret `XSRF-TOKEN` cookie value, CSRF vulnerability is triggered.

## Current Behavior

The vulnerability is introduced through the dependency chain:
`platform@0.0.1 > loopback-connector-mssql@3.8.0 > mssql@6.4.1 > tedious@6.7.1 > @azure/ms-rest-nodeauth@3.1.1 > adal-node@0.2.4 > axios@0.21.4`.

When the `XSRF-TOKEN` cookie is available and `withCredentials` is enabled, the X-XSRF-TOKEN header is automatically sent in requests to the server. This can potentially bypass CSRF protections if an attacker manages to obtain this token.

## Expected Behavior

- The package `mssql` should be updated to `11.0.1` or a version that resolves the CSRF vulnerability.
- There should be an update to `axios` to address the CSRF issue by improving the handling of `X-XSRF-TOKEN` and `XSRF-TOKEN` cookies.

## Link to reproduction sandbox

N/A

## Additional information

- `node -e 'console.log(process.platform, process.arch, process.versions.node)'`
Output: ``
- `npm ls --prod --depth 0 | grep loopback`
Output: ``

## Related Issues

No related issues found.

---

**Note:** The issue is related to the CSRF vulnerability in `axios@0.21.4`. The fix would require an update to the `mssql` dependency to resolve the security issue introduced by `axios`.

![Image](https://github.com/user-attachments/assets/caba07de-e6d5-4591-b35f-593616c56cd8)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the dependency chain listed in the issue and run the provided npm dependency-tree command to confirm how axios@0.21.4 is resolved. Investigate the requested mssql upgrade and verify that the vulnerable axios version is no longer present while the connector remains functional.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, sql
Domain
backend, databases, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.