duandou1903 2011-01-26 22:38
浏览 22

试图用PHP安全地发送帖子数据的缺陷

This is my hackish attempt to learn / understand secure(ish) sending of post data. Constructive criticism welcome.

This is just theory, not much code. Also, I'm using PHP's SHA1() in the examples, only because I have put time in understanding its internals. I know theres other (better?) algorithms (example: MD5()) so swap out for your favorite.

1) Server generates a random salt rand(min, max), sends it with the page upon request, computes and stores the SHA1(un:pw:salt) along with the server timestamp of the request (to a database)

1a) Note : salt is sniffable, so assume hacker knows salt (can you un-SHA1() something, to get the SHA1'd data out?)

2) User inputs username and password clicks submit

3) Submit fires a JavaScript function (packed for obfuscation, yeah I know, this does not add true security) that SHA1(un:pw:salt), then posts only that result to the server

3a) Note : encrypted credential is sniffable

4) Server checks that the received credentials match what it stored in the database, and arrive within a timeframe (5 min or so) since the initial request. allow / deny decision is made.

Further requests alter the salt, so even if someone sniffed the encrypted data, it would be useless after a) user makes new page request b) timeframe expires

Thoughts?

Edit: also, assume all the strip tags / SQL hacks / < > etc... injections are dealt with appropriately.

  • 写回答

2条回答 默认 最新

  • duancan8382 2011-01-26 22:56
    关注

    Use https and move on to the next problem!

    评论

报告相同问题?

悬赏问题

  • ¥15 随身WiFi网络灯亮但是没有网络,如何解决?
  • ¥15 gdf格式的脑电数据如何处理matlab
  • ¥20 重新写的代码替换了之后运行hbuliderx就这样了
  • ¥100 监控抖音用户作品更新可以微信公众号提醒
  • ¥15 UE5 如何可以不渲染HDRIBackdrop背景
  • ¥70 2048小游戏毕设项目
  • ¥20 mysql架构,按照姓名分表
  • ¥15 MATLAB实现区间[a,b]上的Gauss-Legendre积分
  • ¥15 delphi webbrowser组件网页下拉菜单自动选择问题
  • ¥15 linux驱动,linux应用,多线程