瞎扯淡 问一个有点坑爹的安全问题

paranoyang · December 11, 2011 · Last by night_song replied at February 04, 2012 · 3130 hits

简单的 mongoid+devise 配置好后,居然这样一句代码真能创建新用户:

curl -d "user[email][email protected]&user[password]=123456&user[password_confirmation]=123456" 172.18.43.52:3000/users

居然还真创建了一个用户... 这个过程密码是明文传输的啊?!

然后转念一想。。。莫非 ruby-china 也行? 然后试了一下:

curl -d "user[login]=parano&user[email][email protected]&user[password]=123456&user[password_confirmation]=123456" ruby-china.org/account

结果返回:

<html><body>You are being <a href="http://ruby-china.org/">redirected</a>.</body></html>

还真注册了一个账户... 我了个去........

你得到它了

加密需要传输层加密,https

防止机器注册可以用验证码之类的方式

木有 token 也可以?

#1 楼 @Rei 我真 got it 了.... thx

#2 楼 @hooopo 我也正好奇这个,表单里面是有 token 的

@paranoyang 表单里的 token 只是为了 保证 form post 是当前网站 传过来的 , 对于 直接开放的 接口,是可以 CSRF 的,这个时候就需要其他的 检查方式了,例如最基本的 过滤器 login_required

这个没办法的,第一次注册或者登录的时候,都是明文密码,除非 ssl 加密。

这种只有加验证码来防止机器恶意注册。

这个很多网站都有...

任何非 https 的登录都是不安全的。

在机场咖啡厅之类的地方,开个不加密的热点,然后在网络日志里搜 password 就能搞到各种密码,搜 set-cookie 就能搞到各种 cookie ...

You need to Sign in before reply, if you don't have an account, please Sign up first.