English 中文(简体)
在ASP.NET(C#)中实施安全、独特的“单一用途”启动
原标题:
  • 时间:2009-06-02 05:37:17
  •  标签:

我的假设是,我正在建设的一个网站的用户需要能够将一些基本信息输入网络,而不必登录。 该网站正在与ASP开发。 NET/C#,正在使用《2005年多指标类集调查》的数据。

用户将从网站发送电子邮件,提供独特的链接,以输入所需的具体信息。 电子邮件将与我们大家在登记论坛等场所时收到的电子邮件方式非常相似,这些网站含有一种随机生成、独特的URL paramter,具体涉及单一目的(例如为论坛核实电子邮件地址)。

我询问这一问题是否得到安全执行。 我正在考虑使用国际统一私法作为独特的识别标志,但不清楚它在安全世界的影响。

  1. Is a GUID sufficiently long enough such that values cannot be easily guessed (or brute-forced over time)?
  2. 从“关键空间”中产生所有可能价值观的同等机会的意义上来说,NET GUID的杂质吗?

  3. 如果采用统一格式是一种可以接受的办法,则该网址是否应当通过URL的重写或将信息与统一格式的数据表联系起来作为参考?

  4. 是否使用URL重写来掩盖数据的真实来源?

  5. 我是否应考虑使用TSQL s SlectT NewID()作为GUID的生成者,来实施互联网?

  6. 我对待这一问题的做法完全是错误的?

非常感谢

Carl

最佳回答
  1. Yes, 2128 is long enough.
  2. No, GUID implementations are designed to generate unique GUIDs rather than random ones. You should use a cryptographically secure random number generator (e.g. RNGCryptoServiceProvider) to generate 16 random bytes and initialize a Guid structure with that.
  3. Yes, it s an acceptable approach overall. Both will work.
  4. Yes, if you don t give out any other clues
  5. No, goto 2
  6. No, it s pretty OK. You just need to use a cryptographically secure random number generator to generate the GUID.
问题回答
  1. No, GUIDs are not fully random, and most of the bits are either static or easily guessable.
  2. No, they re not random, see 1. There is actually a very small number of bits that are actually random, and not cryptographically strong random at that.
  3. It s not, see 1 and 2.
  4. you can, but dont need to... see my solution at the end.
  5. No, see 1 and 2
  6. Yes.

What you should be using instead of a GUID, is a cryptographically strong random number generator - use System.Security.Cryptography.RNGCryptoServiceProvider, to generate long (say, 32 bytes) string of data, then base64 encode that.
Also, assuming this is some kind of registration with sensitive data, you d want to time limit the validity of the link, say 60 minutes, or 24 hours - depends on your site.
You ll need to keep a mapping of these values to the specific users. Then you can automatically present him with the proper form as needed. Dont need to do url rewriting, just use that as the user s identifier (on this page).
Of course, dont forget this URL should be HTTPS...

Btw, 只是一份说明——在电子邮件中采用某种形式文本的良好惯例,它解释说,用户应当点击匿名电子邮件中的联系,而且通常情况下,你的网址是发的,在点击空白后,他们永远不应进入密码......。

Oh, almost forgot - another issue you should consider is what happens if the user wants several emails sent to him, e.g. hits register several times. Can he do this over and over again, and get many valid URLs? Is only the last one valid? Or maybe the same value gets resent over and over again? Of course, if an anonymous user can put in a request for this email, then DoS may become an issue... not to mention that if he puts in his own email, he can put in any random address too, flooding some poor shmuck s inbox and possibly causing your mail server to get blacklisted...
No one right answer, but needs to be considered in context of your application.

在数据库中设立一个连接信息数据库和一个日期栏,列出链接发送日期。 表格和返回联系 Id,将链接ID确定为启动链接的查询参数。 启用网页上载重上链接,并用该链接检索存储程序,在接连线通过后,将回复日期。 顺便提一下,当你接回日期时,你会再加多多长时间,希望通过使用Add.Days()来保持联系。 添加“C#”方法。 然后将日期与今天的日期相比较。 如果它已经过了数天或数月,就会发出错误信息,或者继续显示页数。 我恳请你把该页的内容放在一个小组中,并把它与“false”相对照,这样,如果这个日期仍然在范围之内,小组就只能看上去“真实”。





相关问题
热门标签