CVE-2023-50710: Hono's named path parameters can be overridden in TrieRouter

Published Dec 14, 2023
·
Updated

Impact

The clients may override named path parameter values from previous requests if the application is using TrieRouter. So, there is a risk that a privileged user may use unintended parameters when deleting REST API resources.

TrieRouter is used either explicitly or when the application matches a pattern that is not supported by the default RegExpRouter.

The code to reproduce it. The server side application:

ts import { Hono } from 'hono' import { TrieRouter } from 'hono/router/trie-router'

const wait = async (ms: number) => { return new Promise((resolve) => { setTimeout(resolve, ms) }) }

const app = new Hono({ router: new TrieRouter() })

app.use('', async (c, next) => { await wait(Math.random() 200) return next() })

app.get('/modules/:id/versions/:version', async (c) => { const id = c.req.param('id') const version = c.req.param('version')

console.log('path', c.req.path) console.log('version', version)

return c.json({ id, version, }) })

export default app

The client code which makes requests to the server application:

ts const examples = [ 'http://localhost:8787/modules/first/versions/first', 'http://localhost:8787/modules/second/versions/second', 'http://localhost:8787/modules/third/versions/third', ]

const test = () => { for (const example of examples) { fetch(example) .then((response) => response.json()) .then((data) => { const splitted = example.split('/') const expected = splitted[splitted.length - 1]

if (expected !== data.version) { console.error(Error: exprected ${expected} but got ${data.version} - url was ${example}) } }) } }

test()

The results:

txt Error: exprected second but got third - url was http://localhost:8787/modules/second/versions/second Error: exprected first but got third - url was http://localhost:8787/modules/first/versions/first

Patches

"v3.11.7" includes the change to fix this issue.

Workarounds

Don't use TrieRouter directly.

ts // DON'T USE TrieRouter import { TrieRouter } from 'hono/router/trie-router' const app = new Hono({ router: new TrieRouter() })

References

Router options on the Hono website: https://hono.dev/api/hono#router-option

Other sources

Hono is a web framework written in TypeScript. Prior to version 3.11.7, clients may override named path parameter values from previous requests if the application is using TrieRouter. So, there is a risk that a privileged user may use unintended parameters when deleting REST API resources. TrieRouter is used either explicitly or when the application matches a pattern that is not supported by the default RegExpRouter. Version 3.11.7 includes the change to fix this issue. As a workaround, avoid using TrieRouter directly.

Affected Software

2 affected componentsFixes available
npm/hono<3.11.7
3.11.7
Hono Hono Node.js<3.11.7

Event History

Dec 14, 2023
CVE Published
via MITRE·05:22 PM
Data Sourced
via MITRE·05:22 PM
DescriptionSeverityWeakness
Dec 15, 2023
Advisory Published
02:45 AM
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2023-50710?

CVE-2023-50710 is considered a high severity vulnerability due to the potential for unauthorized access to delete REST API resources.

2

How do I fix CVE-2023-50710?

To fix CVE-2023-50710, upgrade to version 3.11.8 or later of the Hono framework.

3

What causes CVE-2023-50710?

CVE-2023-50710 is caused by the TrieRouter allowing clients to override named path parameter values.

4

Which versions of Hono are affected by CVE-2023-50710?

CVE-2023-50710 affects Hono versions prior to 3.11.8.

5

What should I do if I cannot upgrade Hono to mitigate CVE-2023-50710?

If upgrading is not possible, consider implementing additional access controls or parameter validation to mitigate the risk of CVE-2023-50710.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203