DEV Community

Cover image for QR Code Phishing: Secure Scanning and DNS Defense
Mustafa ERBAY
Mustafa ERBAY

Posted on • Originally published at mustafaerbay.com.tr

QR Code Phishing: Secure Scanning and DNS Defense

QR codes are practical tools that are rapidly becoming widespread in our daily lives and business processes, but this convenience can be exploited by malicious actors. QR code phishing, or "quishing" attacks, use manipulated QR codes to direct users to malicious websites and can bypass traditional email-based phishing filters. To counter these attacks, user awareness, as well as network-level DNS-based proactive defense mechanisms, are of great importance.

This guide will cover in technical detail how quishing attacks work, individual precautions that can be taken on mobile devices, and especially how to build a strong defense line at the DNS level. You will understand the critical role of DNS filtering in protecting all devices on your network and blocking potential threats at the source.

What is QR Code Phishing (Quishing)?

QR code phishing, or commonly known as "quishing," is a type of phishing attack where cyber attackers use manipulated QR codes to direct users to fake or malicious websites. This method can be more insidious than traditional email or SMS-based phishing attacks because it doesn't directly display the URL. Users often cannot check where a QR code they scan from a physical poster or a digital document leads before scanning it.

Attackers try to trick their victims by creating legitimate-looking QR codes or altering existing ones. For example, a fake QR code bearing the logo of a bank or a government agency might direct users to a fake login page designed to steal personal information. This type of attack has become an increasing threat, especially with the widespread use of mobile devices.

ℹ️ Why is it Dangerous?

Quishing has the potential to bypass traditional cybersecurity measures. Email security gateways typically analyze text-based URLs but cannot directly scan embedded URLs in QR codes. This makes the initial stage of the attack more invisible.

How Quishing Attacks Work and Their Common Vectors

The fundamental principle of quishing attacks is to direct the user to a malicious URL. This process usually involves several steps, and attackers use various common vectors to trick their victims. The attack often begins with a URL shortening service or chained redirects, which helps conceal the true malicious target.

When a user scans a QR code, the browser on the mobile device decodes it and attempts to navigate to the embedded URL. If this URL is malicious, the user is directed to a phishing site, a malware download page, or other dangerous content.

Diagram

Common quishing attack vectors include:

  • Physical Environments: Attackers can paste fake QR codes that appear legitimate in public places (e.g., cafes, hotels, public transport). These codes often promise enticing information like Wi-Fi passwords, menus, or payment options.
  • Email and SMS: QR codes can be used in corporate emails or SMS messages regarding topics such as bill payments, account verification, or package tracking. These codes direct users to fake login pages.
  • Fraudulent Advertisements: Malicious actors try to lure users to scam sites by using QR codes in online advertisements or social media posts.
  • Modified Legitimate Codes: Sometimes, malicious codes can be pasted over existing and legitimate QR codes using small, transparent stickers, thereby altering the original code.

When developing the ERP for a manufacturing company, and working on supply chain integration and operator screens, I frequently evaluated scenarios where employees might be exposed to such physical or digital QR codes. I personally observed how critical user education and technical defenses are against these types of attacks.

Precautions to Take on Mobile Devices for Secure Scanning

Our mobile devices are the most common tools we use to scan QR codes, and therefore, they are primary targets for quishing attacks. However, with the right habits and some simple steps, we can enhance security on our mobile devices. These measures are the first and most important step for individual users to protect themselves.

First, it's always important to question the source of a QR code before scanning it. You should avoid scanning unknown or suspicious-looking QR codes. If you see a QR code purporting to be from a bank or an official institution, verify its authenticity by directly visiting the institution's official website or calling customer service. If the QR code is pasted on a physical surface, carefully check for any tampering or additions to the code.

💡 Preview Before Scanning

Many modern QR code scanner apps or your phone's built-in camera app offer a preview option instead of automatically opening the URL after scanning. Use this feature to check if the target URL looks legitimate. Carefully examine the URL; links containing typos, irrelevant domain names, or suspicious characters are red flags.

It's also beneficial to review the security settings on your mobile devices. Keep your device's operating system and QR scanner app updated. Using a reliable antivirus or mobile security solution can provide an additional layer of protection against malware. Additionally, ensure that your QR code scanner app doesn't have unnecessary permissions; for example, a scanner app doesn't need access to your personal contacts or microphone. Restricting such permissions can reduce the impact of a potential attack.

DNS Defense: The First Line of Defense Against Quishing

One of the most effective proactive defense mechanisms against quishing attacks is network-level DNS (Domain Name System) filtering. Access to any website begins with the resolution of a domain name to an IP address, and this process provides a critical control point for blocking access to malicious sites. DNS filtering protects all devices on your network by blocking known malicious domain names and phishing sites before a connection is even established.

When a user scans a malicious QR code and their device attempts to navigate to the harmful URL, this request passes through the DNS filtering system during DNS resolution. If the target domain name is on the DNS filtering system's blacklist, DNS resolution is blocked, and the user cannot access the malicious site. This ensures that the attack is stopped at the initial stage, before malicious content reaches the device. This approach provides comprehensive protection not only against quishing but also against phishing, malware, and other cyber threats in general.

⚠️ DNS Bypass Methods

While DNS filtering is a strong line of defense, it is not entirely foolproof. Attackers can bypass DNS filtering by directly using IP addresses or through VPN tunnels. Therefore, it is vital to combine DNS defense with other security layers (mobile device security, network segmentation, firewall rules).

Advantages of DNS filtering include providing network-wide protection, applicability to all devices (computers, mobile devices, IoT devices), and generally low system resource consumption. Various DNS filtering solutions are available, including public secure DNS services (e.g., Cloudflare DNS 1.1.1.2 for Families, Google Public DNS) and enterprise-grade DNS security platforms. In the infrastructure of my own side product or a client project, I have often emphasized the importance of DNS filtering when designing security layers; it provides a cost-effective and comprehensive first defense.

Steps to Implement DNS-Level Protection

Providing DNS-level protection requires different approaches for both home users and corporate environments. However, in both scenarios, the goal is to block DNS queries made to malicious domain names. These steps will significantly strengthen your network's overall security posture.

DNS Filtering for Home Users

Implementing DNS filtering in home networks is generally quite simple and can be done in a few ways:

  1. Modem/Router Settings: You can change DNS settings by logging into your home modem's or Wi-Fi router's administration panel. Under DHCP/LAN settings, you'll usually find primary and secondary DNS server entries. Here, you can enter the IP addresses of secure DNS servers like Cloudflare DNS for Families (1.1.1.2 and 1.0.0.2) or Google Public DNS (8.8.8.8 and 8.8.4.4). This change ensures that all devices connected to your network use these DNS servers.
  2. Device-Specific Settings: You can manually change DNS servers in the network settings of your mobile devices (phone, tablet) or computers. This is particularly useful for protecting your device when you are outside your home network. On Android, DNS configuration can be done under "Private DNS," and on iOS, under "Wi-Fi settings."
  3. Local DNS Resolvers (Pi-hole, AdGuard Home): For more advanced home users, you can create your own DNS filtering servers by installing software like Pi-hole or AdGuard Home on low-cost hardware such as a Raspberry Pi. These solutions offer much more detailed control and customizable blocking lists.

DNS Filtering for Corporate Environments

In corporate networks, DNS filtering requires a more centralized and comprehensive approach:

  1. Corporate DNS Servers: If in-house DNS servers (e.g., BIND, Windows DNS Server) are used, malicious domain name lists (blocklists) can be integrated into these servers. These lists are usually obtained from commercial threat intelligence services or open-source projects. In BIND 9, the blackhole directive can be used to redirect specific domain names to an address like 127.0.0.1.

    # Example BIND DNS server configuration (named.conf.local)
    # Zone definition to block malicious domain names
    zone "malicious-domain.com" { type master; file "/etc/bind/db.blackhole"; };
    
    # Contents of /etc/bind/db.blackhole file
    # $TTL 1D
    # @       IN      SOA     localhost. root.localhost. (
    #                         1         ; Serial
    #                         3H        ; Refresh
    #                         1H        ; Retry
    #                         1W        ; Expire
    #                         1D )      ; Minimum
    # @       IN      NS      localhost.
    # @       IN      A       127.0.0.1
    
  2. Commercial DNS Security Solutions: Commercial solutions such as Cisco Umbrella, Palo Alto Networks DNS Security, or Zscaler DNS Protection offer advanced threat intelligence, machine learning-based analysis, and more detailed reporting capabilities. These platforms are typically cloud-based and can also protect mobile users outside your network.

  3. DHCP Integration: To ensure that all devices on the network use the corporate DNS servers, it's crucial to ensure that primary and secondary DNS servers are correctly distributed in the DHCP server configuration.

  4. DNS over HTTPS (DoH) / DNS over TLS (DoT) Protection: Modern browsers and operating systems offer DoH/DoT support to encrypt DNS queries. In corporate networks, special proxy or firewall rules may be required to manage and control this traffic. In sensitive environments like a bank's internal platform, encrypting and auditing DNS traffic is critically important, along with ZTNA principles.

  5. Periodic Testing and Updates: Periodic tests should be conducted to ensure that DNS filtering systems are regularly fed with up-to-date threat intelligence and are functioning correctly.

ℹ️ Don't Forget to Test

After changing DNS settings, you should perform tests to ensure your system is using the new DNS servers. You can check DNS resolution with commands like nslookup google.com or dig example.com, then (safely) try to access a known test phishing domain to verify that the blocking mechanism is working.

Additional Security Layers and Integrations

While DNS defense is a strong first line of defense against quishing attacks, a comprehensive security strategy involves multiple layers. No single security solution alone can provide absolute protection against all threats; therefore, integrating DNS filtering with other security mechanisms is critically important. This integrated approach ensures that attackers are blocked at different stages and allows other layers to kick in if one layer is bypassed.

  1. Web Application Firewalls (WAF) and Reverse Proxies (Nginx): Placing a WAF or a reverse proxy (e.g., Nginx) in front of your corporate applications or websites can filter malicious requests. With Nginx modules like ngx_http_limit_req_module or ngx_http_access_module, you can implement basic rate limiting and access controls to mitigate DDoS or brute-force attacks. This provides an additional layer of protection, especially when a phishing site attempts to be hosted within your corporate infrastructure or an attacker tries to establish an outbound connection after somehow infiltrating your internal network.
  2. Endpoint Detection and Response (EDR) Solutions: EDR solutions running on users' mobile devices and work computers can catch threats that DNS filtering misses. EDR detects suspicious behavior, process injections, or file system changes on the device, identifying and stopping malware infections or post-phishing activities. When working on operator screens in a manufacturing ERP, I saw how important such endpoint protections were for the security of devices in field operations.
  3. Email and Gateway Security: Corporate email security solutions can analyze QR codes embedded in emails and block codes containing known malicious URLs. Although it's difficult to directly analyze QR codes, some advanced solutions offer image analysis capabilities to detect such content. Gateway-level firewalls, on the other hand, can inspect both inbound and outbound traffic, blocking suspicious connections.
  4. Zero-Trust Architecture: The Zero-Trust approach is based on the principle of "never trust, always verify." This requires continuously verifying the identity and authorization of every user and device, both inside and outside the network. In quishing attacks, even if a user is redirected to a malicious site, Zero-Trust principles can prevent that site from accessing internal resources or stealing sensitive data. This architecture provides an additional layer of security, especially in remote access (VPN/ZTNA) scenarios, by continuously checking the security of the user's device.
  5. User Education and Awareness: Despite all technical measures, the human factor can still be the weakest link. Conducting regular cybersecurity training and awareness campaigns helps employees recognize new threats like quishing and know how to react to them. It's important to organize social engineering tests within the company to measure how resilient employees are to such attacks and to tailor training accordingly.

This layered approach builds a more robust defense against complex and evolving threats like quishing. While DNS filtering cuts off initial contact, other layers enhance the ability to detect, contain, and remediate a potential breach.

Conclusion

QR code phishing (quishing) attacks are a subtle and effective type of cyber threat emerging at the intersection of the digital and physical worlds. With their potential to bypass traditional security measures, they pose serious risks to both individual users and corporate structures. As discussed in this article, adopting a multi-layered and proactive strategy is essential to counter these attacks.

Adopting secure scanning habits on mobile devices and increasing user awareness are critical individual precautions. However, network-level DNS-based defense mechanisms form the first and strongest line of defense against quishing. DNS filtering, with its ability to block known malicious domain names before a connection is even established, provides comprehensive protection for all devices on your network. This protection is effective not only against quishing but also against general phishing, malware, and other web-based threats.

Integrating DNS defense with additional security layers such as Web Application Firewalls, EDR solutions, advanced email filters, and Zero-Trust architecture is indispensable for corporate environments. It should be remembered that no matter how advanced technology becomes, the human factor and regular user education are integral parts of any cybersecurity strategy. Given that future cyber threats will become increasingly sophisticated, we must continuously review and update our security posture.

Top comments (0)