security - PHP Login page and home page in single page, is it advisable? -


i have simple web app , did login page , homepage in 1 page. here scene:

#php login script goes here inc. database config , authentication if(!login()) {  <html> <head> <title>homepage</title> <css goes here> <js goes here> <body>  [ login form goes here ]  </body> </html>  } else {  #php main page script goes here inc. database config , authentication <html> <head> <title>homepage</title> <css goes here> <js goes here> <body>  [ main page if login ]  </body> </html> } 

my question is, advisable chop instead of redirecting different/success page? affect speed , security or vulnerability?

there vulnerability if form posts index.php.

this because susceptible in following scenario:

  1. alice logs in , views logged in home page news.
  2. alice's login session times out.
  3. alice goes lunch.
  4. carol loads browser's developer tools , clicks refresh.
  5. the browser resubmits post data login form.
  6. the username , password visible in browser tools of carol makes note of use maliciously @ later time.

this example scenario , why owasp recommend redirecting after login, prevents post data being cached in browser.

in above example carol execute attack after renewing session alice had thought had timed out, or if alice had logged out explicitly carol have clicked logged in home page , refreshed , post data refreshed in scenario.

however, if redirect user, same page, there no http 200 response login credentials not cached.


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -