dongshenghe1833 2013-05-02 11:24
浏览 37

PHP用户系统安全性

I have a small internal website for a charity, it's were the staff login to access documents and rota. Although it's only meant for certain users it is on the web so it's public therefore I'm still thinking about security. I need your opinions on the following because I'm not very experienced.

I've always stored two cookies when the user logs in. The first is their user id and the second a cookie id so people can't just change the user id and be logged in the cookie id needs to match. It's compared to the database every page. The problem is the cookie id is just a random number it will take no time for a PC to cycle through a range of a few hundred thousand combinations to find the matching ID for each user. So how can I stop this? Would PHP's uniqid be good enough?

What other attacks should I consider, apart from SQL Injection (already prevented)

Thanks

  • 写回答

1条回答 默认 最新

  • dsgk40568 2013-05-02 11:36
    关注

    Store the client IP of each session on the server.
    If the client IP for a session changes, then that's suspicious.

    Another thing would be to give sessions a lifetime.
    Like, invalidate a session if nothing happened for an arbitrary amount of time.

    Last but not least, do only store a random ID in the session database and map that to the user instead of storing the user-id directly into a cookie.

    评论

报告相同问题?

悬赏问题

  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 Revit2020下载问题
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线