A developer is creating a new mobile application for a company. The application usesREST APIandTLS 1.2to communicate securely with the external back-end server. Due to this configuration, the company is concerned aboutHTTPS interception attacks. Which of the following would be thebestsolution against this type of attack?
Correct Answer: D
Comprehensive and Detailed in-Depth Explanation:
Understanding HTTPS Interception Attacks:
HTTPS interception attacks occur when aman-in-the-middle (MitM)interceptsHTTPS trafficbetween a client and a server.
Attackers can useproxy certificates, installmalicious root certificates, or use tools likeSSL strippingto compromise secure connections.
In mobile applications, attackers may exploittrusted root certificatesinstalled on devices to intercept and decrypt HTTPS traffic.
Why the Correct Answer is D (Certificate Pinning):
Certificate Pinningensures that the mobile applicationonly accepts a specific certificateorpublic keywhen communicating with the back-end server.
Even if an attacker installs amalicious root CA certificateon the device, the app willreject the intercepted or forged certificatebecause itdoes not match the pinned certificate.
Pinning effectivelyprevents HTTPS interceptionas it requires theexact certificate or keyrather than just any certificate signed by a trusted root.
How Certificate Pinning Works:
During development, the applicationstores a hash of the server's certificateor public key.
Upon connection, the appcompares the received certificatewith the pinned hash.
If they do not match, the connection isterminated.
Example Implementation in Android (Java):
java
CopyEdit
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection(); connection.setSSLSocketFactory(getPinnedSSLSocketFactory()); The getPinnedSSLSocketFactory() method uses ahard-coded or dynamically updated certificateto validate the server.
Why the Other Options Are Incorrect:
A: Cookies:
Cookies are used forsession managementanduser authentication.
They do not preventcertificate spoofingorHTTPS interception.
B: Wildcard certificates:
Wildcard certificates allow multiplesubdomainsto be covered under one certificate.
They do notprotect against MitM attacksand can actuallyincrease riskif compromised.
C: HSTS (HTTP Strict Transport Security):
HSTS ensures that a browser always usesHTTPSwhen connecting to a server.
Itprotects against SSL strippingbutdoes not defend against HTTPS interceptionwhen a malicious root certificate is present.
It is more suited forweb applicationsthan mobile apps.
Real-World Scenario:
A banking app usingcertificate pinningcan detect andblock fake certificatesinstalled by malicious actors.
Without pinning, users in environments with compromisedroot CAscould unknowingly connect tomalicious proxy servers.
Notably, some public Wi-Fi networks that performHTTPS interceptionfor monitoring would also fail to work with such apps, indicatingadded security.
Extract from CompTIA SecurityX CAS-005 Study Guide:
TheCompTIA SecurityX CAS-005 Official Study Guidehighlights thatcertificate pinningis crucial formobile applicationsthat rely onREST APIs. It provides robust defense againstHTTPS interceptionby strictly validating the server's certificate. This practice is recommended especially when dealing withsensitive data transmission.