2

こんにちは、私は PayPal の寄付システムをセットアップし、非表示の値を持つフォームを使用してボタンを作成しています。人々がソースを見て、これらの値を見ることができるという事実を考えただけです。次のようなものが表示される場合、セキュリティ上の脅威はありますか?

<form action="https://www.paypal.com/cgi-bin/webscr" method="post">  
    <input type="hidden" name="cmd" value="_xclick">  
    <input type="hidden" name="business" value="myemail@myemail.com">  
    <input type="hidden" name="item_name" value="Coyote Pack">  
    <input type="hidden" name="item_number" value="200">  
    <input type="hidden" name="amount" value="4">  
    <input type="hidden" name="no_shipping" value="0">  
    <input type="hidden" name="no_note" value="1">  
    <input type="hidden" name="currency_code" value="USD">  
    <input type="hidden" name="lc" value="AU">  
    <input type="hidden" name="bn" value="PP-BuyNowBF">  
    <table>
<tr><td>Player Unique ID</td></tr><tr><td><input type="text" name="custom" maxlength="200"></td></tr>
</table>
    <input type="submit" border="0" name="submit" alt="PayPal - The safer, easier way to pay online." value="Coyote Pack - $4">   
</form>

私の質問は彼らがそれを見ていないと思いますが、彼らはそれをいじって PayPal に何らかの方法で偽の値を与えることができますか?

たとえば、私は IPN を実行しており、データベースはその item_number を使用して寄付者に特定の権限を与えています。誰かが私のコードをコピーして自分のウェブサイトに貼り付け、「金額」をゼロに変更して無料のものを手に入れることはできますか?

4

1 に答える 1

0

最善の解決策はこれです。あなたのipnで言う:

if(preg_match('@^[0-9a-zA-Z\s]+$@', $itemName) == 1){ // connect to database to retrieve price; }

そして言う

if($priceShouldBe != $pricePaid){ // request was modified and the user did not pay the right price; exit; }

そして最後に言う

if(preg_match("@^[0-9]+$@", $customVariable) == 1){ /* Check database and then proceed to update database; THIS IS ASSUMING YOU'RE PASSING A NUMERICAL USER ID; Update whatever you need to in the database because the price is right, the name isn't an sqli attempt and the UserId is not an sqli attempt */ }
于 2013-09-12T03:42:08.917 に答える