-
Notifications
You must be signed in to change notification settings - Fork 346
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
[GHSA-h63v-hw6g-x8hp] An issue in the index.js decryptCookie function of cookie... #5067
[GHSA-h63v-hw6g-x8hp] An issue in the index.js decryptCookie function of cookie... #5067
Conversation
Hi there @mathysEthical. Thanks for the PR, but can you help walk me through the attack here? Looking at your gist (which is secret?) The source reads as const express = require('express');
const cookieParser = require('cookie-parser');
const cookieEncrypter = require('cookie-encrypter');
const app = express();
app.use(cookieParser("NicePasswordHereItIsAGoodSecret!"));
app.use(cookieEncrypter("NicePasswordHereItIsAGoodSecret!"));
app.get('/login', function(req, res) {
res.cookie("role","guest")
res.send("logged in as guest")
})
app.get("/admin",(req,res)=>{
console.log(req.cookies)
if(req.cookies.role=="admin"){
res.send("Access granted.")
}else{
res.send("Access denied.")
}
})
app.listen(80) There's a claim that loading
and that The write up then says |
Hello @darakian, sorry for the typos I just fixed them: The two new HEX strings are the HEX representations of "guest" and "admin" followed by null bytes to prevent the XOR operation repeating. Here is a link to get them The gist was set to private to report the vulnerability, now that it has been published I just made it public 😄 If you have any other questions, feel free to ask 😄 |
Oh I see. Literally the strings
That certainly reads like a cryptographic failure. Tested it locally to verify as well and it worked. My local IV was I think this advisory could do with an expanded description though. Maybe the title could be something like What do you think? |
Yeah I like your suggestions, feel free to add them 😄 |
56a3435
into
mathysEthical/advisory-improvement-5067
Hi @mathysEthical! Thank you so much for contributing to the GitHub Advisory Database. This database is free, open, and accessible to all, and it's people like you who make it great. Thanks for choosing to help others. We hope you send in more contributions in the future! |
Right on. I've made a few edits to the merge on our end. Let me know if you're good with them 👍 |
That's perfect ! Thanks @darakian |
Updates
Comments
Adding Title, CVSS score, product, source code URL