關於表單的惡意提交

來源:互聯網
上載者:User

對於每一個表單,現在可以增加兩個hidden元素:

拿使用者登入做個例子:

<form action="login" method="post">    <input type="hidden" name="p1" value="1234564"/><br/>    <input type="hidden" name="p2" value="a2bd345684a21456ae7a4fa6af"/><br/>     username:<input type="text" name="username"/><br/>     password:<input type="password" name="password"><br/>     <input type="submit" value="Login"/></form>

其中p1是根據系統時間的毫秒數:

p2是自己寫的一個函數對p1加密後的字串。

而且後台還規定p1距離目前時間超過60s則認為表單已經到期。

這樣,如果我改了p1的值, 因為不知道產生p2的具體演算法,後台就會知道p1和p2不匹配,對於這樣的表單就不用處理了。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.