<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Davi Moura on Medium]]></title>
        <description><![CDATA[Stories by Davi Moura on Medium]]></description>
        <link>https://medium.com/@davimouar?source=rss-87e90529fb2a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CRIuB2aNkgniXa08jpqLWQ.jpeg</url>
            <title>Stories by Davi Moura on Medium</title>
            <link>https://medium.com/@davimouar?source=rss-87e90529fb2a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 21:39:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@davimouar/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Tap to Exploit: Analyzing and Manipulating Mastercard Contactless Transactions (Part 2)]]></title>
            <link>https://medium.com/@davimouar/tap-to-exploit-analyzing-and-manipulating-mastercard-contactless-transactions-part-2-05d709f3e766?source=rss-87e90529fb2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/05d709f3e766</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Davi Moura]]></dc:creator>
            <pubDate>Mon, 08 Jun 2026 18:55:23 GMT</pubDate>
            <atom:updated>2026-06-08T18:58:30.677Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome to Part 2. If you haven’t read Part 1 yet, start there : <a href="https://medium.com/@davimouar/tap-to-exploit-analyzing-and-manipulating-mastercard-contactless-transactions-part-1-732c124fb7b4"><strong>LINK</strong></a></p><p>In Part 1, I covered the card side: how a Mastercard contactless chip processes transactions, what it accepts without verifying, permissiveness in transactions.</p><p>Now let’s go further! From attempts to connect to the backend, through the POS terminal, to technical analysis of the EMV tags of each Mastercard card analyzed.</p><h3>8. Backend Validation Attempts</h3><p>The previous sections of the part 1 demonstrated that, within the terminal↔card scope, the Mastercard chip:</p><ul><li>Does not cross-reference 9F34 (CVM Results) with 9F02 (value) locally</li><li>Does not generate independent CVM evidence in the IAD CVR that would allow the backend to distinguish Online PIN from NoCV (section 8.6)</li><li>Accepts invalid ISO parameters, impossible dates, and non-existent currencies without rejection</li><li>Fully delegates risk decision-making to the issuer’s backend</li></ul><p>The natural question that follows is: <strong>Does the issuer’s backend and/or the Mastercard network perform this cross-validation when receiving the online transaction?</strong> To investigate this question, three independent attempts were made to submit captured EMV data, including deliberately manipulated or contradictory fields, to commercial payment gateways in a sandbox environment.</p><p>The goal of these attempts was not to obtain a definitive answer about the behavior of the actual issuer (which would require a production transaction with a connected acquirer), but rather to determine if the gateway’s intermediate layer performs any logical consistency validation between EMV fields before routing the transaction to the network.</p><h3>8.1 Stripe Integration via SDK</h3><p>The Stripe API was integrated into the terminal SDK in a sandbox environment, capable of initiating a contactless transaction, capturing the returned EMV data (PAN, Track2, 9F26, 9F27, 9F34, 9F10, 95, 9F36, 9F37) and sending a request to the Stripe API (<em>/v1/payment_intents</em>).</p><h4><strong>Implemented architecture</strong></h4><p>The system consists of 4 C# components integrated into the Terminal Windows SDK:</p><p><strong>EmvTlvParser.cs</strong> (namespace SDKTest.MastercardGateway): Generic TLV parser that receives the hex string from <em>cardInfo.getIcTracks()</em> and returns a dictionary <em>{tag → value}</em>. Supports 1-byte and 2-byte tags, short length (&lt; 0x80) and long length (multi-byte).</p><p><strong>StripeTransactionBuilder.cs </strong>(namespace SDKTest.StripeGateway): Receives the <em>CardInfo</em> from MPOS and constructs the <em>application/x-www-form-urlencoded </em>parameters for the endpoint <em>/v1/payment_intents</em>. Detects the card brand via AID (tag 84, priority) or BIN (fallback), and maps it to the corresponding Stripe test PaymentMethod token (<em>pm_card_mastercard</em>, <em>pm_card_visa</em>, etc.). The actual EMV data is sent as <em>metadata[]</em> fields.</p><p><strong>StripeGatewayClient.cs</strong> (namespace SDKTest.StripeGateway): HTTP client that implements Basic Auth with <em>sk_test_xxx</em> as username and empty password, enforces TLS 1.2, and performs POST/GET against <em>https://api.stripe.com/v</em>1.</p><p><strong>Form2.cs</strong> (namespace SDKTest): Main form integrated into the existing SDK flow. The integration was done within Form2 (contactless transaction screen) and not in a separate form, so that the submission to Stripe occurs automatically at the end of the card reading, without additional operator intervention.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VdUam8tzlaZ05vqkciyQCw.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DXMTYeOXwmlQ&amp;type=text%2Fhtml&amp;schema=google&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FXMTYeOXwmlQ" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/359128b4d5ec91495ff28d08ca404a67/href">https://medium.com/media/359128b4d5ec91495ff28d08ca404a67/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/409/1*q35krpQigruMlEzlFCkUHQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ROJoe9dnk3djqCHt2AJT0A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/362/1*wSc8PZdoiyEHKcUOnzf7gw.png" /></figure><h4>Analysis</h4><p>The transaction returned <strong><em>”status”: “succeeded”</em></strong> with ”<strong><em>network_status”: “approved_by_network</em></strong>”.</p><p>However, detailed analysis of the response revealed that:</p><ul><li>The returned <em>last4</em> field was <em>”4444&quot;</em>, corresponding to the generic Stripe test PAN (<em>5555555555554444</em>), not the real card.</li><li>The identified issuer was <em>”CIAGROUP”</em> (a simulated Stripe issuer)</li><li>The returned expiration date (<em>04/2027</em>) did not match the real card’s expiration date</li><li>The <em>livemode</em> field confirmed <em>false</em></li></ul><p>The integration code detected the card brand read by the terminal (via AID A0000000043060 = Mastercard/Maestro) and selected a Stripe test PaymentMethod (<em>pm_card_mastercard</em>), discarding all captured real EMV data. The EMV tags (9F26, 9F34, 9F10, etc.) were sent only as metadata, informational fields associated with the transaction, but not processed by the Mastercard network.</p><p>The combination that deserves attention is a contactless transaction of 2000.00 BRL completed without cardholder verification (9F34 = 1F0002), well above the typical Brazilian no-CVM limit. To be precise about the scope: in this execution, the NoCVM result was the natural behavior of the terminal, as I configured the DF8124 tag for a higher limit, and it was processed by the Stripe test environment (sandbox), not by a real issuer.</p><p>The <em>pm_card_mastercard</em> is a hardcoded test token that the Stripe sandbox automatically approves, independent of any EMV context. The approval does not validate the ARQC, does not check the CVM, and does not query the actual issuer. Any input, including a non-existent card, would produce the same result.</p><p>The mPOS returned <em>CardType = 3</em> in the <em>onReadCard </em>callback. The values ​​documented in the SDK are: 0 = magstripe, 1 = IC chip, 13 (0x0D) = NFC contactless. The value 3 is not in the official documentation, but the transaction was performed via contactless proximity. This likely corresponds to PayPass Magstripe mode (MSD, Magnetic Stripe Data), where the NFC terminal emulates a magnetic stripe reading. The metadata recorded <em>m6plus_entry_mode: “magstripe” </em>due to this fallback in the switch, but the actual capture mode was contactless NFC.</p><h4><strong>Conclusion:</strong></h4><p>The Stripe sandbox does not process EMV data from uncertified endpoints. The <em>payment_intents</em> API in card-not-present mode treats EMV fields as opaque metadata and uses predefined test tokens to simulate responses. No conclusions about CVM or ARQC validation can be derived from this test.</p><p>The value of the test lies in validating the complete pipeline: EMV reading by the Terminal → TLV parsing → tag extraction → flag detection → HTTP sending → response processing → multi-channel notification. <strong>This entire path works correctly and would be reusable with any gateway that accepts EMV card-present data or for real-world endpoint implementation by a bank.</strong></p><p>To send real EMV data via Stripe in live mode, the following would be necessary:</p><ol><li>PCI-DSS Level 1 Certification:</li><li>Hardware certified by the Stripe Terminal program</li><li>Certification as a Stripe Terminal Integrator (SCPI)</li></ol><h3>8.2 Mastercard Payment Gateway Services (MPGS)</h3><p><strong>MPGS (<em>test-gateway.mastercard.com</em>) is Mastercard’s own card-present payment gateway.</strong> The API documentation indicates explicit support for EMV fields via <em>emvRequest</em>, including tags such as 9F26, 9F27, 9F34, 9F10, 95, among others. The response includes <em>emvResponse</em> with tag <strong>91 (ARPC) and tag 72 (Issuer Scripts)</strong>.</p><p>It was the most promising candidate because it is operated by Mastercard itself and accepts EMV fields as part of the authorization request.</p><h4>Results</h4><p>Test credentials could not be obtained. MPGS is not a self-service product. Access to the test gateway requires credentials provided by a Payment Service Provider (PSP) that has a commercial contract with Mastercard for use of MPGS.</p><p>Attempting to create a project on the Mastercard Developers Portal (<em>developer.mastercard.com</em>) confirmed that the APIs available via self-service (MDES, Send, BIN Lookup, etc.) do not include MPGS. The official message is:</p><p>“<em>To access an MPGS test account, use the Merchant Administration site at test-gateway.mastercard.com with credentials provided by your payment service provider.</em>”</p><p>MPGS is distributed as a white-label service to banks and acquirers, who then resell it to merchants. The PSPs that use MPGS are predominantly international (Network International, Global Payments, ANZ Worldline, HSBC Merchant Services). In Brazil, the major acquirers (Cielo, Rede, Stone, Getnet, PagSeguro) use their own gateways and not MPGS.</p><p>The most suitable gateway for EMV validation testing, being from Mastercard itself and natively accepting EMV fields, is inaccessible without a commercial intermediary. This represents a structural barrier to independent security research in the EMV ecosystem.</p><h3>8.3 Adyen</h3><p>Adyen is one of the largest global payment processors and offers free sandboxing via self-service. Two APIs were explored:</p><p><strong>Terminal API</strong>: Nexo protocol for card-present transactions. Accepts EMV data natively, but requires a <strong><em>POIID</em> (Point of Interaction ID)</strong> in the format <em>[model]-[serial]</em> from a certified Adyen physical terminal.</p><p><strong>Checkout API</strong>: Endpoint <em>/v71/payments</em> with EMV fields via <em>additionalData</em>. This was the approach tested.</p><h4>Planned Scenarios</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/655/1*nY9eaibAAOqwMFR2SEiz4A.png" /></figure><p>The goal was to submit EMV data with increasing logical inconsistencies and observe at what point the gateway would reject it. If Scenario 2 (explicit contradiction between TVR and 9F34) was accepted, this would indicate a lack of cross-validation at the gateway layer.</p><h4>Analysis</h4><p>Even with the correct configuration of credentials and permissions, the Checkout API processes transactions as card-not-present (e-commerce). EMV fields sent would be stored as metadata, not validated as EMV data from a card-present transaction. Adyen, like Stripe, maintains a strict architectural separation between card-present and card-not-present flows. EMV data is only processed when originating from Adyen-certified terminals via the Terminal API.</p><h3>8.4 Consolidated Analysis</h3><p>The three attempts to submit EMV data to commercial gateways did not produce a conclusive experiment on cross-validation of fields by the authorization backend. The initial question, whether the issuer cross-checks 9F34 against 9F02 or against TVR when receiving the online transaction, remains open in this work.</p><p>Each attempt encountered a different form of the same barrier. What was established was the technical feasibility of integrating an arbitrary mPOS terminal with the public interface of a payment gateway.</p><p>The integration with Stripe demonstrated the end-to-end pipeline: EMV reading by the mPOS SDK, correct TLV parsing, authentication against the API, HTTP roundtrip with a valid response, and chaining with a notification pipeline. The path is reusable for any gateway that accepts EMV card-present data and establishes the software basis for subsequent experiments against backends that expose this interface.</p><p>The most relevant result for this thesis lies in what prevented the experiment from progressing. All three attempts converge on the same pattern: commercial gateways do not semantically validate EMV data, rejecting anything that doesn’t arrive via an API restricted to certified terminals. The defense of the card-present pipeline against the submission of manipulated data is architectural, not cryptographic.</p><p>The observed behavior suggests that if the terminal is certified, the EMV data is treated as intact, and thus the consistency check between fields (9F34 versus 9F02, TVR versus 9F34) is delegated to the terminal itself. Some questions remain open: do gateways somehow validate the consistency between 9F34 and 9F02 before routing authorization, or do they fully trust the certified origin? Does the issuer revalidate the consistency between fields at the time of authorization, or does it treat the packet received from the gateway as trustworthy by design? Regarding the card, this work has already demonstrated that it blindly trusts what the terminal declares, without an independent verification mechanism.</p><p>If the only defense of commercial card-present flows is trust in the origin, then the integrity of the terminal hardware is the critical point of the model. The Bluetooth vulnerabilities of the terminal used for the experiments in this research, documented on this <a href="https://medium.com/@davimouar/from-bluetooth-to-cve-breaking-payment-terminal-mpos-security-591a463f7088"><strong>article</strong></a>, hit exactly this point. A terminal whose communication channel can be externally manipulated is, from the point of view of the gateway and the sender, indistinguishable from an intact terminal. The entire chain of trust falls at a single point, and none of the layers above has an independent mechanism to detect the manipulation. The following sections show how the compromise is feasible.</p><h3>9. Terminal POS (mPOS)</h3><p>The experiments described were conducted with a commercial POS terminal (mPOS), based on hardware and software supplied by a Chinese manufacturer widely used in the international market. Unlike a purely theoretical approach, the analyzed scenario starts from a critical and realistic point: the terminal is not a reliable black box, but rather a programmable device, extensible via SDK and, in many cases, accessible to third parties for integration of payment applications, such as PDV systems.</p><p>The terminal used exposes a complete SDK for integration, allowing developers to implement or customize payment flows, screens, PIN entry, CVM logic, online communication, and EMV communication handling.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*N9oO091WAbXPGnZU2U2nRg.png" /></figure><p>This SDK provides direct access to internal transaction structures, including parameters sent to the EMV kernel, data used in assembling the GENERATE AC statement, and proprietary fields.</p><p>A example of this is the use of the terminal manufacturer’s proprietary tag: 1F02. Observed in the logs and the SDK, it functions as an “internal preset.” During the research, during numerous exchanges with the Chinese, I obtained “privileged information” on how to configure its values ​​bit by bit.</p><p>This tag encapsulates terminal decisions and configurations at the kernel level (PIN Display, CVM required, Required to enter PIN, Online/Offline) and is internally translated into terminal behavior and data sent as <strong>9F33 (Terminal Capabilities)</strong> and <strong>9F35 (Terminal Type)</strong>. An example of manipulating the bytes and bits of 1F02 allows, in practice, controlling the logical state of the bearer verification, regardless of whether the user has entered a PIN, whether a physical PIN pad exists, or whether the terminal is online.</p><p>Proprietary tags described in the EMV specification can also have their values ​​configured through the 1F0B tag. During research and testing, the value of the <strong>DF8126 tag (Reader CVM Required Limit)</strong> was customized.</p><p>It is also possible to add other EMV tags in the SDK to customize their values ​​by editing a .dll file. After “reverse engineering” using <a href="https://dnspy.org/">dnSpy</a>, it was possible to access a large portion of the command lines that execute various functions in the SDK.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/310/1*RcKq4A2Jgj4XETOvEqBxVw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/833/1*smSy9ARMsRGFbFLrO0ViiA.png" /></figure><p><strong>The result is a fully customized terminal!</strong></p><p>An example of a transaction where the terminal was compromised was described in Part 1. In this case, the PIN entry screen, which can be configured to appear or not via Tag 1F02, was not displayed.</p><p>Access to this level of control didn’t require such deep reverse engineering or exploitation of memory vulnerabilities. The attack model demonstrated here starts from an even more worrying vector: access to the SDK, obtained through the manufacturer itself. I simply presented myself as someone interested in developing applications for the terminal to receive documentation, code examples, libraries, and direct guidance from the vendor’s engineers. In other words, the same material routinely provided to commercial integrators was sufficient to understand and manipulate critical points of the EMV flow. How can we guarantee that they will be implemented correctly?</p><p>From this access, it was possible to create compromised terminal scenarios, as we have already seen. This scenario is particularly relevant because it doesn’t depend on a specific bug in this terminal. It derives from a common architectural model where modern POS terminals are “open platforms,” ​​with powerful SDKs designed for rapid integration with acquirers and payment solutions. Any other terminal from a different manufacturer that exposes a similar level of control to the developer is subject to the same type of compromise. In Brazil, this is amplified by the wide variety of acquirers, POS manufacturers, and integration models, many of which offer extensible SDKs and customizable application logic. Real World Example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/315/1*fZjHrKU7PNxF8Ki_HhyBtg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*UFs-XMXzEnzN0MljhqjZzg.png" /></figure><p>Compromising POS terminals is not a theoretical scenario. An active market for unlocking and modifying payment terminals already exists in Brazil.</p><p>On platforms like TikTok, it’s possible to find profiles openly selling “card machine unlocking” services, including Android terminals like the PAX A930 and Moderninha. The videos show the process of rooting the Android device, installing arbitrary APKs via ADB (Android Debug Bridge), and removing operating system restrictions that prevent access to developer mode. The result is a POS terminal with a completely open Android operating system, capable of running any application and even modifying the behavior of the EMV kernel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IB7fEhdH-b4ZssyJjTJoOg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6CV7dyrtU2s7elrKFe5B_w.png" /></figure><p><strong>The combination of a compromised terminal (already available on the market) with the permissiveness of the Mastercard chip documented in this research creates a complete attack vector.</strong></p><h4>9.1 Bluetooth Communication</h4><p>Another attack vector, especially in MPoS and POS terminal scenarios, is Bluetooth communication between the mobile device and the reader. In this model, a significant portion of the transaction data and logic, including CVM parameters and risk decisions, are transmitted from the mobile application to the terminal at the beginning of the EMV flow, such as Tag 1F02.</p><p>I have another complete article discussing this in the terminal I used for this research. The link is here: <a href="https://medium.com/@davimouar/from-bluetooth-to-cve-breaking-payment-terminal-mpos-security-591a463f7088"><strong>From Bluetooth to CVE: Breaking Payment</strong></a></p><p><a href="https://medium.com/@davimouar/from-bluetooth-to-cve-breaking-payment-terminal-mpos-security-591a463f7088"><strong>Terminal (mPOS) Security</strong></a></p><h3>9.2 Paradigm Shift: SDK vs Bluetooth</h3><p>While the SDK attack was considered “Difficult” due to its technical complexity, the Bluetooth vector makes the attack highly probable and mass-scaleable. The total risk escalation factor is higher, transforming a theoretical vulnerability into an imminent threat to the payments ecosystem.</p><p>Comparative Table: SDK Vector vs. Bluetooth Vector</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*FMKH8c038tj_eeBwB4GQwA.png" /></figure><p>This reinforces that compromising the terminal does not necessarily require full access to the SDK or firmware. Controlling an earlier point in the flow, such as Bluetooth communication, is enough to influence critical decisions.</p><p>Therefore, the convergence of a programmable terminal, the exposure of EMV logic through a Bluetooth channel operating as a control plane without any authentication, and the use of cards with permissive risk policies establish a functional equivalence to compromising the SDK. This scenario transforms attacks that were previously purely academic into operationally viable, low-cost, and highly scalable vectors, making them imminent and profoundly damaging to the payments ecosystem.</p><h3>10. Real World Attacks in the Brazilian Context</h3><p>In the Brazilian context, attacks involving Mastercard cards are not limited to classic social engineering fraud or misuse of the terminal. There is a class of directly online attacks that directly exploit the communication between the POS terminal and the card, especially in contactless, MPoS, and smartphone-integrated terminal environments.</p><p>One of the most relevant vectors is the <strong>Relay Attack</strong>, widely discussed in academic papers and already observed in real-world scenarios. In this type of attack, the NFC communication between the card and the terminal is extended through an intermediate channel (network, Bluetooth, or Internet), causing the card to “believe” it is near a legitimate terminal when in fact it is being used elsewhere. In Brazil, one of the best-known cases of this type is <a href="https://www.threatfabric.com/blogs/phantomcard-new-nfc-driven-android-malware-emerging-in-brazil"><strong>PhantomCard</strong></a>.</p><p>This example, using a Mastercard and two Android phones with the NFCGate app in a completely real and online environment, shows that they are still vulnerable to relay attacks.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dv7gBPdLQs_Q&amp;type=text%2Fhtml&amp;schema=google&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fv7gBPdLQs_Q" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/84012688f8f8b3b2c3cc48778552632c/href">https://medium.com/media/84012688f8f8b3b2c3cc48778552632c/href</a></iframe><p>In Brazil, <strong>all Mastercard transactions are fully signed (CDA)</strong>, meaning they perform Out-of-Action (ODA), thus generating SDAD at the end of the flow. Therefore, MiTM attacks altering transaction data such as the CVM result are easily detected and rejected. However, <strong>Visa</strong> still maintains a vulnerable design where it does not fully sign transaction data, making it possible to carry out a MiTM attack by altering the CTQ and TTQ, a PIN bypass attack. This attack is still vulnerable in some issuers, as issuers/banks are currently mitigating this vulnerability in the Visa protocol, first documented in <a href="https://blackhat.com/asia-20/briefings/schedule/#first-contact---vulnerabilities-in-contactless-payments-19359"><strong><em>First Contact: New vulnerabilities in Contactless Payments by Yunusov and Galloway.</em></strong></a></p><p>Even before delving into the so-called “golpes da maquininha,” a term widely known in Brazil, the panorama demonstrated throughout my research already shows that the online EMV transaction itself can be manipulated at a logical level, exploiting excessive trust between the terminal, the card, and the backend. It is at this point that the analyzed scenarios fit together.</p><h4>10.2 Critical Observations on Visa</h4><p>Although the paper<strong> More is Less: Extra Features in Contactless Payments Break Security</strong> demonstrates that both Mastercard and Visa have vulnerabilities when operating in offline environments, the way these flaws manifest themselves is technically distinct between the card brands.</p><p>In Visa, especially in <strong>qVSDC</strong>, there are still more visible local decision mechanisms, such as CTQ, which can signal to the terminal the need to go online under certain conditions, and TTQ, which influences the processing context when sent by the terminal. <strong>This suggests that Visa still try preserves some local control, even if it does not eliminate risks.</strong> TTQ is requested by the card during a transaction via PDOL:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tHm6EnA995ZCXk_hERkBdg.png" /><figcaption>Visa Card PDOL</figcaption></figure><p>Furthermore, the mere fact that the Mastercard card generates ARQC or indicates online processing does not in itself constitute a failure, as this may be normal protocol behavior.<strong> The failure exists when the card ignores critical risk signals and allows the flow to continue without applying minimum restrictions.</strong></p><p>To date, tests have not confirmed the same level of critical permissiveness in Visa as observed in the analyzed Mastercard. In short, Mastercard proved to be more dependent on the backend, while Visa still appears to maintain some degree of local decision-making?</p><h3>11. EMV Tag Analysis Across Tested Cards</h3><p>This section documents the tests and analyses I performed with Proxmark3 on the Mastercard cards I used during the research. The goal is to show, with data extracted directly from the chip, how this card was configured by the issuer and what that configuration enables.</p><p>Using commands like <em>emv scan -ate dump.json</em> and <em>emv select -st</em>, I extracted the tags that define how the card was configured by the issuer. The results below cover the most relevant ones.</p><h4><strong>TAG 82 — AIP (Application Interchange Profile)</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*iQjclRoud6VLz9KkKRpkgA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nf74FN_eAcgEUC_Y-ro88Q.png" /></figure><p><strong>Hex:</strong> 19 80<br><strong>Binary:</strong> 00011001 10000000</p><p>All the Mastercard cards I analyzed have the same AIP value <strong><em>19 80</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*i1g1Jf3CkWVOHB0Td5-hVg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lQP8mjzxRoQptmffkEaVrw.png" /></figure><h4>TAG 9F07 — AUC (Application Usage Control)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*mwCx6GlW9TE2D6rjt7qgLg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gy97zecEbGAeek-dE6GYQQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ru-vKXHFjezo420VleCueg.png" /></figure><p><strong>Hex:</strong> FF C0<br><strong>Binry:</strong> 11111111 11000000</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Aj2IYU3dQ48h20Y6LUVRzw.png" /></figure><p>The card accepts purchases, withdrawals, and international cashback by default. The card can be used, but the Bank is who reallyu has to authorize it (Backend), and it shouldn’t be the default. The mistake is allowing everything by default, especially on a card that is quite specific, it should be limited.</p><h4>TAG 8E — CVM List (Cardholder Verification Method)</h4><p>For the main cards analyzed, this CVM List pattern was observed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*Kz4YX70R2F3e2Ie1aaSv7A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/953/1*hNYxj8GwlLzJ3ebyGMZlFA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vCkLVkBrz_QNU-ct2gqKtA.png" /></figure><p><strong>Hex:</strong> 00 00 00 00 00 00 00 00 42 03 1F 03</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WV-ZROjJdphqHW0a2eTWWQ.png" /></figure><p>For cards such as Mastercard International Credit/Debit (Global), AID: A0000000041010, the following list was observed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y1VIyjiXSVA_HBK9FG1V7w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TUL5nAirOcNzG00wWDIupA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6R5wdkQzxasNpJ9TLJ3izg.png" /></figure><p>It is basically the table of options that the terminal can apply, in order, according to its capabilities and context (value, transaction type, configuration).</p><p>The mPOS terminal that was used, when it does not apply a PIN (due to lack of PIN pad, poor integration or compromise), chooses the second entry in the list (NoCVM) or even fills 9F34 with values ​​such as 3F0001 and yet the card continues the transaction, generating ARQC.</p><p>The Mastercard card, because it has a permissive issuance, accepts any 9F34 consistent with 8E, does not impose a local risk policy (high value + NoCVM, CVM failed, absence of ODA) and generates ARQC anyway, as we have already seen.</p><h4>TAG 9F0D, 9F0E and 9F0F — Issuer Action Codes (IACs)</h4><p>Issuer Action Codes (IACs) define how the card should react locally to risk conditions observed during the transaction. The following values ​​were extracted from the Sicredi card analyzed:</p><ul><li>9F0D (Default): B450848000</li><li>9F0E (Denial): 0000180000</li><li>9F0F (Online): B470848000</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CbuJpOZShnsXJvBNCPRzZQ.png" /></figure><p>These values ​​show that the card has a configured action policy, but tests indicate that this policy did not result in effective local blocking. Even in scenarios with CVM failed, NoCVM in a sensitive context, high value, and absence of ODA, the observed behavior was the continuation of the flow generating ARQC, an increase in ATC, and registration in the internal log, without AAC return.</p><p>Some cards appeared with values ​​such as 9F0E (Denial) set to zero:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FOoO3Hg9c1vVQf1avrNqTA.png" /></figure><p>Therefore, the central point is not just the absence of IACs, but rather the fact that, in practice, the analyzed issuance did not demonstrate the use of these IACs as a robust local risk denial mechanism. In other words, the observed issuance is configured in a predominantly “backend-centric” way; instead of using IACs as a concrete local defense, the card tends to push the risk decision to the online stage (issuer/bank).</p><p>Given this, we can verify, using the configuration logs themselves, that the card is already issued with potentially dangerous permissions. This is inherent to Mastercard’s design, contributing to the possibility of fraud before the backend processes it.</p><h3>12. Conclusion</h3><p>The tests performed indicate that Mastercard cards exhibit behavior that is strongly dependent on subsequent validation by the issuer, even in scenarios where stricter local policies would be expected. In the scenarios evaluated, the card continued the EMV flow and generated ARQC in transactions with high and invalid values, without evidence of local blocking via AAC, even when the cardholder’s authentication signals were weak or inconsistent.</p><p>This behavior does not, in itself, mean that the transaction would necessarily be approved by the bank, but it shows that the card, at the terminal↔card level, <strong>did not demonstrate robust local mechanisms to interrupt the flow before the online stage.</strong> In offline, poorly configured, or compromised environments, this backend dependency expands the risk surface, since the terminal can locally complete the transaction, record it in the chip’s internal log, and proceed based on data declared by the terminal itself. In other words, security becomes excessively concentrated/delegated to the issuer/bank, while the cardholder exerts little local control in the face of risky situations.</p><h3>13. Mitigations and Recommendations</h3><p>To mitigate the risks of each of the presented scenarios, it is recommended that banks/issuers and Mastercard itself review the issuance profiles and risk policy applied to cards, despite regional and financial limitations.</p><p>In particular, it would be desirable to:</p><p>1. Strengthen the local local currency verification (CVM) policy, reducing tolerance for scenarios where the terminal declares authentication results without consistent evidence of execution;</p><p>2. Adjust issuance parameters, such as the CVM List, AUC, and local decision profiles, so that higher-risk situations result in a stronger local reaction, including the possibility of AAC when appropriate;</p><p>3. Review the reliance placed on data declared by the terminal, especially fields such as 95 (TVR) and 9F34 (CVM Results), which can currently influence the card decision without necessarily reflecting the actual execution of authentication.</p><p>Furthermore, regarding infrastructure, EMV terminals and kernels must be configured to correctly interpret card signals and apply card validation in a manner consistent with the expected security policy. Finally, back-end monitoring mechanisms remain essential, but should not be the only relevant barrier, as ideally, risk should be addressed in layers, with local controls on the card, controls at the terminal, and subsequent validation by the issuing entity.</p><h3><strong>14. References</strong></h3><p>I leave here every paper, link and resource that really shaped how I understand payment security. I read them over and over, especially More is Less, sometimes the same section five or six times, until the pieces started fitting together. They are dense, they require patience, but every re-read reveals something that went unnoticed before.</p><p><strong>If you made it this far, do yourself a favor and read the ones I marked as required reading.</strong> I am genuinely grateful to every researcher and professor behind each of these papers!</p><h4>Academic Papers</h4><p>Pavlides, G., Clee, A., Boureanu, I., and Chothia, T. <strong>“More is Less: Extra Features in Contactless Payments Break Security.”</strong> <em>USENIX Security 2025</em>. <a href="https://www.usenix.org/conference/usenixsecurity25/presentation/pavlides">https://www.usenix.org/conference/usenixsecurity25/presentation/pavlides</a><strong>(READ IT)</strong></p><p>Basin, D., Schaller, P., and Toro-Pozo, J. <strong>“Inducing Authentication Failures to Bypass Credit Card PINs.”</strong> <em>32nd USENIX Security Symposium</em>, 2023. <a href="https://www.usenix.org/conference/usenix%EE%80%80security23/presentation/basin-inducing">https://www.usenix.org/conference/usenixsecurity23/presentation/basin-inducing</a> <strong>(READ IT)</strong></p><p>Mehr Nezhad, M., Hao, F., Epiphaniou, G., Maple, C., and Yunusov, T. <strong>“SoK: Security of EMV Contactless Payment Systems.”</strong> <em>IEEE Transactions on Dependable and Secure Computing</em>, 2024. <strong>(RAD IT)</strong></p><p>Basin, D., Sasse, R., and Toro-Pozo, J. <strong>“Card Brand Mixup Attack: Bypassing the PIN in non-Visa Cards by Using Them for Visa Transactions.”</strong> <em>30th USENIX Security Symposium</em>, 2021. <a href="https://www.usenix.org/conferenc%EE%80%80e/usenixsecurity21%EE%80%80/presentation/ba%EE%80%80sin">https://www.usenix.org/conference/usenixsecurity21/presentation/basin</a></p><p>Basin, D., Sasse, R., and Toro-Pozo, J. <strong>“The EMV Standard: Break, Fix, Verify.”</strong> <em>IEEE Symposium on Security and Privacy (S&amp;P)</em>, 2021. <a href="https://doi.org/10.1109/SP40001.2021.00014">https://doi.org/10.1109/SP40001.2021.00014</a></p><p>Boureanu, I., Chothia, T., Debant, A., and Delaune, S. <strong>“Security Analysis and Implementation of Relay-Resistant Contactless Payments.”</strong> <em>ACM CCS</em>, 2020.</p><p>Chothia, T., Garcia, F. D., De Ruiter, J., Van Den Breekel, J., and Thompson, M. <strong>“Relay Cost Bounding for Contactless EMV Payments.”</strong> <em>Financial Cryptography and Data Security (FC)</em>, 2015.</p><p>Galloway, L.-A. and Yunusov, T. <strong>“First Contact: New Vulnerabilities in Contactless Payments.”</strong> <em>Black Hat Europe</em>, 2019. <a href="https://i.blackhat.com/eu-19/Thursday/eu-19-Galloway-First-Contact-New-Vulnerabilities-In-Contactless-Payments.pdf">https://i.blackhat.com/eu-19/Thursday/eu-19-Galloway-First-Contact-New-Vulnerabilities-In-Contactless-Payments.pdf</a></p><p>Mehr Nezhad, M. <strong>“Security of Mobile Payment Systems.”</strong> PhD Thesis, University of Warwick, 2023. <a href="https://wrap.warwick.ac.uk/theses/Mehr_Nezhad_2023">https://wrap.warwick.ac.uk/theses/Mehr_Nezhad_2023</a></p><p>Radu, A.-I., Chothia, T., Newton, C. J. P., Boureanu, I., and Chen, L. <strong>“Practical EMV Relay Protection.”</strong> <em>IEEE Symposium on Security and Privacy (S&amp;P)</em>, 2022. <a href="https://doi.org/10.1109/SP46214.2022.9833675">https://doi.org/10.1109/SP46214.2022.9833675</a></p><p>Roland, M. and Langer, J. <strong>“Cloning Credit Cards: A Combined Pre-play and Downgrade Attack on EMV Contactless.”</strong> <em>USENIX WOOT</em>, 2013.</p><p>Stennikov, A., Yunusov, T., and Ivachev, A. <strong>“New Vulnerabilities in Public Transport Schemes for Apple Pay, Samsung Pay, GPay.”</strong> White Paper, 2021.</p><p>Yunusov, T. <strong>“Hand in Your Pocket Without You Noticing: Current State of Mobile Wallet Security.”</strong> <em>Black Hat Europe</em>, 2021.</p><h4>Standards and Specifications</h4><p>EMVCo. <strong>EMV Contactless Specifications — Book C-2 (Kernel 2, Mastercard).</strong> <a href="https://ww%EE%80%80w.emvco.com/emv-technologies%EE%80%80/emv-contactless-chip/">https://www.emvco.com/emv-technologies/emv-contactless-chip/</a></p><p>EMVCo. <strong>EMV Contactless Specifications — Book C-3 (Kernel 3, Visa).</strong> <a href="https://www.emvc%EE%80%80o.com/emv-technologies/%EE%80%80emv-contactless-chip/">https://www.emvco.com/emv-technologies/emv-contactless-chip/</a></p><p>EMVCo. <strong>EMV Integrated Circuit Card Specifications — Book 3 (Application Specification).</strong> <a href="https://www.emvco.c%EE%80%80om">https://www.emvco.com</a></p><p>Mastercard. <strong>M/Chip Requirements for Contact and Contactless.</strong> <a href="https://developer.masterc%EE%80%80ard.com">https://developer.mastercard.com</a></p><p>After months of studying, testing, re-reading papers, writing and rewriting, this is finally published. There is honestly so much more I wanted to include here, more experiments, more attack scenarios still sitting in my notes. I’m very happy to finally share this!</p><p>To everyone who read this far: Thank you!</p><p>f you want to stay up to date with my work and projects, check out my <a href="https://beacons.ai/davi_mw"><strong>Beacons.ai</strong></a> to follow me and see what I’m up to next!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=05d709f3e766" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Tap to Exploit: Analyzing and Manipulating Mastercard Contactless Transactions (Part 1)]]></title>
            <link>https://medium.com/@davimouar/tap-to-exploit-analyzing-and-manipulating-mastercard-contactless-transactions-part-1-732c124fb7b4?source=rss-87e90529fb2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/732c124fb7b4</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[payments]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[Davi Moura]]></dc:creator>
            <pubDate>Mon, 08 Jun 2026 18:54:21 GMT</pubDate>
            <atom:updated>2026-10-13T22:36:53.915Z</atom:updated>
            <content:encoded><![CDATA[<h3>1. Introduction</h3><p>Mastercard contactless transactions are part of our daily lives. Tap, beep, done. Most people have no idea what actually happens on the chip during those milliseconds between tap and approval. But the chip does a lot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/766/1*2jZUfTo-qQsWkOgyZnzo3A.png" /></figure><p>Over the past few months, I’ve been studying how this really works and, finally, after much revision, I’m publishing my <strong>COMPLETE RESEARCH</strong> here, in two parts.</p><p>If you read my <a href="https://medium.com/@davimouar/from-bluetooth-to-cve-breaking-payment-terminal-mpos-security-591a463f7088">previous article</a>, it covered four critical vulnerabilities in the mPOS terminal Bluetooth protocol I used. That work dealt with the terminal’s Bluetooth protocol. This series goes further!</p><p>Part 1 (this article) covers the card side: how a Mastercard contactless chip processes transactions, what it accepts without verifying, and what happens when you manipulate the data it receives. Part 2 covers the gateway side: whether the bank’s backend detects what the card didn’t.</p><p><strong>All tests were run on my own cards in a controlled lab environment. No third-party data was used.</strong> The primary target was my own Mastercard Savings Debit (AID A0000000043060), along with other Mastercard cards from Brazilian and international issuers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*Kz4YX70R2F3e2Ie1aaSv7A.png" /></figure><p>Two terms appear throughout this article. “Accepted by terminal” means that the terminal completed the EMV flow and the card generated an ARQC (Application Request Cryptogram). “Approved by issuer” means that the bank subsequently authorized the transaction after validating the ARQC online. Each experiment here is focused on the <strong>Terminal↔Card </strong>layer. Whether the issuer’s backend validates and detects these manipulated fields is what Part 2 attempts to answer.</p><h3>2. Analysis of EMV Transactions performed by the Card</h3><p>Previously, before starting all this documentation, I realized that the card has an internal storage function for records of recent transactions. This allows the card to retain information about past operations, which can be read by compatible terminals and audit systems.</p><p>These can be accessed through specific EMV read commands. These records generally contain data such as:</p><ol><li>Transaction code, whether it was approved online (ARQC), offline (TC), or rejected (AAC).</li><li>Transaction amount.</li><li>Transaction currency code (BRL R$ or USD $).</li><li>Transaction date and time.</li></ol><p>The test logs I performed with <a href="https://github.com/rfidresearchgroup/proxmark3">Proxmark3</a> show the recent records. Current examples of records in real-world environments such as restaurants were able to be read:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q9hNP7zIrpCiJ-8AKV_0xQ.png" /></figure><h4>Detailed Analysis:</h4><ul><li>The transaction was considered approved online because the <strong>Cryptogram Information Data (9F27)</strong> is <strong><em>80</em></strong>, <strong>ARQC</strong>.</li><li>The currency used was the <strong>Brazilian Real</strong> (BRL — 986).A moeda utilizada foi o Real Brasileiro (BRL — 986).</li><li>The transaction occurred on <strong>March 12, 2025</strong>.</li><li>The terminal where the transaction was performed had specific compatibilities, which may indicate support for CVM (cardholder verification methods), digital signature, or additional security requirements.</li><li>The recorded time was <strong>15:33:32</strong>.</li></ul><p>Because it is a transaction in a real environment, Sicredi itself sends an SMS with the same data recorded on the card, such as Amount, Date and Time:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*0xoxuy-iFTW8oKwRHoKr2g.png" /></figure><h4>Important Notes</h4><ol><li>The card stores information from previous transactions internally, allowing data from recent purchases to be retrieved directly from the chip.</li><li>This history can be used for auditing purposes, fraud prevention, and analysis of usage patterns by the issuer.</li><li>This same command can be used to retrieve multiple transactions stored on the card, providing a useful history for investigations or audits.</li></ol><p>Considering that the Mastercard Card maintains an internal transaction log, recording details such as value, currency, and date, we can perform security tests to assess possible vulnerabilities and unexpected behaviors in the storage and processing of this information?</p><h3>3. Analysis of Transactions with POS Terminals</h3><p>I conducted tests using a POS terminal (mPOS) simulating conditions close to a real-world environment. I observed that the card normally stored transactions in different currencies and high values, without requesting PIN entry or directly rejecting the operations.</p><p>The POS terminal software (SDK) allows editing the currency code (Currency Code — 5F2A) and the terminal country code (Terminal Country Code — 9F1A), facilitating testing in different scenarios.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*s8tTE6FVfQK70T_gDodogw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/789/1*tmKlhEAV7LLfRPrmzfd2QA.png" /></figure><p>First, I performed a transaction in the card’s default currency (BRL). Using Proxmark3, it was possible to demonstrate that the card considered the transaction valid and stored the operation internally, even without confirmation/processing with the backend (bank). This indirectly exposes the permissiveness in Mastercard’s default configuration, a topic that will be explored in greater depth later.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FP3Yh_0gKzsw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DP3Yh_0gKzsw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FP3Yh_0gKzsw%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8b38b57d19526f7bad4d56e330d970f1/href">https://medium.com/media/8b38b57d19526f7bad4d56e330d970f1/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*gx9UAALc3Ro8oZe7lJc6pQ.png" /></figure><h4>3.1 Transactions in Foreign Currencies with High Values</h4><p>Since the terminal can process transactions in different currencies and countries, I performed some transactions using <strong>USD (840)</strong> and <strong>EUR (978)</strong>.</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DhogkJiAaRao&amp;type=text%2Fhtml&amp;schema=youtube&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FhogkJiAaRao%3Ffeature%3Doembed" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/82b6eb6094c51e95858ec84633dbb1f6/href">https://medium.com/media/82b6eb6094c51e95858ec84633dbb1f6/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pgSDAokXVig9goiX7o3yvA.png" /></figure><p>I also made a high-value transaction in BRL. And upon reading the internal log with Proxmark3, it became clear that the card stored the transaction as valid.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9TiPAmiCTLGQqSS9ASck_w.png" /></figure><p>Another very important detail is that in both high-value transactions and those made in foreign currencies such as USD, the card generated the code <strong>80</strong>, indicating that the transaction was recognized as valid and sent/considered online, with the generation of the <strong>ARQC (Authorization Request Cryptogram)</strong>. This suggests that the card does not have internal limits or perform verifications of the transaction type or its values, a topic that will be explored in more depth later.</p><p>For better understanding, I made consecutive transactions of R$999 on the card, and all were approved, generating an ARQC. Then I performed a scan using an Android application that provides basically the same data as Proxmark3: Date, Value, and Currency.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*WGCIQgTSxL_txJcisLP_2g.jpeg" /></figure><h3>4. Technical structure of the chip</h3><p>The card exposes an internal Transaction Log that can store up to 10 records of recent events. The existence and structure of this log are typically indicated by the <strong>9F4D (Log Entry)</strong> tag present in the application’s FCI, which defines:</p><ul><li>SFI log</li><li>Maximum number of records stored</li></ul><p>These records are accessed using the <strong>SFI (Short File Identifier)</strong> corresponding to the log and can be retrieved using the <strong>READ RECORD</strong> command.</p><p>Each observed record typically contains the following tags:</p><ul><li><strong>Tag 9F27</strong> (Cryptogram Information Data) — Indicates the type of cryptogram generated in the transaction (ARQC / TC / AAC).</li><li><strong>Tag 9F02</strong> (Amount, Authorized) — Authorized transaction amount in numeric format (e.g., 00000099900 = R$999.00).</li><li><strong>Tag 5F2A</strong> (Transaction Currency Code) — Currency code in ISO 4217 standard (e.g., 986 = BRL, 840 = USD).</li><li><strong>Tag 9F36</strong> (Application Transaction Counter — ATC) — An incremental counter maintained by the card that increases with each cryptogram generation.</li></ul><p>Access is achieved via the READ RECORD command (APDU: 00 B2 SFI 0C 00), thus allowing complete reading of the history by any EMV terminal (such as Android).</p><h3><strong>5. Manipulating the internal transaction log</strong></h3><p>The card maintains an internal log file that stores records of the last transactions performed. This log is a distinct structure from the ATC (Application Transaction Counter 9F36). While the ATC is an incremental counter that increases by one unit, the Transaction Log is a log file accessed via the READ RECORD command, using the SFI (Short File Identifier) ​​and the entry format defined by the 9F4D (Log Entry) tag present in the application’s FCI.</p><p>Each log entry stores fields such as the generated cryptogram type (9F27), the value (9F02), the currency code (5F2A), the date (9A), and the ATC corresponding to that transaction (9F36). The ATC recorded within each log entry serves as a sequence reference, but it is not what is manipulated in the tests; it is only correctly incremented by the chip.</p><p>What the tests with Proxmark3 demonstrate is the ability to record arbitrary entries in this log file. When executing transactions via <em>emv exec -satcj</em> with parameters configured in <em>emv_defparams.json</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*HX0Oq6EEMdrv58p61gVvQA.png" /></figure><p>It is possible to control the content of fields 9F02, 5F2A, 9A, and 9F21 that will be recorded in the log, producing records with values, currencies, and timestamps defined by the attacker. The chip accepts and persists these records in non-volatile memory, where they remain until the log capacity is exhausted (typically 10 entries) or the card is replaced.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*cxj1Wq-yPuQD_YLPKn3L5g.png" /></figure><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DIJwdAQWJ3xU&amp;type=text%2Fhtml&amp;schema=google&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FIJwdAQWJ3xU" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/3397c7f5f1bc9446feef1ea748f3da2b/href">https://medium.com/media/3397c7f5f1bc9446feef1ea748f3da2b/href</a></iframe><p>Now, using the <em>emv reader -v</em> command, we can see the transaction performed with Proxmarx3 recorded on the card, containing the data we configured in <em>emv_defparams.json</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m044s5nCmp1nooq4U4AHQQ.png" /></figure><p>Tests with Proxmark3 and the POS Terminal also demonstrated that the card accepts consecutive transactions <strong>without any limit</strong>, as is the case with the recorded transactions of R$999, which I scanned using the Android App.</p><h3>6. Permissiveness in Mastercard Transactions: CVM process, Absence of Local policy, and Blind trust in the Terminal and Backend</h3><p>During the execution of an EMV transaction, the choice of which cardholder verification (CVM) method will be applied is the responsibility of the terminal, not the card. The card only provides, through the <strong>CVM List (tag 8E)</strong>, which methods it accepts and the order of preference, but the terminal decides what will actually be executed, and populates the <strong>CVM Results (tag 9F34)</strong>.</p><h4>6.1 Summary Flow of the EMV Transaction and CVM Verification</h4><ol><li><strong>AID Selection</strong>: The terminal sends <strong>SELECT (AID)</strong> to select the payment application. The card responds with the FCI, containing information necessary to initiate the transaction.</li><li><strong>GET PROCESSING OPTIONS (GPO):</strong> The terminal sends GPO with <strong>PDOL data</strong>, such as <strong>amount (9F02)</strong>, <strong>currency (5F2A)</strong>, <strong>country (9F1A)</strong>, <strong>date (9A)</strong>, and <strong>transaction type (9C)</strong>. The card responds with <strong>AIP and AFL</strong>, indicating application capabilities and which records should be read.</li><li><strong>READ RECORD:</strong> Based on the AFL, the terminal uses READ RECORD to obtain records from the EMV application, including <strong>CVM List (8E)</strong>, <strong>CDOL1</strong>, <strong>IACs</strong>, <strong>AUC</strong>, and other tags necessary for processing.</li><li><strong>CVM Processing:</strong> The terminal analyzes the <strong>CVM List</strong> and attempts to execute the bearer verification methods in the defined order, according to the transaction conditions and the terminal’s capabilities.</li></ol><p>In the tests performed, the behavior initially interpreted as an “automatic fallback” of the card was later identified as a consequence of a terminal configured not to execute the PIN entry interface. Even under these conditions, the terminal still declared a CVM result in the 9F34 (CVM Results) field, which was then used by the card in the EMV flow.</p><p>The CVM List observed in most of the Mastercard cards analyzed is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vCkLVkBrz_QNU-ct2gqKtA.png" /></figure><p>CVM Results observed in a normal contactless scenario where it is below the limit (Does not require online PIN verification):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KmNS2fydSzkraPXC0SBLnQ.png" /></figure><p>CVM Results observed in a normal contactless scenario where it is above the limit (requires online PIN verification):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lc6bDnIxhhM-Gonck1aeGg.png" /></figure><p><strong>The card does not execute the PIN on its own</strong>, nor does it unilaterally decide to fall back to “No CVM Required”. It simply receives the <strong>9F34 value</strong> calculated by the terminal and uses it as input for the <strong>AC (9F26) calculation</strong>. This will be explored in more depth in the following sections.</p><h3>6.2 Chip Permissiveness in the Presence of CVM Results</h3><p>The central point observed in the tests is that the Mastercard card does not independently validate whether the CVM transaction was actually executed. It treats field 9F34 as a statement of trust from the terminal and expects the backend to revalidate it, provided the received value is consistent with the values ​​in the CVM List.</p><p>From the chip’s point of view, according to the CVM List, the rule is:</p><p><strong><em>“Try the online PIN; if that doesn’t work, consider NoCVM. If even NoCVM isn’t possible, mark as CVM failure.”*</em></strong></p><p>The following patterns of 9F34 were observed in the experiments, among others:</p><h4>020000 — Enciphered PIN verified online (Unknown in Contactless)</h4><p>High-value transaction (9999, cardholder verification required):</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FUoYNglmy0LA%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DUoYNglmy0LA&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FUoYNglmy0LA%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/6b191aa408f147c00fc50e8416a9176b/href">https://medium.com/media/6b191aa408f147c00fc50e8416a9176b/href</a></iframe><p>PIN entry:</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DHhj5F5ow494&amp;type=text%2Fhtml&amp;schema=google&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FHhj5F5ow494" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/f88d2dde37df921ce0c188368036babb/href">https://medium.com/media/f88d2dde37df921ce0c188368036babb/href</a></iframe><p>Log Terminal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/306/1*vjGyCLq96fsxAcHUnec9tA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/278/1*Bx-9DsGUMtzRj_3nZLg91g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lc6bDnIxhhM-Gonck1aeGg.png" /></figure><p>Indicates that the terminal has selected encrypted online PIN as the method. The result is “unknown” from a local point of view, as the outcome depends on the backend, even so the card is accepted. This value appears, for example, in contactless or contact transactions in which the terminal claims to have used an online PIN.</p><h4>1F0002 — No CVM required (Successful Contactless)</h4><p>Low Amount transaction (12, No cardholder verification required):</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DQJVTBug4NpM&amp;type=text%2Fhtml&amp;schema=google&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FQJVTBug4NpM" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/55cb885f4e99cd93a89f7f20e8eb1c4e/href">https://medium.com/media/55cb885f4e99cd93a89f7f20e8eb1c4e/href</a></iframe><p>Log Terminal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/1*WlMv_tCMmaoQ9OVpbFP0Kg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KmNS2fydSzkraPXC0SBLnQ.png" /></figure><p>This indicates that the terminal has explicitly chosen “No CVM required” and considers this a success. This is the typical scenario for a transaction below the threshold where no verification is required, i.e., when the kernel decides that no additional authentication is needed.</p><h4>3F0001 — No CVM performed (Failed in Contact)</h4><p>High-value transaction (9999, cardholder verification required):</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DoNEG-8LrTmk&amp;type=text%2Fhtml&amp;schema=google&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FoNEG-8LrTmk" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/580b907f62d1586702719ee02751a26b/href">https://medium.com/media/580b907f62d1586702719ee02751a26b/href</a></iframe><p>Log Terminal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/315/1*a7EuEJfWBgbR3Ny2SbA_gA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xz05DGvDQ1QJpGChy0FGWQ.png" /></figure><p>This indicates that no CVM was effectively applied and that bearer verification failed. This value does not represent a successful NoCVM. It actually and explicitly represents a CVM failed situation.</p><h4>6.2.1 Differences between Contact and Contactless Interfaces in Cardholder Verification</h4><p>Although the cards use the same EMV application and the same CVM List in both contact and contactless interfaces, experiments show that the cardholder verification behavior differs between the two usage methods. This difference doesn’t stem from the chip itself, but from the terminal kernel in each interface. An EMV kernel is a set of functions that provides the processing logic and data necessary to execute an EMV transaction with or without contact.</p><p>The terminal kernel decides when these options can or cannot be used, and what happens when they fail. The same CVM list generates very different flows in contactless and contactless transactions.</p><p><strong>Contactless Interface: Strict NoCVM limits and fallback/downgrade to contact:</strong></p><p>In the contactless interface, the terminal uses the configured limit parameters (proprietary tags such as DF8123–DF8126) to control when it is allowed to use “No CVM required”.</p><p>Low value transaction (12, no cardholder verification required):</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DQJVTBug4NpM&amp;type=text%2Fhtml&amp;schema=google&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FQJVTBug4NpM" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/55cb885f4e99cd93a89f7f20e8eb1c4e/href">https://medium.com/media/55cb885f4e99cd93a89f7f20e8eb1c4e/href</a></iframe><p>Log Terminal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/1*WlMv_tCMmaoQ9OVpbFP0Kg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KmNS2fydSzkraPXC0SBLnQ.png" /></figure><p><strong>Terminal without capacity (indicated in 9F33):</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hqmQAEgC_ob6sCZzYJJAaQ.png" /></figure><p>High-value transaction (9999, cardholder verification required):</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dyx8UNpCK1-I&amp;type=text%2Fhtml&amp;schema=google&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fyx8UNpCK1-I" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/7de418a37607215c450a12666b96b2d9/href">https://medium.com/media/7de418a37607215c450a12666b96b2d9/href</a></iframe><p>The logs and videos consistently show, in a genuine terminal scenario, without online PIN capability and without MiTM interference, that:</p><ol><li>In low-value transactions, within the limit, the terminal can choose No CVM required and generate a CVM Results of type 1F0002 (No CVM required, Successful).</li><li>In high-value transactions, when the terminal cannot apply an online PIN via the contactless interface, it does not force NoCVM. Instead of proceeding with 9F34 = 1F0002 or 3F0001, the contactless Kernel interrupts the flow and presents the user with an “Insert” message.</li></ol><p>This behavior aligns with security recommendations for contactless transactions. The contactless interface should not complete high-value transactions without a strong CVM (PIN or CDCVM).</p><p><strong>2. Contact Interface: Permissive Kernel and ARQC even with CVM failed.</strong></p><p>On the contact interface (when the card is inserted), the terminal used in the tests behaves differently. In cases where the PIN is requested (always when it is inserted), the flow follows the expected pattern:</p><ul><li>The terminal performs the PIN verification, fills the 9F34 with a value equivalent to <strong>Encrypted PIN verified online</strong> (420300 or 020000).</li><li>It calls GENERATE AC, and the card returns an ARQC, incrementing the ATC and registering the transaction.</li></ul><p>High-value transaction (9999, cardholder verification required):</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DtZSXo4LZotA&amp;type=text%2Fhtml&amp;schema=google&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FtZSXo4LZotA" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ef5bf07f630f96acb0b8cc898b6a0e22/href">https://medium.com/media/ef5bf07f630f96acb0b8cc898b6a0e22/href</a></iframe><p>Log Terminal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/307/1*IbnX82vt7a92aADL02X1IQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/973/1*IzKxyWqhfKQ5J49rhRhdZQ.png" /></figure><p>The problem arises when the PIN should be required but is not applied, either due to a terminal without a configured PIN pad, an attack, or an integration failure. In these scenarios, the online PIN step is completely omitted, but the contact kernel does not abort the transaction or force a fallback to another interface.</p><p>Terminal without capability (indicated in 9F33):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hqmQAEgC_ob6sCZzYJJAaQ.png" /></figure><p>High-value transaction (9999, cardholder verification required):</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DGP8yv7t7EK8&amp;type=text%2Fhtml&amp;schema=google&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FGP8yv7t7EK8" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/748eeea59c5a8e73b249de4868932d63/href">https://medium.com/media/748eeea59c5a8e73b249de4868932d63/href</a></iframe><p>Log Terminal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/315/1*a7EuEJfWBgbR3Ny2SbA_gA.png" /></figure><p>Instead, it fills 9F34 with 3F0001 (No CVM performed, Failed), <strong>explicitly indicating a CVM failure</strong>, and yet proceeds to call GENERATE AC. The card responds with a valid ARQC, increments the ATC, and logs this transaction in the internal log as if it were a regular operation, without declining it to AAC. In other words, <strong>the chip do not enforce any local locking</strong>. Both assume that the issuer, in the backend, will decide what to do.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bViU93t0vczW8s13Zchr8w.png" /></figure><p>From the card’s perspective, there is no mechanism to flag the 9F34 as suspicious. The card was issued as “ARQC-only”, which assumes that cardholder verification and risk assessment will always be handled on the backend.</p><h3>6.3 Bypass PIN (9F34 CVM)</h3><p>As previously demonstrated, Mastercard cards do not independently validate whether the PIN has actually been verified. The next step is to evaluate possible scenarios where it is possible to bypass the PIN. Among them is using a compromised terminal where the attacker controls the POS (terminal) software.</p><p>The card continues to follow the same logic: it only verifies if the value of 9F34 is “consistent” with the CVM List (8E), accepts the result as true, calculates the AC (ARQC), and registers the transaction normally.</p><p>From a cryptographic point of view, there is no link between what actually happened on the PIN pad and the value entered in 9F34. <strong>The card has no way of knowing if the terminal actually displayed a PIN screen or received PIN digits</strong>. What goes into the AC calculation is only the value declared in 9F34 by the terminal. A compromised terminal can therefore invent/forge CVM results compatible with 8E, and the card will MAC and sign this data as if it were legitimate.</p><h4>Scenario A: Compromised terminal marking 020000 without requesting PIN</h4><p>In a scenario where the terminal has a PIN pad and should request a PIN, a compromised terminal could simply:</p><ol><li>Not send any PIN command, such as not displaying a PIN screen (PIN Display),</li><li>Fill the CVM Results (9F34) with a value indicating “Encrypted PIN verified online, success”. Typically 020000</li><li>Assemble this 9F34 based on CDOL1 and call GENERATE AC.</li></ol><p>The card receives this and:</p><ul><li>Checks whether the declared CVM method exists in its CVM List</li><li>Has no independent evidence that PIN was actually verified (there is no internal PIN state in the contactless flow)</li><li>Accepts 9F34 at face value</li><li>Incorporates that CVM Results into the cryptogram calculation</li><li>Returns a normal ARQC to the terminal</li></ul><p>High-value transaction (9999, cardholder verification required):</p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DU72t5d2ZFME&amp;type=text%2Fhtml&amp;schema=google&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FU72t5d2ZFME" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/04b725bef5c8c29681653844bd2baf9f/href">https://medium.com/media/04b725bef5c8c29681653844bd2baf9f/href</a></iframe><p>Log Terminal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*7vTy81N-FaZUy1fjswf5kw.png" /></figure><p><strong>ControlModel</strong> is the value of <strong>1F02</strong> (an internal proprietary tag of the terminal) that defines whether or not to perform/display the PIN entry (PIN Display). This will be explored in more depth in the POS Terminal section.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DYKoLu0naND1XW1I7Tnlug.png" /></figure><p>From the card’s perspective:</p><p><strong><em>“The terminal said it successfully verified the PIN, it’s within my CVM List, my IACs allow online tracking, therefore I generate ARQC.”</em></strong></p><p>This scenario clearly shows that the card doesn’t know if the PIN was entered or not. It only relies on what the terminal declares.</p><h4>Scenario B: MiTM Modifying the 9F34</h4><p>In this scenario, a <a href="https://github.com/CardToolz/libnfc_mitm_cffi">Man-in-the-Middle (MiTM)</a> attack is performed between the terminal and the card, using tools such as <a href="https://github.com/nfcgate/nfcgate">NFCgate</a> or PN532 readers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Od6amBl3p7dOJHuaD6jz0Q.jpeg" /></figure><p>The terminal executes the complete flow, where it requests and receives the original CVM List from the chip, identifies that the first preferred method is Encrypted PIN verified Online, processes and assembles the CDOL1-data with:</p><ul><li>9F34 = 420300 — Encrypted PIN verified online (result to be confirmed by the backend)</li><li>TVR byte 3 = 04 — bit &quot;Online PIN entered&quot; active, indicating that the PIN was entered.</li></ul><p>MiTM intercepts the APDU from Generate AC on the terminal → card path and replaces the bytes corresponding to 9F34, from <em>4203</em> to <em>1F03</em>, resulting in <strong>1F0302 (No CVM required, successful)</strong>, without touching any other field. The chip receives the already altered APDU. In this scenario, a complete PIN bypass is not performed, since the terminal still displays the screen for PIN entry; <strong>the objective here is to specifically expose the absence of internal cross-validation of the chip.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M73jJhS1Mes8_LcIo4cEIQ.jpeg" /></figure><p>Log MiTM:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*AvQvK6bgbPKoCKNuD1bVuw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H9-bKoNWvVdltQoKCp4Bgg.png" /></figure><p>The chip simultaneously received two contradictory fields in the same CDOL1-data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*x9toATg4SvrEN-T__qxcyQ.png" /></figure><p>The TVR declares that the PIN was entered. The 9F34 declares that no bearer verification was performed. <strong>These two fields are logically incompatible! </strong>And the chip did not detect the contradiction. It accepted both values, incorporated them into the AC calculation, and returned ARQC.</p><p>Scenario A demonstrated that the chip trusts the 9F34 as a statement from the terminal. Scenario B demonstrates something deeper, where the chip does not perform any cross-consistency validation between the fields it itself requested.</p><p>TVR and 9F34 arrive together in the same command, describe complementary aspects for the same transaction, and when they describe opposite realities, the chip does not react. Revealing how all responsibility for detecting this inconsistency is delegated to the backend.</p><p>In the lab environment, this attack is especially facilitated by the fact that the terminal is configured without performing any <strong>ODA (Offline Data Authentication)</strong>, that is, it does not perform CDA and the 9F4B (SDAD) tag does not even appear in the responses. This means that in this scenario the terminal does not perform any cryptographic check, facilitating a MiTM attack. However, even if CDA were active, <strong>the card would only sign the already altered data, and the SDAD would remain consistent with the forged 9F34</strong>, exposing yet another flaw in Mastercard’s design. CDA would help detect changes to the terminal after the cryptogram is generated, but it does not protect against manipulations made to the card beforehand.</p><p>Although most of this failure lies on the terminal’s side, which is either compromised or simply unable to perform any type of ODA, it also exposes the other side of the problem:</p><p><strong>The Mastercard blindly accepts everything the terminal declares</strong>, does not react to the absence of ODA, does not transform suspicious/contradictory combinations into AAC, and continues to generate ARQC. This will be explored in more depth in the following sections.</p><p><strong>Scenario C: MiTM modifying the CVM List (8E) in the READ RECORD (Forcing NoCVM)</strong></p><p>Without using any ODA in the transaction, the next step is to intercept the data at an earlier stage of the Scenario B flow. Here, the MiTM attack acts on the chip’s response during the READ RECORD, in the direction <strong><em>FromCard → ToReader</em></strong>, before the terminal makes any CVM decision.</p><p>For this attack, the terminal receives a CVM List where the PIN rule (4203) is replaced by NoCVM 1F03). Thus, the terminal never knew that PIN was an option, legitimately choosing NoCVM, does not display a PIN screen, and fills in 9F34 = 1F0302 on its own. The TVR byte 3 remains zero, not signaling any CVM failure condition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1HVSzSnIp4eIweFuIDqBPA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*x_MNlxRuLMha061cCkJEmw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*5SnBD1O_G1hKm-KBPinX9A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*9Gwpyjo2lLWeVmXC3_Hy-A.png" /></figure><p><strong>Bypass PIN Mastercard 020000 to 1F0002 (High amount 1000)</strong></p><iframe src="https://cdn.embedly.com/widgets/media.html?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DLaop_MkpjyY&amp;type=text%2Fhtml&amp;schema=google&amp;display_name=YouTube&amp;src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FLaop_MkpjyY" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/1356aab0cefb2a3022887b2125730be0/href">https://medium.com/media/1356aab0cefb2a3022887b2125730be0/href</a></iframe><p>Code that modifies via Data Hook:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*-qcYbjodrlbTmbGLr7244A.png" /></figure><p>Scenario C is a direct evolution of Scenario B, where, upon performing the interception for the READ RECORD, the MiTM produces a transaction where all fields are internally consistent.</p><p>However, the internal consistency of the fields actually reveals a lack of risk policy that goes beyond what Scenario B had already revealed. The chip, at the moment of Generate AC, has simultaneous access to two directly related fields: the transaction value (9F02) and the CVM result (9F34). Both are also used in the Application Cryptogram calculation. The issuer could configure the chip to cross-reference these two fields and apply a minimum rule such as:</p><p><strong><em>“If 9F02 &gt; floor limit configured AND 9F34 = NoCVM, generate AAC.”</em></strong></p><p>This logic is technically feasible. The card’s CDOL1 includes 9F02 and 9F34; the chip receives them before the AC calculation, and the IACs provide the mechanism to react to risky combinations, including the combination of high value with no cardholder verification. The card knows the transaction value. The card knows that no CVM was applied. <strong>And yet it doesn’t react</strong>.</p><p>As soon as the chip receives NoCVM (1F0302) for a high-value transaction, this combination is, by itself, detectable locally without depending on any external information. It is not necessary to know if the PIN pad was present, if the screen was displayed, or if the cardholder typed anything. It is enough to compare 9F02 with a value configured by the issuer and verify if 9F34 is consistent with that value.</p><p>Here, the issuer did not configure any correlation rules between value and CVM in the IACs. The chip receives both fields without ever asking if the combination “makes sense.” This is the dimension that Scenario C adds to the analysis:</p><p><strong><em>It’s not just that the chip trusts what the terminal declares, it’s that the chip doesn’t use the information it already possesses to apply any local risk policy.</em></strong></p><p>This will be explored in more depth in the following sections.</p><p>A similar attack was demonstrated in the paper “<a href="https://www.usenix.org/conference/usenixsecurity23/presentation/basin">Inducing Authentication Failures to Bypass Credit Card PINs (Basin et al.)</a>”, where the described attack forces the CDA not to be performed, thus making it possible to “clear” the CVM List, along with the IAC Denial from the card during the transaction.</p><p>The attack consists of three steps executed via MiTM during the READ RECORD:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*d7W5UpgUbyGQXlwdoxweUQ.png" /><figcaption>Inducing Authentication Failures to Bypass Credit Card PINs. 3.2 Exploiting Authentication Failures</figcaption></figure><p><strong>S3(a) </strong>— Replaces the CA Public Key Index (tag 8F) with an invalid index, forcing the terminal to mark “CDA Failed” in the TVR and disable ODA.</p><p><strong>S3(b)</strong>— Removes or modifies the CVM List (tag 8E), eliminating all PIN-based methods.</p><p><strong>S3(c)</strong> — Zeros the IAC Denial, ensuring that the formula <em>(IAC-Denial OR TAC-Denial) AND TVR = 0</em>, preventing the transaction from being refused offline even with CDA Failed active in the TVR.</p><p>Step S3(c) is necessary precisely because, on cards with non-zeroed IAC Denial, the active “CDA Failed” bit in the TVR would cross with the IAC Denial and result in AAC. The Basin attack needs to neutralize this defense manually.</p><p>Scenario C executes only S3(b), without S3(a), without S3(c), and the attack works. This is possible for two reasons directly related to the issuance configuration of the analyzed Mastercard card:</p><p>First, the <strong>IAC Denial (00 00 18 00 00)</strong> is essentially zeroed out for all relevant risk scenarios. Basin’s S3(c) step is necessary to neutralize an IAC Denial protecting the card. In the analyzed card, this protection does not exist; the IAC Denial does not react to CDA Failed, does not react to CVM failed, and does not react to values ​​above the floor limit. Basin’s attack would need to neutralize a defense that simply wasn’t configured here.</p><p>Second, in the tests performed, the terminal did not execute ODA at all, there was no SDAD in the responses, and the terminal did not verify the integrity of the Records’ data. Basin needs S3(a) to disable ODA because the terminal in your scenario executes it by default. In the scenario described here, this layer of protection was already absent before any modification, due to a compromised terminal.</p><p>In other words, Scenario C is a scaled-down version of Basin’s attack, scaled down not due to technical limitations, but because the defenses Basin needed to neutralize are not present.</p><h3>6.4 Absence of a Parameter Validation Policy in the Transaction</h3><p>During testing, it was also possible to perform transactions completely outside the standards expected by ISO 3166/4217, including invalid values ​​for <strong>Terminal Country Code (9F1A)</strong> and <strong>Transaction Currency Code (5F2A)</strong>, without the card rejecting or interrupting the process. These transactions were generated using Proxmark3 and the POS Terminal using invalid codes of 9999 for both EMV Tags.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/861/1*Sr55qLbn9n9y0VDbA_qtDg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IwkjwXoKVC-z8d4JXd-oyg.png" /></figure><p>Even with clearly invalid data — such as codes outside the ISO 3166/4217 standard and even impossible dates (month 23), the card:</p><ul><li>It generated the ARQC normally</li><li>The ATC was increased, registering the transaction as valid</li></ul><p>It’s important to pinpoint the problem correctly. In the EMV specification, the primary responsibility for validating the conformity of fields 9F1A and 5F2A lies with the terminal, not the chip. The card was not designed to reject transactions based on the sanity of ISO fields; this control belongs to the terminal kernel and, ultimately, to the backend.</p><p>Therefore, the tests reveal not an isolated chip failure, but rather the absence of a context validation policy configured by the issuer in the card issuance profile. It would be technically feasible for the issuer to define, for example:</p><p><strong>“If the received currency code does not match the card’s issuance currency and the terminal is declared offline, generate AAC.”</strong></p><p>The analyzed Mastercard cards do not implement any such logic. Even when receiving visibly invalid values ​​such as codes outside any ISO standard and impossible dates, the chip does not apply any minimal context check and responds with ARQC in all scenarios, entirely delegating anomaly detection to the backend.</p><p>This behavior reinforces the pattern observed throughout the research: the analyzed emission is maximal in local permissiveness and total in risk delegation to the issuer, who simply accepts it as long as the overall structure of the APDU is well formed.</p><h3>6.5 Absence of Local Risk Policy and Complete Delegation to the Backend</h3><p>From the EMV specification’s point of view, nothing prevents the issuer/bank from issuing the card to react differently to potentially dangerous context combinations, such as transaction value (9F02), cardholder verification method (9F34), ODA result, and terminal capabilities. A card issued with good local risk policies, for example, could implement policies such as:</p><p><strong><em>“If 9F02 (Transaction amount) &gt; X and 9F34 = No CVM required, generate AAC instead of ARQC.”</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/998/1*bkTHObcmZPJwqNwj_80L_Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IpT_VxCq3GH6JOFGgevpRA.png" /></figure><p><strong><em>“If the terminal claims to support ODA, but the TVR indicates offline data authentication not performed, generate AAC.”</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rI0eBgjTBZ-T78b5_q7YGw.png" /></figure><p><strong><em>“If the terminal is offline-only + high value + NoCVM, generate AAC.”</em></strong></p><p>Technically, this is feasible because the card has access to all these signals at the time of GENERATE AC, provided that the issuer has placed them in CDOL1 (8C), which allows the card to receive TVR (95) with the ODA bits, 9F33 with the terminal capabilities, as well as 9F02, 5F2A, and 9F34. From this “final state,” with value, currency, TVR, CVM Results, and CVM List (8E) read previously, it could apply local risk logic and decide:</p><p><strong><em>“Here I deny (AAC), here I generate ARQC.”</em></strong></p><p>In the case of the analyzed Mastercard, the chosen issuance follows the opposite path: IAC (9F0D/0E/0F), AUC (9F07), and the CVM List itself (8E) implement nothing. In several of the tested scenarios, the observed behavior is always the same. That is, although technically the chip could differentiate between “high value + NoCVM” and “low value + NoCVM” and react safely, in practice it does not.</p><p>For example: it receives 9F34 = 1F0002 (NoCVM successful), whatever the value, and continues generating ARQC in the same way.</p><p>The situation becomes even clearer when looking at how the ODA was processed. The terminal executes the ODA, not the card; this is not a flaw, it’s the EMV design itself, but what really matters is the card side. The chip only delivers the necessary elements (certificates, public keys, signed records, SDAD/9F4B) and signals to the AIP (82) that it supports SDA/DDA/CDA. It is the terminal that chooses whether or not to verify these signatures with the brand/issuer/bank keys and decides locally whether ODA was “not performed”, “performed successfully” or “failed”.</p><p>The card does not “witness” this verification; it can only “see” what the terminal declares happened in the TVR bytes (95).</p><p>Log response from the card (Generate AC) <strong>with</strong> ARQC <strong>with</strong> SDAD:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yZOVBY7JMxGLeQoobL73ng.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bv1zr_3sM404VTlsaB8vrg.png" /></figure><p>Log response from the card (Generate AC) with ARQC <strong>without</strong> SDAD:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1021/1*aBuaxBhaxVLcyoVysu9FRA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KBFHdiCQHFZdiedStm5-Tg.png" /></figure><p>If the issuer configures the IACs to react to these bits, the card becomes capable of converting dangerous combinations (e.g., a terminal that claims to support ODA + TVR indicating “ODA not performed”) resulting in AAC.</p><p>In tests with Mastercard, this does not occur. Even with the terminal operating without ODA, and the TVR marking “ODA not performed,” the chip does not use this information to deny locally; it continues to issue ARQC, essentially “in the dark,” as if the risk analysis always depended on being performed later in a backend.</p><p>But even delegating the decision to the backend, does the chip provide the issuer with any independent information in the IAD that allows them to detect CVM manipulation?</p><p>To answer this, the CVR (Card Verification Results) within the IAD (9F10) generated by the chip in the transaction via MiTM (Scenario C) was analyzed:</p><pre>IAD:  0110A00003240000000000000000000000FF<br>CVR:  A00003240000</pre><p>Decoding the CVR reveals that the only bits related to CVM refer to Offline PIN (Byte 1 bits 3–1 and Byte 4 bit 6). There is no bit in the CVR to record whether an Online PIN (Encrypted PIN Verified Online) was requested, entered, or verified. In practice, the CVR of a legitimate transaction with an Online PIN and the CVR of a transaction with a NoCVM forced via MiTM produce the same result in the CVM bits.</p><p>The backend receives the ARQC (valid, since the chip calculated it using the CDOL1 data including 9F34=1F0302), the CVR without any differentiating CVM flag, and the 9F34 itself, which has already been manipulated by MiTM. There is no independent cryptographic evidence that allows the issuer to distinguish the two situations based solely on the transaction data.</p><p>This further completes the delegation cycle identified throughout the research: <strong>the chip does not apply a local risk policy, and at the same time does not provide the backend with independent evidence to compensate for this absence</strong>. In a way, the security of the CVM depends entirely on the integrity of the terminal, which is precisely one of the compromised links in the analyzed attack scenarios.</p><p>It was also observed that the card does not request the <strong>9F33 tag (Terminal Capabilities)</strong> in its <strong>PDOL</strong> or in its <strong>CDOL1</strong>. As a consequence, the card does not explicitly receive information about the terminal’s actual capabilities during the transaction.</p><p>Instead, the card relies primarily on fields such as <strong>95 (Terminal Verification Results)</strong> and <strong>9F34 (CVM Results)</strong>, both generated and declared by the terminal itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TJWkU3L9rWDVdBwfXoiJMw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DyjzangZ6KHzQArQbNfO0Q.png" /></figure><p>This means that the card has no direct visibility into fundamental aspects of transaction execution, such as:</p><ul><li>Whether the terminal actually supports PIN</li><li>Whether the PIN entry interface was displayed</li><li>Whether a PIN pad is present</li><li>or whether cardholder authentication was effectively performed.</li></ul><p>In other words, the card bases its risk assessment exclusively on information reported by the terminal, <strong>without independent mechanisms to validate whether these conditions actually occurred</strong>.</p><p>Thus, if the terminal is misconfigured, modified, or compromised, it may declare verification states that do not reflect the actual authentication execution. In this situation, the card will continue the transaction flow and generate a cryptogram (ARQC) based on information that does not necessarily correspond to the terminal’s actual behavior.</p><p>In short, what the analysis reveals is not just a card that “trusts the terminal too much” or “trusts the backend too much,” but rather a flawed and permissive <strong>issuance</strong> that disregards any local risk policy. Not differentiating between high and low values ​​when NoCVM is applied, it doesn’t react to CVM failures, doesn’t penalize the absence of an ODA, doesn’t effectively use TVR/IAC as a last line of defense, among several other scenarios we’ve seen here.</p><p>The chip sees enough context to raise suspicion, but it’s configured to never “deny” anything on its own. All responsibility is pushed to the backend, where in the scenarios we’ve seen here, this total delegation transforms the EMV architecture into something easy to manipulate, where the card signs, generates ARQC, and registers, without any local protection capable of saying “no”.</p><p>But what is Mastercard’s backend and how does it affect card security validation?</p><h3>7. Mastercard Backend and Related Work</h3><p>Tests with the Mastercard card showed a very clear pattern: the chip generates ARQC under virtually any condition, accepts invalid parameters, does not apply local value/currency limits, and does not impose rejections based on CVM failure or any type of local policy. Instead, it delegates all risk policy to the issuer/bank, assuming that an online backend will review the cryptogram and make the final decision.</p><p>This behavior fits directly into the model described in the paper “<a href="https://www.usenix.org/conference/usenixsecurity25/presentation/pavlides"><strong>More is Less: Extra Features in Contactless Payments Break Security</strong></a>”, which analyzes how Mastercard has been increasingly migrating security logic to the backend, leaving the card at the mercy of this backend for verifications.</p><h4>7.1 Mastercard Backend Model Overview</h4><p>The paper shows that, in the modern Mastercard ecosystem, critical decisions such as:</p><ul><li>If a CVM was actually applied (PIN or CDCVM)</li><li>Whether that transaction should be “without CVM” or require stronger authentication.</li><li>Whether certain extra features (smartphone as a card, “tap on phone”, etc.) were used correctly.</li></ul><p>They are not robustly validated by the terminal or the card, but rather by the issuer, when processing the ARQC and proprietary fields present in the IAD/FFI.</p><p>In other words, the <strong>Mastercard Backend together with the issuer</strong> is the one who actually interprets the IAD, fields and CDCVM flags/limits, and decides whether that combination of (value, currency, 9F34, CVR) is acceptable or not.</p><p>The paper explores how this becomes dangerous when:</p><ol><li>The sender relies too much on these fields</li><li>And at the same time there are readers or offline scenarios where the backend is not consulted, but the card continues to generate ARQC normally.</li></ol><h3>7.2 Direct Connection to Mastercard Card with Backend Model and No Local Policy</h3><p>In tests with the Mastercard card, as we have already seen, the observed pattern is that of a clearly “ARQC-only” issuance, fully aligned with the backend-centric model described in More is Less paper.</p><p>All the scenarios analyzed fit exactly into the architecture described in the paper: Mastercard increasingly shifts the security logic to the issuer, using the card only as a “cryptogram generator” and a generator of enriched fields (IAD, CVR, proprietary extensions) that approves anything, while the <strong>Backend</strong> is treated as the only place where the final decision actually happens. The card has no way of verifying the honesty of the origin of fields, as we have already seen.</p><p>What it sees is only the “final state”. Technically, the issuer could use the values ​​of the fields that the card receives during the transaction to program local risk logic, such as: “If 9F02 &gt; X and 9F34 = NoCVM, generate AAC” or “if terminal declares it supports ODA but the TVR indicates _offline data authentication not performed_, generate AAC”, and thus cause the IACs to react to these combinations.</p><p>In terms of the internal configuration of the analyzed cards (to be detailed later), the CVM List (8E) and the Issuer Action Codes (9F0D/9F0E/9F0F) do not provide restrictive rules for detecting and denying risky transactions, and the Application Usage Control (9F07) is extremely permissive, allowing virtually all types of use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*3DYxaGOchZZLAZi0vNhaig.png" /><figcaption><strong>More is Less: Extra Features in Contactless Payments Break Security, Section 4.2</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/422/1*52ewX8c2pPWJb7n6kJwAgQ.png" /><figcaption><strong>More is Less: Extra Features in Contactless Payments Break Security, Section 4.4</strong></figcaption></figure><p>In terms of Related Work, the paper More is Less shows how Mastercard built an ecosystem that is overly dependent on the backend. My research takes exactly this model and shows the practical consequence outside the “ideal world” of the card network in real cards, which have a chip configured to never say “no” on their own, always generating ARQC and pushing the responsibility for risk onto a backend.</p><p>This article is already quite long and technical. Everything from validation attempts on the backend, POS terminal, EMV tags for configuring each card analyzed, and the complete conclusion will be covered in Part 2. If you’ve made it this far, thank you very much for reading! Link to Part 2: <a href="https://medium.com/@davimouar/tap-to-exploit-analyzing-and-manipulating-mastercard-contactless-transactions-part-2-05d709f3e766"><strong>LINK</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=732c124fb7b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Bluetooth to CVE: Breaking Payment Terminal (mPOS) Security]]></title>
            <link>https://medium.com/@davimouar/from-bluetooth-to-cve-breaking-payment-terminal-mpos-security-591a463f7088?source=rss-87e90529fb2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/591a463f7088</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[payments]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[bugbounty-writeup]]></category>
            <dc:creator><![CDATA[Davi Moura]]></dc:creator>
            <pubDate>Thu, 02 Apr 2026 18:30:20 GMT</pubDate>
            <atom:updated>2026-10-11T23:41:06.535Z</atom:updated>
            <content:encoded><![CDATA[<p>Mobile payment terminals (mPOS) have become a core part of everyday transactions, especially for small businesses relying on accessible and low-cost payment solutions. But behind this convenience, there are often overlooked risks. In this research, I analyzed the Bluetooth communication protocol of one of these terminals and discovered that the security of the entire transaction flow can be compromised simply by interacting with the communication layer.</p><p>Through reverse engineering and hands-on exploration, I identified four vulnerabilities affecting fundamental security properties:</p><ul><li>Missing authentication — <a href="https://www.cve.org/CVERecord?id=CVE-2026-4582">CVE-2026–4582</a></li><li>Replay attack — <a href="https://www.cve.org/CVERecord?id=CVE-2026-4583">CVE-2026–4583</a></li><li>Cleartext transmission of cardholder data — <a href="https://www.cve.org/CVERecord?id=CVE-2026-4584">CVE-2026–4584</a></li><li>Display QR Code Rendering alignment ui layer — <a href="https://www.cve.org/CVERecord?id=CVE-2026-108901">CVE-2026–108901</a></li></ul><p>These vulnerabilities reveal how the communication protocol itself layer alone can be sufficient to manipulate transactions and expose sensitive data. More information is available on GitHub: <a href="https://github.com/Davim09/m6plusexploit/">https://github.com/Davim09/m6plusexploit/</a></p><blockquote><strong><em>Disclaimer:</em></strong><em> Everthing was analyzed in a controlled environment to ensure no third-party data was compromised during the process. The content shared in this article is strictly for educational and informational purposes, I am not responsible for any misuse of the knowledge presented. The manufacturer had already been formally contacted, but no firmware update was available at the moment.</em></blockquote><h3>Background</h3><p>Standard architecture for mPOS devices:</p><pre>┌─────────────┐   Bluetooth    ┌──────────────┐  <br>│ Smartphone  │◄──SPP/RFCOMM──►│   Terminal   │  <br>│     App     │                │    (MPOS)    │  <br>└──────┬──────┘                └───────┬──────┘  <br>       │                               │  <br>       │ Internet                Card Interface  <br>       │                           (Chip/NFC)  <br>       ▼                               ▼  <br>┌─────────────┐                 ┌──────────────┐  <br>│  Acquirer/  │                 │   Payment    │  <br>│   Payment   │                 │    Card      │  <br>│   Gateway   │                 └──────────────┘  <br>└─────────────┘</pre><p>Most mPOS devices communicate via Bluetooth between the mobile device and the reader. In this model, a significant portion of the transaction data and logic is transmitted from the mobile application to the terminal, such as EMV tags that handle and control the transaction.</p><p>In this context, an attacker who manages to intercept or inject data into the Bluetooth communication, whether through pairing failures, use of insecure protocols, or reverse engineering, can alter critical values ​​without needing direct access to the terminal’s software (SDK). In such a scenario, standardized EMV tags, such as DF8126 (Required CVM Reader Limit), can have their limits altered, completely configuring/customizing the terminal’s behavior in a transaction.</p><p>The terminal used in the analysis establishes communication with mobile applications via Bluetooth Classic using the<strong> SPP/RFCOMM (Serial Port Profile)</strong>,<strong> </strong>without any PIN for the authentication. This profile functions as a virtual serial link between the mobile device and the terminal, providing a bidirectional transport layer. This channel doesn’t just operate as telemetry or logging; it functions as a <strong>Transaction Control Plane</strong>, where:</p><p>App → Terminal: Sends configuration parameters and transactional context<br>Terminal → App: Returns a complete dump of the data that was processed during the transaction</p><h3>Protocol Framing Structure</h3><p>Each transmitted message has a proprietary framing structure from the manufacturer. Here is a Real Example (Transaction R$ 233.00) of the packet structure:</p><pre>4D 004C 0002 A0 3200 46 1F0101711F0204926400081F0B07DF812603200000... F4<br>│  │    │    │  │    │  └─ TLVs (70 bytes)<br>│  │    │    │  │    └─ LENGTH_BYTE = 0x46 (70 decimal)<br>│  │    │    │  └─ Fixed marker<br>│  │    │    └─ Status<br>│  │    └─ Command<br>│  └─ Packet length<br>└─ Start (TX)</pre><ul><li>There is a XOR checksum in the end that only offers weak integrity against accidental corruption, not against intentional tampering.</li></ul><p>The Hex payload is structured using standard EMV TLV encoding, extended with internal proprietary tags (e.g., <strong>1F02</strong>, <strong>1F0B</strong>) that directly impact terminal behavior according to vendor-specific implementation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*j6XXEM36HYG30wxuUHNjeA.png" /><figcaption>Standard EMV Tags Observed</figcaption></figure><h3>Python Exploit</h3><p>Using Python code that automatically pairs with the terminal’s MAC address, it was possible to automate all the calculations needed to assemble a transaction and send it via Bluetooth to the terminal. This was achieved by creating a fully customized Hex Payload!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/340/1*vpKUV_V0l7tW1qmqdYiofQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*7Jwx-x5KrNhmOQ3YcLMAMg.png" /></figure><p>This code, or exploit, was assembled based on original Hex sent from the original app, captured through a sniff of the App → Terminal communication. These original Hex files are essential for understanding the communication and calculation logic, and can also be freely replicated, and the terminal simply accepts a typical replay attack.</p><p>Considering a large-scale attack on multiple terminals communicating via Bluetooth, an attacker can simply sniff this communication and intercept the original Hex file being sent, consequently studying the logic and calculations to build a specific exploit for that terminal.</p><h3>Missing authentication and Cleartext transmission</h3><p>Using the Python exploit, it is possible to establish a direct Bluetooth connection with the terminal, immediately exposing a fundamental design flaw: <strong>there is no sender authentication at the protocol level</strong>. The mPOS accepts any pairing request and blindly trusts any connected device, effectively allowing arbitrary entities to act as a legitimate transaction source.</p><p>Once connected, the terminal accepts and processes any incoming Hex payload without performing <strong>integrity validation, origin verification, or cryptographic authentication</strong>. This enables full impersonation of the legitimate mobile application responsible for assembling EMV transaction data.</p><p>Additionally, the communication channel transmits critical transaction data in <strong>cleartext </strong>or weakly protected formats, including EMV tags and sensitive fields (Track 2, PAN, CVM Result, Cardholder Name). This violates fundamental security principles and industry requirements (e.g., PCI-DSS), as sensitive cardholder data can be intercepted, modified, or replayed.</p><p>As a consequence, an attacker can not only inject arbitrary transaction parameters, but also <strong>observe, replay, and manipulate sensitive transaction data in transit</strong>, fully compromising the trust model between the mobile application and the terminal. This effectively transforms the Bluetooth channel into an unauthenticated control plane for transaction execution.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FaQPG4gpd5mM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DaQPG4gpd5mM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FaQPG4gpd5mM%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/85b7bab46102455889230ff44dd16f21/href">https://medium.com/media/85b7bab46102455889230ff44dd16f21/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*6Fzx8sPksPhOaKG2SBAmKw.png" /><figcaption>Example of a transaction built with the Exploit</figcaption></figure><p>We can see that right in the command that “writes” the transaction data, In the example, it was possible to freely set/configure the values ​​of 1F02 and 1F0B.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/548/1*5AQ1XNNfPNyvcr3XFZFQ3Q.png" /><figcaption>Response (RX) with the decoding</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*cOLw4YygH6XcU5r-jKKwqA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/359/1*PO_h2kAMCjSoRUF_Dkl5vg.png" /></figure><h3>Replay Attack</h3><p>The terminal communication protocol does not implement any protection mechanism against <strong>Replay attacks</strong>, as previously mentioned. The absence of critical elements such as <strong>nonce</strong> (one-time number), <strong>timestamp validation </strong>or <strong>sequence counters </strong>allows an attacker to capture a legitimate transaction command and reuse it indefinitely. Although the tag 1F03 contains a timestamp in the format <em>YYYYMMDDHHmmss</em>, this field is not validated by the terminal against the system’s internal clock, functioning only as decorative metadata without any freshness check or acceptance window, being simply accepted and “written” to the terminal.</p><p>The terminal processes each received command in an isolated and stateless manner, allowing the same hex payload to be accepted multiple times as valid independent transactions.</p><p>To verify whether old commands remain valid after an extended period, a test was performed using a legitimate command that was captured on January 22, 2026 (date encoded in tag 1F03) and stored without modification.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FsLxNqBN5lB4%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DsLxNqBN5lB4&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FsLxNqBN5lB4%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/b6e257e9fe419c9d7658b9b13cc479f7/href">https://medium.com/media/b6e257e9fe419c9d7658b9b13cc479f7/href</a></iframe><p>We can see that each time the command is sent, it reverts to the time 03:51:00, that is, the time present in the hex file of the sent command. Each replay is processed as an independent transaction. There is no deduplication system, caching of viewed commands, or rate limiting. The terminal responds identically in all cases.</p><h3>Display &amp; QR Code Injection (CVE-2026–108901)</h3><p>About six months after I published the original research, I came back to the terminal. I had been thinking about the display itself, could I control what gets shown on the screen?</p><p>In the original application, there is an option to render a QR code on the terminal screen via 0002AA04 . I wonder if it’s possible to manipulate it?</p><p>I wrote a minimal test, connect via RFCOMM, send the0002AA04 with a crafted TLV payload, see what happens.</p><p>It worked! No pairing required. No authentication. Any device within Bluetooth range can push arbitrary content to the display.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LR7j1HhoYLKWUxc8dp0HvA.jpeg" /></figure><h4>What the command controls</h4><p>The display command accepts several TLV tags over the same unauthenticated RFCOMM channel. Beyond the QR payload itself (tag 1F18, capped at 127 bytes by the firmware), the command controls the display timeout up to 255 seconds, the display style (text only, QR only, or both on screen at the same time), a title bar, a status bar, the terminal’s LED color, and the buzzer.</p><p>There is no signature, no session binding! Just a single-byte XOR checksum, recomputable for any modified payload in one line of Python.</p><h4>Scenario 1: PIX QR substitution</h4><p>PIX BR Code is the QR format Brazil’s banking system uses for instant payments. The spec is EMVCo-based. The payload ends with a CRC-16/CCITT-FALSE. That is the only integrity check. No cryptographic signature over the content.</p><p>A BR Code injection gives the attacker full control over the PIX key (who receives the funds), the transaction amount, and the merchant name and city shown in the banking app confirmation screen.</p><p>I built a valid BR Code pointing to an attacker-controlled PIX key, set the terminal LED to green to match what a legitimate transaction shows, and injected it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k36f2b6-wCRJrclOcOyXjQ.jpeg" /></figure><p>I scanned the QR with a real banking app. The app processed the payment to the injected key. The confirmation screen showed the merchant name I put in the BR Code.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F7tGgDLwtdwY%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D7tGgDLwtdwY&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F7tGgDLwtdwY%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/ca75a82b05c6df2ab63e586615452e98/href">https://medium.com/media/ca75a82b05c6df2ab63e586615452e98/href</a></iframe><p>Total attack time: 2 to 5 seconds. The merchant sees nothing. The customer sees a QR with the title “PIX” and a green LED on the terminal, no indication the code was replaced.</p><p>One hard constraint: the firmware caps the QR payload at 127 bytes. Standard PIX keys (CPF, phone, email) fit easily. EVP keys are at the edge; dropping the amount field from the payload recovers the space.</p><h4>Scenario 2: Social engineering via text injection</h4><p>The same opcode renders arbitrary text on the screen. With the display style set to show QR and text simultaneously, an attacker can show a message alongside the injected code. The buzzer and LED are also controllable, so the attack can match whatever visual and audio feedback the merchant expects from the terminal.</p><p><strong>Device out of service.</strong> Inject a maintenance message with a 255-second timeout and walk away. No one tries to use the terminal while it shows an error. The merchant calls support; the attacker has four minutes.</p><p><strong>Fake firmware update.</strong> A progress bar message with a full timeout. The terminal appears locked mid-update. With multiple frames sent in sequence the animation looks like the update is actually running.</p><p><strong>Fake transaction feedback.</strong> The title and status bar areas can show messages that look like terminal output: “Card approved”, “Remove card now”, “Insert PIN”. Because these appear on the terminal screen, merchants and customers have no reason to distrust them.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fu_kN1YcKo5s%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Du_kN1YcKo5s&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fu_kN1YcKo5s%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/dfc4bdbdf1841c0469affee64f2b6b79/href">https://medium.com/media/dfc4bdbdf1841c0469affee64f2b6b79/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F5sOH9MwOnMw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D5sOH9MwOnMw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F5sOH9MwOnMw%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/8684d7a1fc69ea3c868bdeaea6306aac/href">https://medium.com/media/8684d7a1fc69ea3c868bdeaea6306aac/href</a></iframe><h4>Replay + display injection</h4><p>CVE-2026–4583 (missing replay protection) applies to the display channel too. A 0002AA04 packet captured from legitimate Bluetooth traffic can be replayed as-is, or modified with a substituted BR Code payload and a recomputed XOR checksum, then replayed. No fresh connection to the app needed.</p><h3>Vulnerability Matrix and Attack Scenarios</h3><p>For better understanding, I have created a table that summarizes the discovered attacks/vulnerabilities that can be carried out through the Bluetooth communication vector, mainly using the Python exploit, exploiting both the protocol and parameter manipulation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*aHza8akufKU56V8GZFe_9A.png" /></figure><p>Exploitation via Bluetooth depends on capturing the original transaction data and taking over the connection from the legitimate device. Attempts to achieve a full MITM through jamming, spoofing, or deauthentication were unsuccessful. Instead, the attack is more feasible during natural disconnection events, where the terminal becomes available for new pairing, allowing an attacker to connect and interact with it.</p><p>The exploitation of Bluetooth communication vulnerabilities in mPOS is not an isolated case. At <a href="https://www.youtube.com/watch?v=NGhamH4_CZY">DEFCON 31, Borgogno and Barrionuevo demonstrated how to turn a virtual wallet into a skimming device</a>, exposing similar attack vectors in the same mPOS ecosystem. This reinforces that the vulnerabilities documented here reflect a broader architectural problem, not limited to a single manufacturer or protocol.</p><h3>Conclusion and Recommendations</h3><p>Four vulnerabilities, one root cause. The Bluetooth channel was built with no trust boundary between the terminal and whatever device connects to it. Authentication, integrity, and data protection were all left to the application layer, which implemented none of them. Any device in range can read transaction data, replay commands, modify EMV parameters, and rewrite what appears on the screen.</p><p>For Shenzhen HCC Technology, this is a protocol redesign, not a patch. The terminal needs mutual authentication via per-device certificates or pre-shared keys with HMAC-SHA256 on every command, 64-bit cryptographic nonces per command to block replay, AES-256-GCM encryption over the data payload, and PAN and Track 2 removed or masked from responses entirely.</p><p>For merchants running the M6PLUS today, if the terminal is paired to a device you control and physically secured, the exposure is limited. If it operates where Bluetooth range reaches people you don’t know, that is an active problem, not a theoretical one.</p><p>The problem is not unique to just one terminal. Many Bluetooth payment terminals rely on similar protocol designs, implementing weak authentication mechanisms and transmitting sensitive data without adequate encryption, putting thousands of merchants at risk. The goal of sharing this research is purely educational and to raise awareness among terminal manufacturers, payment processors, acquirers, and merchants.</p><p>This analysis of the Bluetooth vulnerabilities of this terminal (mPOS) is one part of a broader research project on payment terminals. The next publication will detail the manipulation of the EMV protocol in Mastercard transactions using the same terminal. If you want to stay up to date with my work and projects, check out my <a href="https://beacons.ai/davi_mw"><strong>Beacons.ai</strong></a> to follow me and see what I’m up to next!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=591a463f7088" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploiting the Menu: Breaking Restaurant Delivery Systems]]></title>
            <link>https://medium.com/@davimouar/exploiting-the-menu-breaking-restaurant-delivery-systems-37c473849ac8?source=rss-87e90529fb2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/37c473849ac8</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[parameter-tampering]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[hacking]]></category>
            <dc:creator><![CDATA[Davi Moura]]></dc:creator>
            <pubDate>Wed, 28 May 2025 02:35:23 GMT</pubDate>
            <atom:updated>2025-05-28T02:39:51.873Z</atom:updated>
            <content:encoded><![CDATA[<p>Restaurant Delivery Systems streamline operations, but they can also present significant security risks. Here’s how I discovered a vulnerability in one of these systems, that allowed me to edit the price of my orders, potentially eat for free, and bypass payments by intercepting and manipulating API requests.</p><p>Since my <a href="https://medium.com/@davimouar/from-order-to-exploit-a-deep-dive-into-restaurant-network-security-64aeaf3a6f64"><strong>last article</strong></a>, I have been researching and studying more about restaurant systems, and this time I found a flaw in a delivery and loyalty platform used by several restaurants in Brazil. It is a white label system where each restaurant has its own app or website, but everything runs on the same backend.</p><blockquote><strong><em>Disclaimer:</em></strong><em> This vulnerability was analyzed in a controlled environment to ensure no third-party data was compromised during the process. The content shared in this article is strictly for educational and informational purposes, I am not responsible for any misuse of the knowledge presented.</em></blockquote><h4>How It Works</h4><p>The vulnerability starts with the way the system handles prices. The client-side application is responsible for sending product prices, delivery fees, and the total amount. All of these prices are generated on the frontend and sent directly to the backend. This allows an attacker to intercept the request and freely modify the prices using Burp Suite before the order is sent. A clear example of classic <strong>Web Parameter Tampering</strong>.</p><p>The situation becomes critical when this client-side flaw is combined with a backend that doesn’t verify any of the prices received. The system simply trusts all prices ​​sent by the client. There’s no recalculation of totals and no validation. If the client sends a total of R$1, the backend accepts and records the order exactly as it was sent in the request.</p><p>These flaws allow anyone to change prices and pay only what and how much they want. The problem is that this is not just an isolated bug, but rather a design flaw.</p><h4>Exploitation</h4><p>I started by placing an order and selecting the desired items, totaling R$26,90. Before sending it to the backend, I intercepted the request using Burp Suite to analyze how the request was structured.</p><p>During the order process, two requests were intercepted, <strong><em>PedidoCalculado</em></strong> and <strong><em>CadastrarPedido</em></strong>, both of which have the same parameters and are structured containing all the order details, including product prices, delivery fees and the total amount.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*G3hud-fDI4G6SM3GmTgvKg.png" /></figure><p>Here we see the end of the <strong><em>PedidoCalculado</em></strong> request, with parameters such as <strong><em>valorTotal</em></strong> and <strong><em>taxaEntrega</em></strong> original. The request is very large, passing a lot of information, but our focus will be on prices.</p><p>I used Burp Suite with <strong>Match and Replace</strong> rules to automatically modify. It was possible to reduce the <strong><em>valor</em></strong> of each item (R$26.90 to R$15.00), as well as adjust the <strong><em>valorProdutoHistorico </em></strong>— which represents the price of the products before adding the delivery fee — and the <strong><em>valorTotal</em></strong>, to “add” the new prices.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/931/1*lda8ISa4rr0GSxucWmJltw.png" /></figure><p>This is essential, because during my tests I realized that it’s not enough to just change the <strong><em>valorTotal</em></strong>, the prices ​​need to be adjusted (added) proportionally. The system only accepts the order if the fields of the prices match the calculation that it would validate itself.</p><p>On the client’s screen, we see a window where they enter their name, payment method and and where the order is sent. It’s worth noting that each establishment can set a minimum price for orders, meaning it will not always be possible to complete the order for just R$1. Here, the minimum is R$15, so we adjusted the price accordingly. <strong>Even so, it’s possible to place orders with prices ​​much lower than the real one.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*J9IVt2hlL_ymOIr0S7hdlg.png" /></figure><p>Looking at the <strong><em>Auto-modified</em></strong> request and the <strong><em>Response</em></strong> we can confirm that all prices ​​were changed successfully, and the order came out to just R$15. And on the client’s screen it’s also possible to see the changed prices ​​and the order accepted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yu291OUXeznC31urAz8WPw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qA6gJT0EsDdJFCmYgAnqeQ.png" /></figure><p>Analyzing the requests, it’s possible to identify several potentially exploitable parameters, such as the token “token”: “a~I?;;+_@!” being used for client login, repeated in multiple requests and not being unique to the user or the establishment. This indicates a lack of adequate session control and a possible<strong> Session fixation</strong> vulnerability?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HRzMEKijISPCWErxk7x9vg.png" /></figure><p>Additionally, the token authenticates to the API, which is where all orders, logins, and critical actions go. In other words, the API is unique and shared by all restaurants. However, the focus here is on fields related to prices, which allow you to “eat for free” or which are already enough to have an impact on thousands of establishments.</p><h4>Finding Vulnerable Targets</h4><p>Since this platform works as a white-label solution, each restaurant operates under its own custom subdomain. This allows you to identify vulnerable establishments at scale using Google.</p><p>By combining keywords, page titles, and URL patterns, it’s easy to find restaurants that use this system, even those operating in your city.</p><h4>Mitigations</h4><p>These flaws allow anyone to change the actual prices of an order, paying much less or even nothing, causing direct financial damage to businesses. If exploited on a large scale, the damage could be enormous, not only financially, but also affecting the reputation of the restaurants involved, since many establishments operate with this same system.</p><p>All price calculations should be done and validated on the backend. The server should validate all prices, such as item prices, delivery fees, and totals, and reject any price that doesn’t match the actual calculation. Also implement features such as HMAC or signed tokens (JWT) to protect the integrity of the request data. And minimize client-side logic with strong authentication and general security practices.</p><h4>Conclusion</h4><p>This vulnerability was reported to the responsible company, but as happens all too often, it was <strong>COMPLETELY IGNORED</strong>. No response and no fix. Unfortunately, this is not surprising.</p><p>The problem is that this is not just one company. Many other delivery systems are built in the same way, executing critical logic on the frontend and exposing themselves to serious risks without even realizing it.</p><p>The purpose of sharing this is purely educational and awareness-raising, and encourage developers, companies and anyone working with this type of system to understand how dangerous this flaw is. Security should never be overlooked, especially when real money and business are at stake.</p><p>I hope you guys have enjoyed the Reading. If you want to stay up to date with my work and projects, check out my <a href="https://beacons.ai/davi_mw"><strong>Beacons.ai</strong></a> to follow me and see what I’m up to next!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=37c473849ac8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Order to CVE: A Deep Dive into Restaurant Network Security]]></title>
            <link>https://medium.com/@davimouar/from-order-to-exploit-a-deep-dive-into-restaurant-network-security-64aeaf3a6f64?source=rss-87e90529fb2a------2</link>
            <guid isPermaLink="false">https://medium.com/p/64aeaf3a6f64</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[Davi Moura]]></dc:creator>
            <pubDate>Tue, 21 Jan 2025 06:43:18 GMT</pubDate>
            <atom:updated>2025-04-10T20:37:15.129Z</atom:updated>
            <content:encoded><![CDATA[<p>Restaurant ordering systems streamline operations, but they can also present significant security risks. Here’s how I discovered a vulnerability in one of these systems, that allowed me to edit my orders, potentially eat for free, and bypass charges by intercepting and manipulating HTTP traffic. Now recognized as<strong> </strong><a href="https://nvd.nist.gov/vuln/detail/CVE-2025-3329"><strong>CVE-2025–3329</strong></a>, this flaw could affect over 30,000 food establishments.</p><blockquote><strong>Disclaimer:</strong> This vulnerability was analyzed in a controlled environment to ensure no third-party data was compromised during the process. It was reported in September 2024 (I will talk about it later), The system is available for anyone to download and test. The use of this information is at the user’s own risk, I am not responsible for any misuse of the knowledge presented.</blockquote><h4>Understanding the Restaurant ordering system</h4><p>This ordering system runs on an Intranet or Peer-to-Peer network where devices and servers communicate using internal IP addresses. Typically, the system is hosted on a Windows PC. As a result, it generates a website accessible through the internal IP, which displays a login page like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*IJDX74w9E-qpkg8sgQXC1g.png" /></figure><p>With the correct username and password, we gain access to the order and table management panel. Where it is possible to place orders, close tabs, settle the bill, access the order monitor, and use other applications:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*giaATYk9q3beXRq9i57MgA.png" /><figcaption>Some images will be translated for clearer understanding</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GArkqf_sDdp6tcrLNDtsIQ.png" /><figcaption>Some images will be translated for clearer understanding</figcaption></figure><p>Next to the IP address in the image there is a message showing that the connection between the browser and the website is not encrypted (Não Seguro). And to find the IP address of the network hosting the ordering system, you just need to identify the IP using port 8080.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*c7SldpxpbC2Z1JuAeyZItA.png" /></figure><p>This means that anyone can intercept the network traffic and view the content of the communication, including passwords, form data and, most importantly, cookies. In the case of the vulnerability discovered, <strong>Cookies</strong> will be essential. By capturing them, we can access the system without needing to know the username and password. <strong>Here’s the first point.</strong></p><h4>Wi-Fi Network</h4><p>This ordering system operates on mobile phones or tablets used by the waiters, meaning it relies on a <strong>Wi-Fi network </strong>to comunicate with the<strong> </strong>order and table management panel. In some restaurants, the waiters use their own mobile phones, while in others, there are fixed terminals located at strategic points within the restaurant, like these:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zf7Yg5MC3PLSsglrlC2tYA.png" /></figure><p>The estimated number of these devices is around 3 to 4, meaning more than 3 IPs communicate with the Order Management System. This represents a significant opportunity and amount of traffic that can be intercepted from these devices.</p><p>We already know they communicate through a Wi-Fi network so to start the exploitation we would first need to access the Wi-Fi network. It usually has some kind of protection like WPA2 and to gain access we just need to capture a handshake and crack the password. An even easier way would be asking the waiter or any employee for the password using social engineering.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sVpkOuLAfp3Fb8-5" /><figcaption>Photo by <a href="https://unsplash.com/@bernardhermant?utm_source=medium&amp;utm_medium=referral">Bernard Hermant</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>And I hope everyone reading this already knows that connecting to public Wi-Fi or the network of a public establishment isn’t exactly the smartest choice, fraga?</p><h4>Evil Twin (Evil WPA)</h4><p>In most Wi-Fi networks, especially those protected with WPA2 or WPA3, the traffic between devices and the access point is encrypted using unique keys for each connected device. This means simply connecting to the network isn’t enough to sniff the traffic. To bypass this, I’ll use an Evil Twin attack, which impersonates a legitimate WPA network. This method is also effective for capturing partial handshakes when the network password is unknown.</p><p>All of this is done using the <a href="https://shop.hak5.org/products/wifi-pineapple"><strong>WiFi Pineapple</strong></a>, as it is a dedicated tool for Wi-Fi auditing and highly portable. Here is an image explaining this in more detail:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*nff5Gf3wgIAQ_MlXB7gXAQ.png" /></figure><p>This attack, depending on the restaurant’s security, is the best option to use as it allows us to intercept any and all information on the restaurant’s network from all devices. Later, I’ll show another method using an exploit I developed.</p><p>In the controlled environment I’m simulating, the restaurant’s order system panel is at IP 192.168.3.143, and the router’s IP is 192.168.3.1. By running a network scan with tools like Nmap or Fing, you can easily spot these addresses. To keep things stable, I set up my WiFi Pineapple to create a network starting with 192.168.3, ensuring the order system panel IP doesn’t change.</p><p>Once the Pineapple is up and running, a quick scan will reveal the target network and connected clients, as shown in the image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sumVM7XvZ_gUmwbsFfUhDg.png" /></figure><p>What really matters in this scan are the MAC address, the WPA type, and the connected clients. To carry out the Evil Twin attack, which is the attack we’ll perform, we’ll rely on the Evil WPA function of the Pineapple, specifically designed for it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*6t3k2x71qm84gTRm43SKeg.png" /></figure><p>We replicate everything exactly as the original network. Knowing the original network’s password is crucial, which is why we capture the handshake to discover the password. The main purpose of the Evil WPA function of the Pineapple is to create an identical network to the original one, allowing us to control all the traffic that passes through it.</p><p>To make our Evil Twin attack work even better, we connect the Pineapple to any network or tethering USB with internet access, preventing the “connected without internet” message from appearing.</p><p>We can now start <strong>redirecting the connected devices</strong>, forcing them to disconnect from the legitimate Wi-Fi network and connect to the Evil Twin instead. To do this, we use the classic deauth attack. When the devices can’t reconnect, they’ll automatically switch to the fake network, which looks like the original one. In the Pineapple’s scan panel, we can select the network or client to target:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/259/1*uhCj-yFUfKVVX-iVTZwOiw.png" /></figure><p>One of the devices being targeted is a smartphone connected to the legitimate Wi-Fi network with access to the order management panel, simulating the waiter’s device. After being deauthenticated, it will automatically connect to our Evil WPA network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*fmChnnh3nkdp4fv1sg-p7A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*1RCsOsplUUh114geW4WNYg.jpeg" /></figure><p>Another way to redirect clients is by accessing the legitimate Wi-Fi router’s control panel, which often uses default credentials. With access, we could shut down the router and leave <strong>only</strong> our Evil Twin network available.</p><p>After executing the deauth attack or turning off the Wi-Fi, we can monitor if clients have connected to the Evil WPA network through another part of the Pineapple interface. It shows the devices’ MAC address, data usage, connection time, and assigned IP address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QEe7Al8RCD7a8UNIQpSFxw.png" /></figure><blockquote>One important detail to highlight is that the installation guide for this ordering system specifically recommends setting the panel’s IP address as static. This means the Pineapple won’t assign a new IP or cause any interference with it.</blockquote><p>I noticed that when a device uses a static IP, that IP doesn’t appear on the list. Since the IP is static and will never change, the connected client (waiter) entering orders into the order management panel won’t experience any connection issues.</p><p>Within the Pineapple’s graphical interface, there’s the well-known <a href="https://www.tcpdump.org/"><strong>TCPDump</strong></a> tool, which helps us capture all the network traffic generated by our clients. Since the network they are connected to is under my control, I can easily monitor the traffic. As mentioned earlier, the connection between the browser and the order management panel is not encrypted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RsNx___1nALBOtFaYnoHDA.png" /></figure><p>With the Evil Twin network interface (wlan-0–3) selected, we can begin capturing network traffic directly through the Pineapple. It’s also possible to apply filters, such as protocol type, source definition, adjust verbosity levels, and other options to refine packet capture. Later, we’ll manually filter the traffic using <a href="https://www.wireshark.org/]"><strong>Wireshark</strong></a>.</p><p>While capturing traffic, we can wait for any activity on the order management panel, such as page updates, order placements, or bill completions. In a busy establishment, this usually happens in under five minutes, especially with multiple terminals accessing the panel. Since I was in a controlled environment, I simulated placing an order on table 5.</p><p>The capture will be saved in a <strong>.pcap</strong> file. Once opened in Wireshark, we can already observe some interesting details, such as the type of traffic, source, and destination. By using the search field above, we can filter by HTTP to display only the traffic related to the HTTP protocol:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3zXcKllI4Oq7HwSjd_iZgA.png" /></figure><p>We can observe a packet containing a POST method. In the controlled environment I set up, I simulated a login during the capture process. The captured HTML form reveals the username and password for the order management panel:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N8rHxU_htKv7_lWquceH8Q.png" /></figure><p>In a real-world scenario, it might not always be possible to capture login credentials during packet interception. This is why <strong>cookies</strong> serve as an alternative method to access the order management panel. In another packet, we can observe the moment I accessed table 5 to place an order in the controlled environment. In this packet and in all packets captured while someone is logged into the order management panel, the cookies are also included.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6s03VX5KmMa5WuOK4M5r1Q.png" /></figure><p>Each captured cookie value should be carefully organized and separated to ensure easy importation without causing confusion. Wireshark itself provides tools to assist with this organization. I will be using the <a href="https://addons.mozilla.org/pt-BR/firefox/addon/cookie-quick-manager/"><strong>Cookie Quick Manager</strong></a> extension in Firefox to manage the cookies:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*07K8wb_sgLGmG_8ibd8CIg.png" /></figure><p>Once the cookies are successfully imported, simply reloading the page grants permanent access to the order management panel. This allows me to view the table’s subtotal, add new orders, close the bill, monitor ongoing preparations, pay the bill, and much more:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BS-2XSOZbMvdwNsGGLF2Ag.png" /></figure><h4>ARP Spoofing</h4><p>Another method to intercept the HTTP communication used by the order management system is <strong>ARP Spoofing</strong>. This technique allows me to directly target the legitimate network by falsifying ARP packets. By sending these fake packets, I can redirect traffic intended for a specific device to my own machine, enabling a Man-in-the-Middle (MITM) attack.</p><p>To do this, I created a Python exploit using Scapy, called <a href="https://github.com/Davim09/PacketPlatter/"><strong>PacketPlatter</strong></a>, to perform ARP spoofing, automate packet capture, and automatically save the captured traffic to a .pcap file once the capture is complete. Typically, ARP spoofing targets the client connected to the network and the gateway. However, this exploit targets two clients on the network. This is because the ordering system works directly between two clients and does not pass through the gateway</p><p>In the environment I’m simulating, the order panel’s IP is 192.168.3.61 and the connected client (waiter) has the IP 192.168.3.64. By sending fake ARP packets, the attacker’s machine convinces the client at 192.168.3.64 that it is 192.168.3.61, allowing traffic between the two to be intercepted.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-AxBmH3SV3FpcPiq72eF8w.png" /></figure><p>The exploit prompts you to enter the IP and MAC addresses of the waiter’s device and the restaurant’s device, along with the name for the output .pcap file. Once the exploit is running, simply wait a few minutes to capture the traffic between the two IPs.</p><p>As mentioned earlier, actions like refreshing the page, placing an order, or finalizing a bill can happen within five minutes in a busy establishment. However, it’s important to note that with ARP spoofing, we are only intercepting the traffic of a single waiter’s terminal, which in this case is the device with IP 192.168.3.64.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eStRtzVgUl62rk8c79Q4UA.png" /></figure><p>Here, I simply refreshed and accessed table number 2. That’s enough to capture the cookies, granting access to us.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KPP0QOCP_0X_yeUEZhbHng.png" /></figure><p>To add persistence, since we are able to perform ARP spoofing, we can log the user out, forcing them to re-enter their credentials. While the user does this, we run the exploit to capture the new login information. This way, we can gain access to the system without relying on cookies, ensuring continued access even if the session expires or cookies are cleared.</p><h4>Mitigation</h4><p>To mitigate these attacks, it’s crucial to use HTTPS for secure communication, ensuring that sensitive data like login credentials are encrypted. Implementing ARP spoofing detection tools and static ARP entries prevent manipulation of ARP tables, safeguarding against man-in-the-middle attacks.</p><p>Network segmentation should be a key part of any security strategy. For instance, restaurants should set up a dedicated Wi-Fi network exclusively for the ordering system, separate from the public network that customers connect to. This would minimize the risk of unauthorized access. Additionally, configure the Wi-Fi network with WPA3 and avoid relying on WPA2 to ensure stronger encryption. And training restaurant staff on security best practices is equally important to ensure they understand how to recognize and respond to security risks effectively.</p><h4>Reporting</h4><p>In September 2024, I reported this vulnerability. The thing is, this type of system isn’t unique, many others work similarly, meaning the flaw applies to several other establishments. I contacted the company, asked to speak with the security or development team, and they told me they would “pass it on.” I documented everything and sent it over, with all the details of the flaw, the risk, and how to exploit it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2axal_VG4NSqrPnDQlAYjg.png" /></figure><p>AND GUESS WHAT HAPPENED? FULLY IGNORED! So, you know what? If a restaurant wants to protect itself, IT HAS TO DO IT ON ITS OWN, because the company behind the system DOESN’T CARE.</p><h4><strong>Conclusion</strong></h4><p>This article emphasizes the importance of securing digital systems, especially those that handle sensitive customer and business data. Sharing these findings is not only a step toward better cybersecurity practices, but also a way to inspire others to explore and contribute within this world!</p><p>I hope you guys have enjoyed the Reading. If you want to stay up to date with my work and projects, check out my <a href="https://beacons.ai/davi_mw"><strong>Beacons.ai</strong></a> to follow me and see what I’m up to next!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=64aeaf3a6f64" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>