Skip to content

bug: upgrade moment 2.15.1 → 2.29.4 to fix locale directory traversal (CVE-2022-24785) - #1129

Open
Shrinandan-N wants to merge 1 commit into
mainfrom
devin/1793995128-upgrade-moment
Open

Shrinandan-N wants to merge 1 commit into
mainfrom
devin/1793995128-upgrade-moment

Conversation

@Shrinandan-N

@Shrinandan-N Shrinandan-N commented Nov 6, 2026 •

Copy link
Copy Markdown

Summary

moment@2.15.1 loads locales with require('./locale/' + name) without sanitizing name, so a user-controlled locale can traverse out of the locale dir and require arbitrary .js files (CVE-2022-24785 / SNYK-JS-MOMENT-2440688, CWE-22). In this app the /import handler in routes/index.js passes the third CSV column of an uploaded file straight into moment.locale(locale).

Fix: pin moment to 2.29.4 (fix landed in 2.29.2; 2.29.4 also covers the later RFC2822 ReDoS, CVE-2022-31129) and update package-lock.json (lockfileVersion 2 preserved; only the moment entries changed).

End-to-end verification — ran the app (npm start, MongoDB 3.6) and POST /import with this CSV, where /tmp/evil/pwn.js logs TRAVERSAL EXECUTED:

Safe todo,2020-01-01,fr,LL
Evil todo,2020-01-01,../../../../../../../../../../tmp/evil/pwn,LL
moment Server log for the "Evil todo" row
2.15.1 (before) TRAVERSAL EXECUTED — arbitrary file was required
2.29.4 (this PR) file not loaded; the bad locale is ignored

Valid locales still work on 2.29.4: "Safe todo" imports as Safe todo [1 janvier 2020].

Devin-Org: engineering

Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/4c4e10df534d47a4bd27fc737ef0a263
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/4c4e10df534d47a4bd27fc737ef0a263?variant=devin
Requested by: @Shrinandan-N


Devin Review

Status Commit
⚪ Not started —

Run Devin Review

Enable auto-review to review your pull requests automatically.

💡 Connect your GitHub account to enable automatic code reviews.

Devin Review (Staging)


Devin Review

…2022-24785)

Co-Authored-By: nandu.narayanan <nandu.narayanan@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updatedmoment@​2.15.1 ⏵ 2.29.410099 +219188100

View full report

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant