An iPhone 4s can be updated up to iOS 9.3.5
To do that, set it back to factory settings, using iTunes on your computer. This will install the latest version for your device. If you create an encrypted backup in iTunes before that, your passwords will be included in the backup as well.