TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Hackers Think Cookies Are Tasty, Too

13 点作者 ainsleyb大约 12 年前

4 条评论

cheald大约 12 年前
But...in order to properly execute an XSS attack, you have to get your code onto <i>someone else's</i> computer. You can edit your own cookies all day long and accomplish nothing of value. What piece am I missing here?<p>That said, as far as the server trusting cookie values to do database lookups or whatever, sure, there's a hole there. Most folks will use something like HMAC-signed cookies in those cases, so that an attacker would have to be in possession of a secret key in order to successfully have altered cookie data accepted by the user. But in any case, the data should be treated like any other user-supplied data - untrusted and to be sanitized.
评论 #5481843 未加载
评论 #5482548 未加载
评论 #5481836 未加载
评论 #5481847 未加载
ultimoo大约 12 年前
Isn't it a widely adopted practice to encrypt the content of the cookie before setting it? Of course it could still be tampered with, but not as trivially.
评论 #5481877 未加载
Oduig大约 12 年前
Isn't XSS only a client side danger? For URLs, this is relevant since you can post a malicious link and people can click on it. It's much harder to get someone else's browser to accept a cookie you made for a specific website.<p>Of course, cookies are still client-side data and should not be trusted. But XSS is not a problem here. Correct me if I'm wrong.
评论 #5481829 未加载
jtokoph大约 12 年前
I think cookie values are more of a risk for SQL injection or RCE than XSS. If the code that builds the session lookup query or cookie parsing code isn't safe, you're gonna have a problem.