Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi all,

I have an HTML login page (form). Upon successful login, my perl script generates a session ID, which I embed in all the URL links. When the user logs out, I remove the session id from the session database. However, if I click the "Back" button, I get this error message: "The page cannot be refreshed without resending the information. Click Retry to send the information again, or click Cancel to return to the page that you were trying to view." When I click "Retry," the login information in the HTML form is re-sent to the web server. This is a big security hole. How do I disable this? I'm very new to web/PERL programming, so I'm not sure what other options I have. Any pointers are greatly appreciated. Thanks for your time and help.

Monica

Replies are listed 'Best First'.
Re: Session Expiration and Refresh Button
by jasonk (Parson) on Feb 20, 2003 at 22:46 UTC

    This is a fundamental flaw of the method you have chosen to authenticate people. If you are 'very new' to web programming, you should really use an existing authentication package, rather than try to reinvent a wheel you aren't qualified to reinvent. (Not trying to knock you, just saying that security is important enough that you should have some experience before you try and create your own.

    For some existing authentication implementations similar to what you are attempting, take a look at Apache::AuthCookieURL, Apache::MultiAuth, CGI::kSession, Apache::AuthPAM, or CGI::Session.

      Thanks for reading this issue and commenting on it. The links that you provided are useful, but I'm not sure if they would solve my problem. I believe that the fundamental problem is that the browser stores the post data information. It shouldn't do this. Even if I use cookies to store the session information, I would still have this problem. For example: The login page is an HTML form. When I get the login information from the form, my perl script will generate a session id. Let's say that I store this information in a cookie. If the user logs out, I delete the cookie. However, if the user now clicks the "back" button, the browser would re-send the login username/password without prompting the user for login information (security hole!). My perl script would then generate a session id.

      I know that login forms are used in various websites. I'm not sure how they solve this problem or if this is simply my own implementation issue. The wealth of information in the web on session tracking is dizzying, and it's confusing about what really works and what doesn't.

      Monica
Re: Session Expiration and Refresh Button
by Aristotle (Chancellor) on Feb 21, 2003 at 00:26 UTC
Re: Session Expiration and Refresh Button
by glwtta (Hermit) on Feb 21, 2003 at 21:13 UTC
    I have the same problem, in a more general sense. I generate a lot of dynamic pages, whenever anyone uses "back" to go to any of them after following a link, they are forced to resubmit the POST (even if this is immediately after the page was generated) - very annoying.

    This is with mod_perl on apache - is there a way I can control the "expiration" of a webpage from the server side?