dpp3047 2013-01-04 19:05
浏览 60
已采纳

使用Facebook Connect和HTTP请求打破应用程序[关闭]

I have a voting app built on PHP that takes Facebook logins (uses PHP SDK). You need to connect with your Facebook account to vote. We decided to use Facebook logins to prevent vote frauds.

After logging in with the Facebook account, this is what happens:

  • The login page has the hidden variables- userId, accessToken, name, email, gender, location, hometown, and link to the user profile - all of which are returned from the Facebook login.
  • The user chooses an option in the poll and then the app records his choice along with his identification details (listed in the first point).

Now, here lies the problem. I can simulate an HTTP request with fake identification details and the app still thinks it's a legitimate request and so, records the vote. So, someone can set up a script to generate random identification details, send them over HTTP requests ultimately leading to a lot of fraud votes.

Maybe, after the poll closes, we can test with the profile URLs to see whether the profiles exist or not but again, two issues here:

  • The intruder may use a list of valid user profile urls to create the fraud votes. If he does, we have no idea to find whether the vote was fraud or not.
  • Isn't it a better idea to prevent fraud votes than sort out later?

So, is there a way to allow only legitimate logins through the app? Something like a test before recording the vote.

I guess, a CAPTCHA can help but that will interfere with a quick vote experience we want our users to have.

Thank You!

  • 写回答

1条回答 默认 最新

  • dongshen2903 2013-01-04 19:11
    关注

    Putting that stuff in the form, and doing nothing else is not the way to do this.

    How this should work:

    1. User authenticates with FB.
    2. You use $uid = $facebook->getUser(); to get the userid for the user who has just logged in. If it is 0, the login failed.
    3. Store the uid in the user's session.
    4. Let them vote.
    5. When the vote comes in, pull the uid out of the session. Ensure it is non-zero, ensure they have not voted before (if that is a restriction) and add their vote.

    EDIT
    Since I am not fully aware of the various methods available by the FB API, I would defer to @Igy on this (see his comment about retrieving an access token to verify the account). Though, I don't know what ability the user would have to be able to fake an account id returned by the API.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)
  • ¥15 AIC3204的示例代码有吗,想用AIC3204测量血氧,找不到相关的代码。