A device for detecting a man in the middle attack, comprising: one or more processors configured to: * provide a request to a host device associated with a host domain; * receive, based on the request to access the host domain, content of a web page from the host device, the content of the web page including information regarding verification code that identifies a verification domain and a resource, accessible via the verification domain, for verifying a public key certificate, wherein verifying the public key certificate comprises verifying, using the public key certificate, the binding of a public key with a domain identity and wherein the verification domain is different from the host domain; wherein the one or more processors being configured to receive the content of the web page comprises the one or more processors being configured to: - receive first code that identifies an affiliate domain to be used to access the verification code, the affiliate domain being different from the host domain and the verification domain, and the first code being different from the verification code; - execute the first code; - access the affiliate domain using an encrypted connection; and - receive the content of the web page based on accessing the affiliate domain; * execute the verification code; * request the resource from the verification domain based on the verification code; * determine whether the requested resource was received; and * selectively perform a first action or a second action based on whether the requested resource was received, - the first action, being performed when the requested resource was not received, indicating that the public key certificate is invalid; and - the second action, being performed when the requested resource was received, indicating that the public key certificate is valid, the second action being different from the first action. * provide a request to a host device associated with a host domain; * receive, based on the request to access the host domain, content of a web page from the host device, the content of the web page including information regarding verification code that identifies a verification domain and a resource, accessible via the verification domain, for verifying a public key certificate, wherein verifying the public key certificate comprises verifying, using the public key certificate, the binding of a public key with a domain identity and wherein the verification domain is different from the host domain; wherein the one or more processors being configured to receive the content of the web page comprises the one or more processors being configured to: - receive first code that identifies an affiliate domain to be used to access the verification code, the affiliate domain being different from the host domain and the verification domain, and the first code being different from the verification code; - execute the first code; - access the affiliate domain using an encrypted connection; and - receive the content of the web page based on accessing the affiliate domain; - receive first code that identifies an affiliate domain to be used to access the verification code, the affiliate domain being different from the host domain and the verification domain, and the first code being different from the verification code; - execute the first code; - access the affiliate domain using an encrypted connection; and - receive the content of the web page based on accessing the affiliate domain; * execute the verification code; * request the resource from the verification domain based on the verification code; * determine whether the requested resource was received; and * selectively perform a first action or a second action based on whether the requested resource was received, - the first action, being performed when the requested resource was not received, indicating that the public key certificate is invalid; and - the second action, being performed when the requested resource was received, indicating that the public key certificate is valid, the second action being different from the first action. - the first action, being performed when the requested resource was not received, indicating that the public key certificate is invalid; and - the second action, being performed when the requested resource was received, indicating that the public key certificate is valid, the second action being different from the first action.