Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@thirdweb-dev/auth API vulnerability #472

Closed
jaschahuisman opened this issue Dec 25, 2022 · 1 comment
Closed

@thirdweb-dev/auth API vulnerability #472

jaschahuisman opened this issue Dec 25, 2022 · 1 comment
Assignees

Comments

@jaschahuisman
Copy link

jaschahuisman commented Dec 25, 2022

Issue

When sending a blank GET request to /api/auth/login using @thirdweb/auth in Next.js (and Express.js as well) the whole server crashes because of an unexpected token in this line of code.

This might be a vulnerability because this is a way to crash the whole backend with one single request.

Also to mention that the atob method used here is deprecated.

const payload = JSON.parse(atob(req.query.payload as string)) as LoginPayload;

The error

error - node_modules/@thirdweb-dev/auth/next/evm/dist/thirdweb-dev-auth-next-evm.esm.js (20:0) @ handler$2
error - SyntaxError: Unexpected token º in JSON at position 0
    at JSON.parse (<anonymous>)

Possible solutions

  1. Replace the deprecated atob method with the modern Buffer.from method.
  2. Handle the case where the req.query.payload is null or undefined.
  3. Catch server errors in the whole route handler.
@gtandes
Copy link

gtandes commented Jan 9, 2023

Good day ser. I'm trying to code along the token-gated NFT tutorial by Thirdweb in this article:

https://blog.thirdweb.com/guides/nft-gated-website/

However, during installation of the Auth SDK, I get an error about NextJS13 conflict. I tried using legacy-peer-deps, however after installation, no data could be pulled from ThirdWebAuth. Might you know what's the issue here?

image

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

No branches or pull requests

4 participants