Disclaimer: I created Easy Passwords extension as a hobby, it could be considered a LastPass competitor.
I looked into the security design of Last Pass recently, and it seems that I've got a good idea where to look for issues. So while paj28 gave a very good general answer about password managers, I can provide some details.
It's important to understand that the main security token with password managers like LastPass is your master password. If LastPass servers get compromised (or if a LastPass employee turns evil) then this master password is what prevents the attackers from decrypting all your passwords. If they manage to guess it then all your passwords will be gone. Consequently, LastPass tries to make it hard to intercept or guess your master password. This means in particular that the LastPass login form doesn't actually send the master password as you entered it. Instead it uses PBKDF2 in order to derive a new password that is then sent to LastPass.
I can see two potential weaknesses here. First one is the login form available on lastpass.com. If we don't trust LastPass servers (and we don't, because why else would we encrypt the password data?) then this login form should never be used. If the servers are compromised the attackers could manipulate this login form in order to get your master password before PBKDF2 is applied - it's unlikely that you will notice anything weird, yet the attackers will be able to get the password and decrypt your data stored on the server. Unfortunately, LastPass browser extensions currently use pages from lastpass.com for some of their user interface - so when you see a login form, it might be non-trivial to verify that it doesn't come from the web.
The more complicated approach requires bruteforcing your master password, particularly if the password you are using isn't very strong. PBKDF2 cannot be reversed, so this involves generating lots of guesses, applying PBKDF2 to the guesses and checking whether you get the expected result with any of them. PBKDF2 is designed to be computationally intensive so that bruteforcing won't succeed, yet it is essential to choose the number of iterations used by the algorithm as high as possible.
How many iterations does LastPass use? On the client side the default is merely 5,000 iterations. We have year 2016, and this number should be considered way too low when confronted with contemporary hardware. Documentation explains this default with the necessity to support Internet Explorer 7 and smartphones. Well, I don't think that Internet Explorer 7 is still supported, and even if you use a smartphone you should definitely change this setting and test whether it will be able to handle at least 100,000 iterations.
There is a tweak to this: LastPass claims to add another 100,000 iterations on the server side! So before storing your derived password they will apply PBKDF2 to it again. This definitely makes sense, and it is a good measure if a successful attacker merely copies the data from the LastPass server. However, the attacker could also start intercepting passwords as these are being received by the LastPass server, before additional hashing is applied. So when you log in with your LastPass extension they will intercept a derived password with merely 5,000 iterations which will be considerably easier to bruteforce.
So much for the general architecture, it has its weak spots but all in all it is pretty solid and your passwords are unlikely to be compromised at this level (or maybe they are, see update below). However, as described in my blog post the browser integration turned out to be a massive weakness. The LastPass extension on your computer works with decrypted data, so it needs to be extra careful - and at the moment it isn't.
This starts with Auto Fill functionality which is known to be a bad idea since at least 2006. A password manager filling in passwords automatically means that any reflected XSS vulnerability in a website immediately exposes the user's password, which is why password managers usually require user interaction before the password is filled in. The blog post also goes into how URL parsing component of this critical functionality is unnecessarily error-prone, which in the past resulted in exposure of passwords for websites that the attacker didn't control.
It's obviously a good idea for such an extension to limit interaction with websites to the bare minimum and review parts touching websites very carefully. This doesn't appear to have happened, with all kinds of LastPass functionality acting within websites' domain. Sometimes this is completely unnecessary, like different parts of the extension communicating via window.postMessage()
rather than using extension-specific messaging APIs. Sometimes it is merely semi-unnecessary, such as the complex messaging API for communication with lastpass.com (something that wouldn't be necessary if the entire user interface were contained within the extension). But it look like in all cases the security implications weren't thought through properly.
I have to stress that this is merely capturing the current state of LastPass. They might get their act together: get rid of mixing web pages with extension pages, adjust security-relevant defaults for modern hardware, limit the number of communication channels within the extension exposed to website, stop generating HTML code dynamically etc. What they have there can be secure, and I also looked at a competing extension which does mostly the same thing without any potential security issues.
Update (2018-01-30): Originally, I looked mostly into the LastPass browser extensions and it seems that I relied too much on the official documentation as far as the server's inner workings go. Now I tried to understand the server-side mechanisms better and realized that a number of issues could expose your data here as well. I'm listing the less serious and/or already publicly documented issues here, the other ones being still under investigation by LastPass:
- As you can see yourself by opening up https://lastpass.com/getaccts.php while logged in, the LastPass vault is by no means an encrypted blob of data. It rather has encrypted data here and there, while other fields like the URL corresponding to the account merely use hex encoding. This issue was pointed out in this 2015 presentation and more fields became encrypted since then - still by far not all of them however.
- Same presentation scolds LastPass for their use of AES-ECB for encryption. Among other things, it gives away which of your passwords are identical. LastPass has been transitioning to AES-CBC ever since, yet when I looked at my "vault" I saw a bunch of AES-ECB-encrypted credentials there (you can tell because AES-ECB is merely a base64-encoded blob whereas the LastPass variant of AES-CBC starts with an exclamation mark).
- One Time Passwords should be handled with care, these are backdoors into your vault. Yet LastPass considers it to be a good idea to create one automatically without telling you and hide the corresponding setting rather far. If you look at the documentation you will learn that somebody with access to both your device and email will be able to take over your account, something that is considered a low risk. Maybe one of your co-workers played a prank on you by sending an email in your name because you forgot to lock your computer - next time they might take over your LastPass account even if you are logged out of LastPass.
- Speaking of being logged out, the default session expiration time is two weeks. While certainly being convenient, there is a reason why most products handling sensitive data have much shorter session expiration intervals, typically well below one day.
- For combining a value with a secret (e.g. as a signature) one would usually use SHA256-HMAC. LastPass uses a custom approach instead, applying SHA256 hashing twice. While the attacks that HMAC is meant to address don't seem to play a role here, I wouldn't bet on somebody with better crypto knowledge than me not finding a vulnerability here after all. Also, the server side will occasionally produce some SHA256 tokens as well - I wonder what kind of humbug is going on where I cannot see it and whether it's really secure.