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

CSRF #70

Open
ynchuan opened this issue Dec 8, 2019 · 1 comment
Open

CSRF #70

ynchuan opened this issue Dec 8, 2019 · 1 comment

Comments

@ynchuan
Copy link
Owner

ynchuan commented Dec 8, 2019

cToken实现预防CSRF方法
  • 本地种下cToken cookie
  • 访问接口带上 cToken
  • 服务校验,只要cookie及请求中cToken两个字段值一直即可
cToken 原理
  • cookie是域安全的
  • 攻击站点请求接口,可以伪造cToken,但是无法向被攻击站点cookie注入cToken
@ynchuan
Copy link
Owner Author

ynchuan commented Oct 30, 2020

cToken为随机的且存在cookie中,由于域安全,其他站点拿不到ctoken,就无法攻击,除非通过xss攻击,可以拿到ctoken,并创建攻击请求,问题就变成如何预防xss攻击了

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

1 participant