Skip to content

Conversation

@depfu
Copy link
Contributor

@depfu depfu bot commented Jul 28, 2025


🚨 Your current dependencies have known security vulnerabilities 🚨

This dependency update fixes known security vulnerabilities. Please see the details below and assess their impact carefully. We recommend to merge and deploy this as soon as possible!


Here is everything you need to know about this upgrade. Please take a good look at what changed and the test results before merging this pull request.

What changed?

✳️ koa (2.13.4 → 3.0.1) · Repo · Changelog

Security Advisories 🚨

🚨 Koa Open Redirect via Referrer Header (User-Controlled)

Summary

In the latest version of Koa, the back method used for redirect operations adopts an insecure implementation, which uses the user-controllable referrer header as the redirect target.

Details

on the API document https://www.koajs.net/api/response#responseredirecturl-alt, we can see:

response.redirect(url, [alt])

Performs a [302] redirect to url.
The string "back" is specially provided for Referrer support, using alt or "/" when Referrer does not exist.

ctx.redirect('back');
ctx.redirect('back', '/index.html');
ctx.redirect('/login');
ctx.redirect('http://google.com');

however, the "back" method is insecure:

  back (alt) {
    const url = this.ctx.get('Referrer') || alt || '/'
    this.redirect(url)
  },

Referrer Header is User-Controlled.

PoC

there is a demo for POC:

const Koa = require('koa')
const serve = require('koa-static')
const Router = require('@koa/router')
const path = require('path')

const app = new Koa()
const router = new Router()

// Serve static files from the public directory
app.use(serve(path.join(__dirname, 'public')))

// Define routes
router.get('/test', ctx => {
ctx.redirect('back', '/index1.html')
})

router.get('/test2', ctx => {
ctx.redirect('back')
})

router.get('/', ctx => {
ctx.body = 'Welcome to the home page! Try accessing /test, /test2'
})

app.use(router.routes())
app.use(router.allowedMethods())

const port = 3000
app.listen(port, () => {
console.log(Server running at http://localhost:${port})
})

Proof Of Concept

GET /test HTTP/1.1
Host: 127.0.0.1:3000
Referer: http://www.baidu.com
Connection: close

GET /test2 HTTP/1.1
Host: 127.0.0.1:3000
Referer: http://www.baidu.com
Connection: close

image

image

Impact

https://learn.snyk.io/lesson/open-redirect/

🚨 Koajs vulnerable to Cross-Site Scripting (XSS) at ctx.redirect() function

Summary

In koa < 2.16.1 and < 3.0.0-alpha.5, passing untrusted user input to ctx.redirect() even after sanitizing it, may execute javascript code on the user who use the app.

Patches

This issue is patched in 2.16.1 and 3.0.0-alpha.5.

PoC

Coming soon...

Impact

  1. Redirect user to another phishing site
  2. Make request to another endpoint of the application based on user's cookie
  3. Steal user's cookie

🚨 Inefficient Regular Expression Complexity in koa

Summary

Koa uses an evil regex to parse the X-Forwarded-Proto and X-Forwarded-Host HTTP headers. This can be exploited to carry out a Denial-of-Service attack.

PoC

Coming soon.

Impact

This is a Regex Denial-of-Service attack and causes memory exhaustion. The regex should be improved and empty values should not be allowed.

Release Notes

3.0.1

More info than we can show here.

3.0.0

More info than we can show here.

2.16.1

More info than we can show here.

2.16.0

More info than we can show here.

2.15.4

More info than we can show here.

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by more commits than we can show here.

↗️ accepts (indirect, 1.3.7 → 1.3.8) · Repo · Changelog

Release Notes

1.3.8

More info than we can show here.

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by more commits than we can show here.

↗️ content-type (indirect, 1.0.4 → 1.0.5) · Repo · Changelog

Release Notes

1.0.5

More info than we can show here.

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by more commits than we can show here.

↗️ cookies (indirect, 0.8.0 → 0.9.1) · Repo · Changelog

Release Notes

0.9.1

More info than we can show here.

0.9.0

More info than we can show here.

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by more commits than we can show here.

↗️ function-bind (indirect, 1.1.1 → 1.1.2) · Repo · Changelog

Commits

See the full diff on Github. The new version differs by more commits than we can show here.

↗️ get-intrinsic (indirect, 1.1.3 → 1.3.0) · Repo · Changelog

Release Notes

1.3.0 (from changelog)

More info than we can show here.

1.2.7 (from changelog)

More info than we can show here.

1.2.6 (from changelog)

More info than we can show here.

1.2.5 (from changelog)

More info than we can show here.

1.2.4 (from changelog)

More info than we can show here.

1.2.3 (from changelog)

More info than we can show here.

1.2.2 (from changelog)

More info than we can show here.

1.2.1 (from changelog)

More info than we can show here.

1.2.0 (from changelog)

More info than we can show here.

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by more commits than we can show here.

↗️ has-symbols (indirect, 1.0.3 → 1.1.0) · Repo · Changelog

Release Notes

1.1.0 (from changelog)

More info than we can show here.

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by more commits than we can show here.

↗️ is-generator-function (indirect, 1.0.10 → 1.1.0) · Repo · Changelog

Release Notes

1.1.0 (from changelog)

More info than we can show here.

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by more commits than we can show here.

↗️ is-regex (indirect, 1.1.4 → 1.2.1) · Repo · Changelog

Release Notes

1.2.1 (from changelog)

More info than we can show here.

1.2.0 (from changelog)

More info than we can show here.

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by more commits than we can show here.

↗️ mime-db (indirect, 1.49.0 → 1.54.0) · Repo · Changelog

Release Notes

1.54.0

More info than we can show here.

1.53.0 (from changelog)

More info than we can show here.

1.52.0

More info than we can show here.

1.51.0

More info than we can show here.

1.50.0

More info than we can show here.

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by more commits than we can show here.

↗️ mime-types (indirect, 2.1.32 → 2.1.35) · Repo · Changelog

Release Notes

2.1.35

More info than we can show here.

2.1.34

More info than we can show here.

2.1.33

More info than we can show here.

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by more commits than we can show here.

↗️ negotiator (indirect, 0.6.2 → 0.6.3) · Repo · Changelog

Release Notes

0.6.3 (from changelog)

More info than we can show here.

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by more commits than we can show here.

↗️ safe-regex-test (indirect, 1.0.0 → 1.1.0) · Repo · Changelog

Release Notes

1.1.0 (from changelog)

More info than we can show here.

Does any of this look wrong? Please let us know.

Commits

See the full diff on Github. The new version differs by more commits than we can show here.

🆕 call-bind-apply-helpers (added, 1.0.2)

🆕 call-bound (added, 1.0.4)

🆕 dunder-proto (added, 1.0.1)

🆕 es-define-property (added, 1.0.1)

🆕 es-errors (added, 1.3.0)

🆕 es-object-atoms (added, 1.1.1)

🆕 get-proto (added, 1.0.1)

🆕 gopd (added, 1.2.0)

🆕 hasown (added, 2.0.2)

🆕 math-intrinsics (added, 1.1.0)


Depfu Status

Depfu will automatically keep this PR conflict-free, as long as you don't add any commits to this branch yourself. You can also trigger a rebase manually by commenting with @depfu rebase.

All Depfu comment commands
@​depfu rebase
Rebases against your default branch and redoes this update
@​depfu recreate
Recreates this PR, overwriting any edits that you've made to it
@​depfu merge
Merges this PR once your tests are passing and conflicts are resolved
@​depfu cancel merge
Cancels automatic merging of this PR
@​depfu close
Closes this PR and deletes the branch
@​depfu reopen
Restores the branch and reopens this PR (if it's closed)
@​depfu pause
Ignores all future updates for this dependency and closes this PR
@​depfu pause [minor|major]
Ignores all future minor/major updates for this dependency and closes this PR
@​depfu resume
Future versions of this dependency will create PRs again (leaves this PR as is)

@depfu depfu bot added the depfu label Jul 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant