authentication - Security model: log in to third-party site with user's credentials -


i develop service (service) automates actions users can on third-party site (3rd party site).

my service provides following functionality users:

  • the user registers @ service

    1. the user provides his/her 3rd party site username/password service
    2. the service uses credentials log in 3rd party site on user's behalf
    3. the service stores cookie issued 3rd party site in database
    4. from on, service starts log in 3rd party site regularly (cron) on user's behalf using stored cookie (the username/password 3rd party site not saved anywhere) , performs actions on users behalf on 3rd party site

use case diagram

notes:

  • before registering on service, user presented full information describing interaction between service , 3rd party site
  • there value in automating user's login 3rd party site , users interested in automating logins , actions on 3rd party site, i.e. interested in service doing work them @ 3rd party site
  • there no oauth functionality on 3rd party site
  • there no user authentication token functionality on 3rd party site

i have made research here @ stack exchange , have not found solutions:

moreover, reading through provided questions , answers tend think there no way secure user's login data (passwords or 3rd party site cookies). i.e. if attacker gets access service's server, attacker gets access users' accounts on 3rd party site well.

if try store 3rd party site's cookies in service's database encrypted, useful script decrypts them. therefore, access 3rd party site user account, attacker need not access service's machine, modify script (step 4) well.

storing cookie 3rd party site on service similar oauth, in case cookie used instead of token (no passwords stored).

what way design security model/architecture securely store user's login data @ service allow service login third-party site on user's behalf regularly without manual interaction user?

p.s. use django, guess security model/architecture not depend on technology stack.

to state obvious: important thing here of course not let attacker on site access cookies. cannot protect against this, since service need access cookies (in unencrypted form) regularly. attacker has compromised server in theory able service can do, if possible service access cookies, attacker rights able access them.

if still want this, should

1) make more difficult attacker access cookies

just give example of how can think this: if system compromised, attacker access file system. if cookies stored in plain text on files, attacker have easy time. storing them in database better (and want anyway), not better unless protect access database in way. dedicated attacker not have hard time if i.e. password database stored in applications configuration file.

a solution improve situation quite lot if cookies encrypted except when need them. best solution if encryption key not stored in application log, provided (typed in) operator every time server restarted. break attacker have read memory of application (not impossible @ all, still more difficult).

another measure store cookies in separate database on dedicated server , limit access server needed.

a complete strategy requires more intimate knowledge of exact physical , logical setup.

2) create mechanisms can detect if cookies compromised

this equally important. if happens, want know , able take action immediately. there of course standard ids systems can used. may create more targeted systems applies spesific application. system i.e. detect if running sql scans whole database table cookies. since know how own application behaves, can create monitoring system can detect if not normal happens.

3) prepare system invalidating cookies if detect stolen

the third party services have option log out , invalidate cookies. should prepare job stored cookies can activate. think difference in telling users may have had access service in 10 minutes before disabled cookies , telling them still have access third party service , don't know how stop them.

in addition this, of course important users understand when give access , provider of third party services approves of this. not obvious third party service provider allow kind of access. if do, may creating special session cookie i.e. bound ip address.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -