My team and I are writing a web-app in PHP5.5, with a database that (amongst other things) has a typical username and passhash lookup for user authentication.
We're looking at ways of preventing more than a relative number, say 8, incorrect logins. This is a web-app for about 7000 students, whom when on one of 4 campuses networks, will all share the same outgoing IP address. Currently, failed log ins are logged in a table as a timestamp and an IP address, as well as the username attempted (which is a foreign key) or NULL if the username was incorrect.
We've thought of some methods already, but all pose a security flaw or issue:
Storing the user-agent string: Many computers are standardised across the schools and produce identical user agent strings
Storing local/network IP addresses: Currently no reliable and efficient method of evaluating this
Give each user a unique ID and store in cookie: Sessions can easily be refreshed, cache cleared, different browser, etc.
If there is some way of reliably identifying users behind a small network address using PHP or MySQL, ideally we'd be comparing the number of recent login attempts from that address. This way we'd be able to lockout (serverside) just that one user.
I'm wondering what methods sites with larger userbases use effectively.