I am trying to understand how SSL works. My understanding is, after you reach the server the first time (say https://www.google.com), the server sends you its public key. Your browser then checks to ensure this public key is valid (not expired, etc) and legit; the latter is done by checking it with the root CA, to ensure the signature of the public key matches what the CA has on the record. If it all checks out, then your browser will encrypt everything using that public key, and only the server can decrypt it (because only the server has the private key).
Now, think of an elaborate man-in-the-middle attack: every time my browser tries to check the CA, the middle server will reroute my request not to the CA, but to another server. That server verifies any signature! That way, even if I get the wrong certificate, my browser will not know. Which means my ISP can send me fake certs and eavesdrop my connection, for instance.
The safe-guard against this (and correct me if I am wrong) is that to check the cert with the CA, the browser establishes a SSL connection to the CA, but this time it doesn't need to verify the public key it gets from the CA; it knows the correct public keys for all CAs.
But how can I know if someone hasn't installed a fake certificate for a fake CA on my computer? How can I know that every time I upgrade my browser, something malicious is not being installed as well?