I develop a service (Service) which automates certain actions that users can do on another third-party site (3rd Party Site).
My service provides the following functionality for the users:
the user registers at the Service
- the user provides his/her 3rd Party Site username/password to the Service
- the Service uses that credentials to log in to the 3rd Party Site on the user's behalf
- the Service stores the cookie issued by the 3rd Party Site in its database
- from now on, the Service starts to log in to the 3rd Party Site regularly (cron) on the user's behalf by using the previously stored cookie (the username/password for the 3rd Party Site is not saved anywhere) and performs some actions on the users behalf on the 3rd Party Site
Notes:
- before registering on the Service, the user is presented with the full information describing the interaction between the Service and the 3rd Party Site
- there is a certain value in automating the user's login to the 3rd Party Site and users are interested in automating their logins and certain actions on the 3rd Party Site, i.e. they are interested in the Service doing some work for them at the 3rd Party Site
- there is no OAuth functionality on the 3rd Party Site
- there is no any user authentication token functionality on the 3rd Party Site
I have made a research here at Stack Exchange and I have not found any solutions:
- https://security.stackexchange.com/questions/1335/storing-third-party-auth-info-securely
- How save password of a third party application in my app for use with a api?
- How to securely store passwords used to log in on third party websites
- Rails storing third party credentials.. Anyone know best practice?
- http://12factor.net/config
- https://security.stackexchange.com/questions/31535/need-to-ephemerally-store-third-party-password
- i *must* store third party credentials in my database. best way?
- how to securely store a password for a 3rd party service in django?
- What is the best way to store password in database when API call requires sending of password in plain text?
- django & facebook: security & design for a facebook webapp that performs a third party login on behalf of the user
Moreover, from reading through the provided questions and answers I tend to think there is no way to secure the user's login data (passwords or 3rd Party Site cookies). I.e. if an attacker gets an access to the Service's server, the attacker gets the access to the users' accounts on the 3rd Party Site as well.
If I try to store the 3rd Party Site's cookies in the Service's database encrypted, then they will be only useful to the script that decrypts them. Therefore, to get access to the 3rd Party Site user account, the attacker would need to not only get an access to the Service's machine, but to modify the script (step 4) as well.
Storing a cookie for the 3rd Party Site on the Service is really similar to OAuth, but in this case a cookie used instead of a token (no passwords are stored).
What is the way to design a security model/architecture to securely store user's login data at a service to allow the service to login to a third-party site on the user's behalf regularly without manual interaction with the user?
P.S. I use Django, but I guess that the security model/architecture does not depend on a certain technology stack.