
There is a scene that is repeated in the administrative courts of Mexico with a frequency that should outrage any taxpayer. The prosecutor presents to the magistrate a folder - physical or digital - with dozens of XML files that prove that his client issued or received electronic invoices for real operations, with real amounts, with PAC stamps, with SAT tax folio. Everything in order. All verifiable.
And the fiscal authority sitting on the other side says: "Those files are not trustworthy."
Like this. Without further ado. Without an expert opinion that demonstrates the alteration. Without a technical analysis that questions the integrity. Without a counter-dictum. Only the naked statement that the files presented by the taxpayer -- files that were generated, stamped and registered within the SAT's own digital ecosystem -- "are not reliable."
And on many occasions, the judge will accept them. Because authority has a presumption of legality. That's because the taxpayer did not have forensic certification of his archives. Because nobody told the prosecutor that an XML without chain of custody documented is an XML challenges, however true.
This article exists to bridge that gap. To explain, with the technical precision of many years of computer forensics, what a fiscal XML file really is, why it is much more than a receipt, how its integrity is certified so that it is unchallengeable in court, and why the digital chain of custody that the SAT applies to its own records has gaps that a forensic forensic expert can expose.
Prosecutor who takes XML files to court and treats them as if they were PDFs: What's next will change how you have digital evidence in court. an XML isn't a pretty PDF. It's a data file with cryptographic signature, emission metadata, CAP seal and fiscal stamp. And how they put them before the judge determines whether they are conclusive evidence or wet paper.
Businessman who doesn't know what an XML is and only cares about getting his invoices paid: understand this -- that XML file your accountant tells you that "it's already timbed" is your company's most powerful digital proof that an operation existed. He's more powerful than his contract. He's more powerful than his purchase order. He's more powerful than his statement. Because she's got a cryptographic signature. And cryptography doesn't lie.
Tax lawyer who is in a contentious trial and needs his XMLs to have full probative value: require computer forensics. Not because his XLs are fake. Because without forensic certification, the counterparty can challenge them. And the challenge, however unfair, works if you don't have the expert proof to neutralize it.
Accountant who handles thousands of XMLs and has never thought of them as legal evidence: Just start thinking about it. Because the day that the SAT challenges an operation, the first line of defense isn't going to be his spreadsheets. That's gonna be those XLs. And how she put them back, preserved them and can put them before a court will determine whether they are their salvation or their frustration.
Fiscal XML: anatomy of a file that almost no one understands
For the vast majority of taxpayers in Mexico, the XML of an electronic invoice is "that file that arrives along with the PDF" and that the accountant asks you to save. Most don't open it. Those who open it see text that looks like computer code and close it immediately. And those who save it, save it in a Windows folder along with the PDF and forget about it.
This widespread ignorance about what an XML is is one of the reasons why so many taxpayers lose tax lawsuits. Because if they knew what they had in that file, they would treat it with the same care with which they treat a public deed.
An XML file from an IJC -- Digital Tax online check -- contains, in its data architecture, the following information:
Operation data. RFC of the issuer, RFC of the recipient, share name of both, tax office, tax system, total amount, subtotal, taxes transferred, taxes held, currency, form of payment, method of payment, use of the IIC, concepts invoiced with description, quantity, unit value and amount.
The electronic seal of the issuer. A cryptographic signature generated with a private key from the issuer's Digital Seal Certificate (CSD). That signature is a mathematical operation that links XML's contents with the issuer's identity as verifiable. If a single character of XML content is modified after sign, seal verification fails. It's like a wax seal in a medieval document: if anyone opens the envelope, the seal will be broken. Except in the digital world, the seal cannot be falsified.
Issuer certificate. The number of the digital seal certificate used to sign, verifiable against SAT records. Each CSD has an issue date, an effective date, and a unique serial number. If the certificate was valid at the time of issuance of the CFDI, the invoice was issued with valid credentials authorized by the SAT.
Original chain. A text sequence that conduces the most relevant tax data from the voucher in a specific order as defined by the SAT. The original string is an "abstract" on which the digital seal is computed. It works as a fingerprint of the content: if the content changes, the print changes. If the print matches the seal, the contents have been unchanged.
Digital Tax Timbre (TFD). This is the seal placed by the Authorized Certification Provider (PAC) after validating and registering the CFDI. The TFD contains: the fiscal folio UUID (a universal unique identifier assigned to that specific invoice), the stamping date (accurate to seconds), the SAT seal (another cryptographic signature, this time from the SAT itself), the SAT certificate number used for stamping, and the version of the TFD.
Read it again: SAT itself cryptographically signs each stamped CFDI. That is, the SAT certifies with its own digital signature that that invoice was registered in its system, on that date, with that data. And then, in court, he says he is "not trustworthy."
The irony would be comical if it didn't destroy companies.
The XML is not a receipt: it is a container for mathematical proof
There is a fundamental distinction that the Mexican judicial system -- judges included -- has not fully assimilated: a tax XML file is not a document. It is a data container with multiple layers of cryptographic verification.
A document -- a contract at PDF, a letter at Word, an JPG image -- can be altered without leaving a visible sign. The text is changed, saved and submitted. That's clear. Nobody's noticing the difference. A forensic expert forensic is required to check the metadata and determine if there was an impairment.
A fiscal XML file's different. He's got an integrated check. The emitter's digital seal, original string, SAT's seal and fiscal doorbell create a cross-check system that makes any alteration mathematically detectable.
If anyone changes the amount of an invoice at XML -- from $500,000 to $300,000, for instance -- and does not recalculate the digital seal with the issuer's private key (that only the issuer has), seal verification fails. The invoice is detected as altered. Automatically. No forensic expert. Any CRI validation system -- including that of SAT itself -- detects discrepancy.
And if someone tries to recalculate the digital seal to match the altered amount, they require the private key to the emitter's digital seal certificate. A key that only the issuer holds (or should have). Without that key, the new seal doesn't match the attestation registered with the SAT, and the alteration is detected however.
It is a multi-layer security system designed by SAT itself. And it works. The problem is not the security of the XML. The problem is that almost no one -- not taxpayers, not tax officials, not many judges -- understands how it works. And what is not understood, is not valued.
Prosecutor presenting XMLs in court: Do not put them as if they were generic documents. Present an analysis of its cryptographic structure. That the judge understands that this file has a verifiable digital signature, that was typed by an authorized CAP, that the SAT sealed with its own signature, that any alterations are mathematically detectable. That transformed the perception of proof. It's no longer "a file that the contributor brought." It's a file with cryptographic integrity certified by the SAT's own ecosystem.
And if the tax authority says "isn't reliable," the question's obvious: are you saying that your own timming system isn't reliable? Because the SAT seal's there. The file. Reportable.
The digital chain of custody: the concept that the SAT systematically violates
The chain of custody is a concept that comes from the physical legal world: the continuous documentation of who has an object of evidence, from when it is collected until it is presented before the judge. If the chain breaks -- if someone had access to the object without documentation that they touched it, when they touched it, and what they did to it -- the integrity of the evidence is called into question.
In the digital world, chain of custody applies with the same logic but with different tools. The integrity of a digital file is verified with a hash value: a mathematical function that generates a unique "fingerprint" of the file. If the hash of the file at the time of collection matches the hash at the time of filing with the court, the file was not altered. If it doesn't match, it was altered. It's binary. There is no ambiguity.
Now. When Duriva or any serious computer forensics lab collects digital evidence, it documents the chain of custody with absolute rigor: who collected the file, when, from what system, with what tool, what hash it returned at the time of collection, where it was stored, who had access to the storage, what hash it returned at the time of presentation. Everything documented. All verifiable. All auditable.
When the SAT presents its "system records" as evidence in a tax trial, what digital chain of custody does it present?
In Duriva's experience: none.
The SAT presents screen prints of its internal systems. It presents "certificates" signed by an official that says "this is what is in our records." It presents copies of your database that no one can verify because no one has access to your systems. And it presents it without a hash, without a documented chain of custody, without forensic certification of the integrity of the data.
And the court will accept that. Because it's from authority. Because you have a presumption of legality. Because nobody challenges him technically.
But a forensic forensic expert can challenge it.
Prosecutor who has never questioned the chain of custody of the SAT evidence: Just start. Ask for chain of custody of the archives submitted by the authority. Question: What's the hash of his constancy? Who pulled her out of the system? What tool? Where's the chain of custody documentation? If an authority cannot answer these questions, its digital evidence does not have more rigour than a pantyhose.
And if your client has a complete forensic expert report with G14 with documented hashes with a certified methodology under NOM-151 and the authority has a pantyrinth with no hash or custody, the attested asymmetry will be reversed. Now it's evidence from the contributor that's technical rigour and from authority that's short.
Certifying the integrity of XML files: the forensic process
The process of forensic certification of tax XML files is meticulous, but not complicated to understand. What it is, is technical. And that technicality is what gives it evidentiary value.
Step 1: Collection with chain of custody
The forensic expert collects the XML files directly from the system where they are stored -- the company server, the billing system, the backup folder. Not from email. Not from a folder that the counter passed via USB. From the primary source.
At harvest time, the SHA-256 hash of each XML file is calculated. That hash is the first mark in the chain of custody. It is proof that, at the time of collection, the file had specific and complete content.
The collection is documented: date, time, source system, file path, tool used, name of forensic expert, resulting hash. All in a collection report that is part of the forensic expert report.
Step 2: Verification of the cryptographic structure
For each XML file, forensic expert verifies:
The electronic seal of the issuer shall be valid. The original CRI string was taken, the verification function applied with the public key of the issuer's certificate and compared with the seal registered with XML. If they agree, the IIC was signed with the right certificate and was not altered after signing.
The issuer's certificate was valid at the time of issue. The date of validity of the certificate as against the date of issue of the IJC shall be checked. A signed IIC with an expired certificate is an anomaly that document forensic expert.
That the FAP's digital fiscal buzzer be valid. The SAT seal contained in the FdR using the public key of the SAT certificate is checked. If the check's successful, SAT effectively tipped that bill. It's a confirmation that SAT registered the operation with its own system.
That the UUID fiscal folio can be consulted at the SAT portal. It is verified that the IATC's UID exists in the SAT public database and its status will be valid (or cancelled as appropriate). That check crosses XML data against SAT public records.
Step 3: File metadata analysis
Beyond the internal structure of the XML, the file as a digital object has its own metadata: creation date in the file system, last modification date, last access date, size in bytes. The forensic expert documents this metadata and verifies that it is consistent with the date of issuance of the CFDI.
If an XML that claims to have been issued on March 15, 2024 has a date of creation on the file system of March 15, 2024 and a date of last modification of March 15, 2024, the metadata are consistent. The file was created the day it was issued and was not modified after.
If however the file has a creation date of November 20, 2025 -- about two years after its alleged issue -- there's an anomaly that can be explain (it was downloaded from the SAT portal at that date, restored from a backup, migrated to a new server) or that can indicate a problem. The forensic expert research and document the explanation.
Step 4: Issuance of forensic expert report
The opinion integrates the results of the three previous steps: documented collection with hash, cryptographic verification of each XML, metadata analysis. The opinion is issued under the requirements of article 210-A of the Federal Code of Civil Procedures (reliability of the method, attributability of the content, accessibility for consultation) and with reference to NOM-151 for the conservation of data messages.
The result is an expert document that says, in terms that the court can understand: these XML files are complete, they were not altered, they were issued with valid certificates, they were stamped by the SAT, and their chain of custody is documented from collection to presentation.
That converts an XML "file brought by the taxpayer" into "digital evidence forensic certificate with complete chain of custody." The difference before the court is enormous.
The Mexican digital tax ecosystem seen from computer forensics
To successfully defend a company in a tax lawsuit, you must understand the entire ecosystem. Not just the bill. Not just the XML. The entire ecosystem. And that ecosystem, seen from a forensic perspective, has notable strengths and weaknesses that no one wants to discuss.
The actors of the ecosystem
The issuing taxpayer. Generate the CFDI in your billing system, sign it with your Digital Seal Certificate, and send it to the PAC for stamping. It is the first link in the chain.
The Authorized Certification Provider (PAC). It receives the IIC from the emitter, valids its structure, timalizes with the SAT seal, assigns UUID fiscal folio and reports it to the SAT. He's an authorized middleman. In Mexico there are tens of authorized PACs, each with its own systems and servers.
The SAT. He receives the report from the CAP, searches the IJC at his central database and makes this available at his portal. That's the final record. The official "truth" that the invoice exists.
The receiving taxpayer. It receives XML from the issuer (or downloads it from the SAT portal or from the CAP portal) and stores it as an operation voucher.
The strengths of the ecosystem
Cryptography. The digital signature system -- issuer seal, SAT seal, original chain -- is technically and mathematically robust. A properly stamped CFDI is, for all practical purposes, unalterable without detection. This is a real strength of the SAT design. You have to recognize it.
Traceability. Each CFDI has a unique fiscal folio that can be consulted. No two invoices have the same UUID. This allows you to verify the existence of any invoice at any time.
Standardization. All IATCs in Mexico have the same XML structure as SAT. That facilitates mass forensic analysis: the same tools and methodologies apply to any bills from any contributor.
Weaknesses that the SAT does not recognize
The internal chain of custody of the SAT is opaque. When the SAT presents its records as evidence, it does not document how they were extracted, who had access to the database, what integrity controls were applied. The presumption of legality replaces chain of custody. And that, from a forensic perspective, is an evidentiary weakness.
System failures are not publicly documented. The SAT servers have crashes, they have synchronization errors, they have maintenance periods where the data may not be processed correctly. When a CFDI does not appear in the SAT records, the authority's first assumption is that the taxpayer did not issue it. It's never that the SAT system failed to register it. And that assumption, without technical verification, generates unfair tax credits.
Interoperability between PACs and SAT is not perfect. Each PAC is an independent system that communicates with the SAT via electronic interfaces. That communication may have latencies, transmission errors, duplicates or loss of records. If a PAC stamped a CFDI but the report to the SAT failed due to a communication error, the CFDI exists in the PAC's records but not in the SAT's. For the SAT, that invoice does not exist. For the taxpayer, it does exist. And the discrepancy creates a fiscal problem that is no one's fault except technology.
Certificates retroactively revoked. When the SAT revokes a digital seal certificate from an EFOS, the revocation may have effects on CFDIs that were issued when the certificate was valid. This creates an absurd technical situation: an invoice that was issued with a valid certificate on the day it was issued can later be questioned because the certificate was revoked months later. Forensics, the invoice was valid at the time of its creation. Administratively, it remains in question.
A computer forensics can document these weaknesses and put them before the court as a technical context that explain the discrepancies. Not to attack the SAT but to prove that discrepancies do not necessarily mean that the taxpayer's fault.
Materiality of operations through XMLs: the cross test
When a tax trial revolves around the materiality of operations – that is, demonstrating that the operations covered by the CFDI really occurred – the forensic analysis of the XMLs is one of the most compelling pieces of evidence, but it is not the only one. Its power multiplies when crossed with other sources of evidence.
XML vs. Crossover accounting database
The forensic expert takes each questioned XML and cross-references its data -- amount, date, concept, RFC of the sender and receiver -- against the database records of the company's accounting system. If the accounting record matches the XML in amount, date and concept, the operation is documented in two independent sources. If the accounting record also has a capture timestamp that is after the CFDI issuance date but before the payment date -- as would be logical in a real accounting process -- the chronology is consistent.
XML vs. Crossover bank records
The amount of the CFDI must correspond to a bank transaction. The forensic expert cross-checks the amount and date of the invoice against the company's account statements. If there is a transfer for the exact amount of the invoice (or the net amount after withholdings), made on a date after the CFDI was issued and within a reasonable payment period, the money flow documents materiality.
XML vs. Crossover delivery records
If the operation involves the delivery of goods, the records of receipt of goods -- retreats, warehouse bitáks, ERP records -- should be consistent with the concepts and quantity of the IIC. The forensic expert checks that the delivery logs exist, that their dates are after issue of the purchase order and prior or contemporary to issue of the invoice and that their metadata are true.
XML vs. Crossover electronic communications
Emails between the company and the supplier -- quotes, purchase orders, delivery confirmations, payment agreements -- are complementary evidence that a real business relationship existed. The forensic expert can extract and certify the headers of those emails to demonstrate that they were sent from real servers, on dates consistent with the operation, and not fabricated after the fact.
When the forensic expert report presents these four intersections -- XML, accounting, banking, delivery -- and they all tell the same story, the materiality of the operation is demonstrated with a level of evidence that is extremely difficult to refute. Not impossible. But extremely difficult. Because refuting it would require demonstrating that four independent systems were manipulated in coordination, which is unlikely and, from a forensic perspective, detectable.
Prosecutor who is thinking "this is exactly what I need": It is. But you have to demand it properly. Don't ask for an "XLs expert." Ask for an IIC integrity certification computer forensics with cross-material analysis from accounting, bank records, performance evidence and electronic communications. That's the right range. That's how far the decision goes with judgements.
Fourth wall: what every person who reads this needs to know
Prosecutor with XMLs in hand who is about to present them as evidence: Hold him for a second. How are you gonna get those XLs? If you are presenting them as simple documentaries -- a print copies of XML or file contents on an uncertified USB -- you are presenting as weak as possible evidence of the strongest test you have. It's like having a diamond and presenting it wrapped up in paper paper. The XML has cryptographic signature of both the emitter and SAT. He's got a verifiable fiscal doorbell. It has an original complete string. But none of that matters if a forensic expert report to explain to the judge what each of these elements means and to certify that the file is complete. The computer forensics does not change the XML content. It changes its evidentiary value before the court.
Businessman who doesn't know what XML is and is reading this because his tax professional sent it to him: understand something. That file that your accountant asks you to save and that you never open is potentially the most important proof your company has to defend itself with SAT. Don't erase it. Don't put it into a folder that can be lost. Keep it on a backup server. Better still: ask your accountant to implement an XLs retention policy with automatic backup and regular monitoring of integrity. That sounds exaggerated till the SAT audit arrives. Then it sounds like an intelligent foresight.
Tax lawyer who is in court and the SAT is challenging his XMLs: challenge their own. Requests chain of custody of the system constancy that the authority presents. Ask what hash have, who extracted them, with what tool, when, where's collection documentation. If the authority presents a screen printing of its internal system as proof that "our records have found that..." without hash, without chain of custody, without forensic certification, that test is technically and legally weaker than an XML with expert certification. And you have a right to point that out. Section 210-A requires method reliability for electronic evidence. Any. Including that of authority.
Accountant who manages the company's XMLs and has them in a Windows folder on his desktop: That's not a care policy. That's a risk. If your hard drive fails, if your computer is formatted, if a Ransomware puts your files at you, your client's XLs are lost. And once the SAT gets vouchers, she's not gonna be able to say, "I'm deleted." What you need is an XMills storage policy that includes automatic backup at at least two independent locations, regular monitoring that the files are legible and complete, and an access log that document who touched those files and when. NOMO151 lays down the requirements for data message maintenance. To fulfill it isn't optional if those files are to be tested at a trial.
FAQ
If the SAT already has a record of my CFDIs on its system, why do I have to save the XLs?
Because the SAT record is the SAT record. It's not yours. If the SAT has an error in its database -- and it does -- you need the original XML to demonstrate the discrepancy. Additionally, the SAT record can show the status of the invoice (current, canceled) but not necessarily all the metadata of the original XML. Your XML file, with your chain of custody documented, is your independent proof. Don't depend on the other party's system to be correct. Have your own evidence.
Can I download the XLs from the SAT portal and use them as evidence?
Yeah, but there are nuances. An XML downloaded from the SAT portal is a copy. Your file metadata (date of creation, date of modification) will reflect the date of download, not the original date of issue. A forensic expert can verify that the contents of the downloaded XML are complete -- because the digital seal and fiscal title are verifiable independently of the download source -- but the chain of custody is weaker than that of an XML obtained directly from the issuer's billing system. It's always better to work with the primary source.
What if some of my XLs are incomplete or corrupt?
Incomplete or corrupt XMLs do not pass digital seal verification. The forensic expert documents it in the opinion as an anomaly. But that doesn't mean those operations didn't exist -- it means that the specific XML evidence isn't usable for those specific operations. The expert report can complement other sources of evidence: ERP records, bank records, evidence of delivery, communications. Materiality can be demonstrated in multiple ways. XML is the strongest way, but it is not the only one.
How much does a lot of XLs have to be certified as a forensic for a fiscal trial?
The computer forensics in tax matters start at $2,000 dollars. The final cost depends on the volume of XMLs to be analyzed, the number of materiality crosses required, and the complexity of the case. A case with 50 disputed invoices is not the same as one with 500. What can be stated is that the cost of the expert opinion is always a fraction of the amount in dispute. And that a trial lost due to lack of expert evidence is infinitely more expensive than the expert opinion that could have been done.
Can the SAT have a counter-examination?
Maybe. And at that stage, the trial becomes a technical confrontation between forensic experts, that's exactly where forensic computer lights up. Because the forensic experts confrontations are solved with technical arguments, with verifiable demonstration, with hashes and seals and metadata. Not with rhetoric. And if DRiva's report has verifiable, chain of custody _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Not with a "our systems say something else."
What to do today to protect your XLs
First: implement a care policy. Any XML emitted and received should be stored at least two independent locations. Local server and cloud. Or local server and external disk. Or primary cloud and secondary cloud. Reducibility isn't paranoia. That's foresight.
Second: check the integrity regularly. Once a quarter, check that the stored XLs are legible and their structure is complete. Free tools from SAT itself allow to validate the basic structure of an IIC. If an invalid file goes out, investigate why and replace with a copy of the SAT portal before it goes missing.
3: document chain of custody from today. Don't wait for trial to start documenting. Record where the XMLs are stored, who has access, what backups exist. If tomorrow you need an expert opinion, this prior documentation greatly strengthens the chain of custody.
Fourth: If you are already in trial or audit, contact a forensic forensic expert immediately. Not after the deadline expires. Not after the authority presents its evidence. Now. Because forensic certification of XMLs takes time, and time in a tax trial is a finite resource that is not recovered.
Fifth: coordinate with his public prosecutor his strategy of evidence. The computer forensics is a tool at the service of legal strategy. The prosecutor defines what needs to be proven. The forensic expert defines how to test it. That coordination, from the beginning, is what produces results.
The XML file of a CFDI is probably the most sophisticated digital artifact that exists in the tax ecosystem of any country in the world. It has dual cryptographic signature -- of the issuer and the SAT. It has a stamp from an authorized third party. It has a single folio verifiable in real time. It has original chain as an integrity mechanism. It is, from a technical perspective, a remarkable piece of digital engineering.
And however, this same device appears in Mexico's tax courts as if it were a photocopy. It prints, gets into a folder, offers as a documentary. Nobody checks his seal. Nobody checks his doorbell. Nobody calculates the hash. Nobody's explaining to the judge that that file has more layers of security than a bench's vault. And the authority, who designed the cryptographic system, says to the court that "it's unreliable."
It is as if the architect who designed the lock said in court that the lock does not work.
Computer forensics corrects that absurdity. Take the XML, verify each layer of security, document the chain of custody, cross-check the data against independent sources, and present the magistrate with a ruling that doesn't say "believe me." It says "verify yourself. The data is here. The signatures are here. The hashes are here. Everything is replicable, everything is verifiable, everything is mathematical."
And math, unlike presumptions, has no bias. No presumption of legality. He has no interest in winning or losing. He's got results. And the results are what they are.
That is what a computer forensics puts on the magistrate's table. Not arguments. Not interpretations. Verifiable results. And in a system where presumption works against the taxpayer, verifiable results are the only currency that buys justice.

