
There is a fight that Mexican prosecutors are losing. Not for lack of legal knowledge. Not for lack of procedural strategy. Not for lack of legal basis. They are losing it because they are fighting on the wrong field with the wrong weapons.
They are fighting with Excel sheets when the fight is in the database code.
And that's no metaphor. That's a diagnosis.
When the SAT issues an observation, a tax credit, a settlement, what it is saying -- in technical terms -- is: "The data we have in our systems does not match what you declared." And when the taxpayer responds, what he presents are his accounting records: trial balances, financial statements, auxiliaries, policies. Documents. Papers. Excel files that an accountant kept with discipline during the fiscal year.
The problem is that the SAT did not make its determination by comparing documents to documents. The SAT made its determination by comparing databases with electronic returns. Crossed records on their servers. It processed millions of data with algorithms. It identified discrepancies through automated queries to data tables that the taxpayer never sees and, in many cases, does not even know exist.
And when the taxpayer arrives at court with his Excel sheets, he's responding to an argument that was generated in a database with a document that was generated in a spreadsheet. That's like bringing a knife to a shooting. Not that the knife's bad. That's just not the right weapon for that fight.
The right fight is in the field of data integrity. It occurs with cryptographic hashes, with log audits, with metadata analysis, with verification of record blockchains. It occurs with computer forensics. And the accounting profession -- with all due respect and with the frankness that characterizes Duriva -- is unaware of that tool. Not because I'm incompetent. Because no one taught it to him.
This article exists to change that.
Prosecutor who is fighting a case against the SAT and feels that something is missing: What's missing is computer expert testing. That's the technical component that converts his legal argument of "SAT data are bad" into a forensic demonstration of why they are bad, where's the discrepancy, and who -- the contributor or authority -- has the right records. Without that evidence, his argument was an assertion. That's science with her.
Businessman with a tax discrepancy who doesn't understand how it arose: what's following in this article will explain to you, in terms that do not require a doctorate in systems, how authority data can be incomplete, corrupt or altered and how it's technically shown.
Accountant who has kept the records with impeccable discipline and does not understand why the SAT says otherwise: his accounting discipline is his basis. But the court needs more than discipline. He needs technical proof that his records are complete. And the integrity of a digital record isn't shown with an alphabetical order and with a figure ratio. It's shown with pits.
Tax lawyer who litigates against the SAT without expert evidence in computer science: Duriva understands that the computer expert test is not part of the tax law curriculum. But the reality of tax litigation in the 21st century is that the discrepancies that generate tax credits are digital data discrepancies. And digital data discrepancies are resolved with computer forensics, not arguments. This article is going to show you the tool you are missing.
The underlying problem: databases vs. spreadsheets
Duriva says it up front because someone has to say it: the accounting union in Mexico is fighting a digital war with analog tools.
It's not a criticism. It is an observation based on my history of seeing how cases arrive at the laboratory. The pattern is always the same:
The SAT issues an observation. The taxpayer's accountant opens his or her accounting system -- Contpaq, Aspel, SAP, whatever. Generate a report. Exports it to Excel. Print it. He delivers it to the prosecutor. The prosecutor presents it to the court as proof that the taxpayer's records are correct.
And in front of them, the fiscal authority has a record of its internal systems. A certified print of what his database says. An official document that says, with the presumption of legality that protects acts of authority: "According to our records, the figure is this."
Two documents. Two figures. Two versions. And the court has to decide which is correct.
And this is where asymmetry pounding the taxpayer.
Because the SAT certificate has a presumption of legality. Acts of authority are presumed legal until proven otherwise. That is to say: what the SAT says is presumed correct. What the taxpayer says has to be proven.
The taxpayer has to prove that their records are correct. And you have to prove that the SAT ones are wrong. With an Excel sheet. Against a government database.
It is an unequal fight. And it is the fight that the computer forensics forensic balances.
Because what the expert opinion does is not present another prettier Excel sheet. What it does is enter the taxpayer's database -- the real database, not the report generated by the accountant -- and demonstrate, with cryptographic precision, that those records are complete, that they were not altered, that the sequence of transactions is consistent, that the timestamps are coherent, that the hashes of the records do not present anomalies.
And simultaneously, you can prove that the authority's records are incomplete, that they have inconsistencies, that the data chain between what the taxpayer sent and what the authority processed has gaps.
That is no longer an accounting opinion against a presumption of legality. It is a mathematical demonstration against a legal presumption. And the mathematical proof is stronger.
Audit Database Integrity: What forensic expert Really Does
When Duriva receives a tax discrepancy case, the team does not open Excel. Open the database.
The accounting system of any company -- Contpaq, Aspel, SAP, Oracle, Microsip, anyone -- is not an Excel file with columns and rows. It is a relational database. A structure of interconnected tables where each transaction, each policy, each accounting movement, is recorded with a set of attributes that include much more than the amount and date.
Each record in the database has:
A tirestamp of creation. The exact date and time that record was entered into the system. Not the date of the accounting transaction -- the date it was captured. And the difference matters. If a March 15 accounting entry was captured on March 15, the sequence is consistent. If a March 15 accounting transaction was captured on December 28 -- just before the fiscal close -- that raises a flag.
A user ID. That's who's got his registration. What system user did the transaction. That's important because if all the exercise logs were caught by the same user (the counter) and suddenly there are records caught by a different user (or an managing user that should not be making accounting catches), that's an anomaly.
A log of modifications. Professional accounting systems record every modification to a record: what field was changed, from what value to what value, when, by whom. If an amount was modified after the original capture, the log records it. If it was modified a month after the fiscal closing, the log records it. If it was modified a thousand times, the log records the thousand times.
Removal records. When a record is deleted from the database, depending on the system, a trace may remain. Records marked as "deleted" but still present in the table. Gaps in the consecutive numbering of pages. Inconsistencies in the sequence of IDs. A forensic forensic expert knows how to detect these fingerprints.
What Duriva does with the taxpayer database is an integrity audit. Not an accounting audit -- that is done by the accountant. A data integrity audit. Which answers questions that the accountant cannot answer:
The logs were altered after their original capture? Are tipprints consistent with normal operation flow? Are there ghost leaps-- leapes that appear without a documented capture process? Are there gaps in the sequence of transactions that suggest disposal of records? Is the database complete or with signs of corruption, manipulation or impairment?
And the answers to these questions, when they are put with forensic rigour, are devastating to whoever has the wrong records. If the taxpayer's records pass the integrity audit -- if there are no alterations, if the timprints are consistent, if the logs have no suspicious modifications, if the hashes are consistent -- the technical conclusion is that the taxpayer's database is complete. And if the full database of the contributor says a figure different from that of the SAT, the question changes direction: it's no longer "why the contributor has a different figure" but "why the SAT has a figure different from a database whose integrity was found to be forensic."
Crossing record hashes: the mathematical proof that the SAT cannot refute
Hashing is the central concept of all computer forensics. And it is the tool that converts a tax discrepancy into a mathematical demonstration.
For the fiscal practitioner and tax lawyer who are not familiar with the term: a hash is a mathematical function that takes any set of data -- a file, a record, an entire database -- and generates a unique string of characters that functions as a fingerprint of that data. If you change a single character, a single number, a single space in the original data, the hash changes completely.
Duriva explains it this way in court: Think of the hash as a wax seal on a letter. If the letter was opened and resealed, the seal is broken. No matter how carefully they resealed it -- the original seal is broken. The hash works the same: if the data was modified, the hash changes. And the original hash, calculated before the modification, no longer matches the current hash. That proves alteration.
In a case of tax discrepancy, the hash crossing works like this:
Step 1: The forensic expert calculates the SHA-256 hash of each XML file issued by the taxpayer during the fiscal year. Each CFDI -- each electronic invoice -- has an XML file with a digital seal and a PAC stamp. That file is a piece of data whose integrity is verifiable. The forensic expert calculates its hash and records it.
Step 2: The forensic expert requests -- through the lawyer and by judicial request if necessary -- the XML files that the SAT has registered for the same taxpayer and the same fiscal year. Calculate the hashes of those files.
Step 3: Cross the hashes. If the hash of the XML that the taxpayer has is identical to the hash of the XML that the SAT has, the file is the same. It was not altered by either party. The data is complete.
If the hashes don't match, one of the two files was modified. And the question is what. And the answer's in the metadata: the date of creation of the file, the CAP seal, the original CRI string, the digital seal certificate. All that information allows us to determine what the original file and what was altered -- or if the SAT has a different file because his system misprocessed information.
Step 4: The forensic expert totals the amounts of all verified XMLs. If the sum of the full XMLs yields $4,800,000 and the SAT says that the taxpayer declared $5,200,000, the discrepancy is quantified, documented and demonstrated with mathematical precision.
That is a demonstration that is not refuted by "our system says otherwise." It is refuted with another mathematical proof. And if the authority does not present its own verification of hashes -- which in Duriva's experience, it rarely presents --, the taxpayer's forensic expert demonstration remains the only technical evidence in the file.
The magistrate does not need to believe the taxpayer. You need to believe the math. And the math doesn't lie.
Demonstrate that what the authority has is incomplete, corrupt or altered
This is where computer forensics enters territory that makes the tax authority uncomfortable. Because the presumption of legality protects the acts of the SAT. But the presumption of legality is not a shield against science.
What a computer forensics can demonstrate about the authority's records:
That they're incomplete. If the contributor issued 1.247 CFDIs during the exercise and SAT has only 1.198 registered, there are 49 CFDIs that have been unprocessed by the authority. Those 49 CFDIs have a PAC electronic seal, have timbrado, have fiscal folio. They exist. They were broadcast correctly. The CAP attested them. But the SAT system did not register them. And if those 49 CFDIs represent the $400,000 discrepancy, the case will be solved: the bug's from the SAT, not from the taxpayer.
This scenario is more common than the authority would like to admit. The SAT systems process millions of CFDIs daily. Processing errors, server timeouts, synchronization failures between databases -- all of this can generate gaps in SAT records that become tax credits for the taxpayer.
That they're corrupt. Data corruption in a database does not require malicious human intervention. It can occur due to hardware failures in the servers, due to power interruptions during disk writes, due to software errors in data migration processes -- which the SAT performs with some frequency when it updates its systems. A corrupt record may show a different amount than the original, an incorrect date, a truncated RFC. And if that corrupt record is the basis of the fiscal observation, the observation is based on damaged data.
The forensic expert cannot directly audit the SAT servers -- the authority is not going to give it access to its internal systems. But it can demonstrate, by comparison with the taxpayer data and the PAC data, that what the SAT has recorded does not match what it should have. And that demonstration by contrast is admissible and powerful.
That they were misprosecuted. The SAT receives the CFDIs through the PACs. The PACs stamp the invoices and send the information to the SAT. But the process between the PAC and the SAT is neither instantaneous nor infallible. If the forensic expert demonstrates -- with the PAC's records, which are an independent third source -- that the PAC sent the correct information and that the SAT recorded it differently, the discrepancy is not the fault of the taxpayer or the PAC. It is a SAT processing error.
Three data sources that tell the same story: the taxpayer's accounting system, the XMLs typed by the CAP and accused them of receiving the SAT portal. If all three coincide and the fourth source -- the SAT's internal database -- says something different, the fourth source is abnormal. And to prove that with forensic rigor missees the presumption of legality. He doesn't attack her legally. He misleads her scientifically.
The expert opinion as the prosecutor's "ace up the sleeve"
Duriva works with prosecutors from all over Mexico. And there is a pattern that is repeated in each new prosecutor who discovers computer expert evidence: first skepticism, then astonishment, then permanent incorporation into their strategy.
The skepticism is understandable. The prosecutor has litigated against the SAT for years - in many cases, decades - with the tools he knows: legal argument, documentary evidence, the revocation appeal, the contentious administrative trial. And those tools work. Nobody says no.
But they work to a certain extent. They work when the discrepancy is clearly an administrative error. They work when there is an obvious procedural flaw. They operate when the authority made an error in a manner that allows revocation for procedural reasons.
Where they stop working is when the discrepancy is data. When the SAT says "our database says X" and the taxpayer says "mine says Y," and the court has to decide which database is right. In that scenario, legal argument is not enough because the question is not legal -- it is technical. And documentary evidence is not enough because an Excel report does not demonstrate the integrity of the database that generated it.
That's where the computer expert test is the ace up your sleeve. It is the letter that the SAT does not expect. It is the test that changes the language of judgment from arguments to data, from opinions to hashes, from "my client is right" to "here is the cryptographic proof that my client is right."
And there's something more that the prosecutor needs to know: SAT, in Duriva's experience, rarely presents computer expert evidence in contentious and administrative trials. It presents its system constancy. He's presenting his certified prints. He's presenting his jobs. But it does not have a forensic expert in computer that challenges the findings of forensic expert from the contributor.
Which means that, in most cases, the taxpayer's forensic expert opinion remains the only technical evidence in the file. No counterpart. No rebuttal. Without counter-examination. And an unrefuted forensic expert report has probative weight that the magistrate cannot ignore.
That's no small tactical advantage. That's a huge tactical advantage.
Onus probandi fiscal: how computer forensics reverses the burden
Duriva has explained it in previous articles and reiterates it here because it is the axis of the entire strategy: in Mexican tax practice, the burden of proof is reversed. The SAT accuses and the taxpayer proves. The authority says and the taxpayer proves.
In a legal system where the presumption of innocence should apply universally, the taxpayer is guilty until proven tax innocent. It's Kafkaesque. But it is the operational reality of the Mexican tax system.
And forensic computer doesn't change that systemic reality. But it gives the taxpayer the most powerful tool available to prove his fiscal innocence: verifiable data, cryptographic pits, integrity audits, mathematical demonstrations.
Because when the prosecutor arrives at the court with a forensic expert report that says: "The integrity of the taxpayer's accounting database was verified by calculating the SHA-256 hash of each table of records. No alterations were detected after the original capture. The creation timestamps are consistent with the operational flow of the fiscal year. The sum of the CFDIs issued, individually verified by their digital seal and PAC stamp, yields a total income of "$4,800,000.00 MN. This figure differs by $400,000.00 from what was recorded by the tax authority. The discrepancy is attributed to 49 CFDIs that appear in the taxpayer's and PAC's records but do not appear in the authority's records."
That's no longer the taxpayer saying "I'm right." That is a forensic expert demonstrating where the error is. And the difference between the two things, before a magistrate, is the difference between an affirmation and proof.
The fine sarcasm that Duriva reserves for the SAT
There is something that Duriva has consistently observed over many years and that deserves to be said with the irony it deserves: the SAT requires taxpayers to have millimeter precision in their digital records -- that the XMLs are correct to the last cent, that the digital seals are verifiable, that the returns are presented in electronic format with rigorous technical specifications -- but when asked to demonstrate the integrity of its own records with the same rigor, the response is institutional silence.
The SAT wants the taxpayer to be digitally impeccable. But its own systems have failures that it does not document, errors that it does not report, server outages that it does not recognize, data migrations that it does not publicly audit. And when those failures generate discrepancies that are converted into tax credits, the taxpayer is to blame.
It is as if a teacher failed the student for a spelling error while the exam itself had three unintelligible questions.
And it's not that SAT systems are bad. They're massive systems that process millions of transactions. It's inevitable they have mistakes. What's not inevitable -- what's an institutional decision -- is that these mistakes have an economic impact on the taxpayer without the authority's obligation to prove his own searches to be fair.
Computer forensics gives the taxpayer the tool to demand this demonstration. Not asking for it -- because the SAT is not going to deliver it voluntarily. But by presenting one's own demonstration so solid that the absence of refutation by authority speaks for itself.
For every person reading this
Prosecutor who is putting together a defense against a tax credit based on data discrepancy:
Incorporate computer expert testing into your strategy. Not as a complement. Like a pillar. Because the disagreement you are fighting was not generated in a paper world. It was generated in a world of databases, servers, and automated processing. And the proof that resolves that discrepancy lives in the same world.
The expert opinion does not replace your legal strategy. The power. It gives you the technical fuel that turns your argument from "the authority was wrong" to "here's the mathematical proof of where they went wrong." And there is a huge difference between the two things.
Coordinate with forensic expert from the first day of the case. Not when he is already in the contentious trial. From the day you receive the audit notification. Because evidence preservation is critical: server logs are overwritten, backups are rotated out, systems are updated, and historical data is lost. The sooner the forensic expert enters, the more evidence it can preserve.
Businessman with tax discrepancy who doesn't know what to do:
First thing: don't panic, but don't ignore. Ignoring an SAT audit is the worst thing you can do. Every day that passes without responding is a day where deadlines get shorter, fines grow, and options get smaller.
The second thing: your counter is essential to identify the numerical discrepancy. But defending yourself in court requires more than just right numbers. Requires technical proof that your numbers are correct. And that evidence is generated by a forensic expert in computer forensics, not an accountant.
The third thing: preserve everything. Do not delete server logs. Do not format computers. Do not reinstall the accounting system. Do not "clean" the database. Everything is potentially forensic evidence. And evidence that is destroyed is not recovered.
The fourth thing: put together a three-legged team. Accountant to identify discrepancies. Prosecutor who designs the legal strategy. Forensic expert in computer forensics that generates the technical evidence. Remove one leg and the bench falls over.
Accountant who is defending his client with Excel reports:
With all professional respect: Duriva understands that no one taught him computer forensics in his accounting career. But the reality of tax litigation in 2026 is that discrepancies are generated in databases and defenses are presented with spreadsheets. There is a fundamental disconnect between the problem and the tool with which it is trying to solve.
His accounting knowledge was vital. It's you who identifies the discrepancy, you understand the flow of operations, you know what figure should be and what isn't. But to prove to a court that his figures are right, he needs forensic expert to prove the integrity of the database that generated those figures. That's not a matter of confidence in his work. That's a matter of evidentiary rigour.
The expert opinion does not replace you. It complements it. And together -- accounting knowledge and forensic demonstration -- they build a defense that the SAT cannot overthrow with a system record.
Tax lawyer who has never offered expert evidence in computer science:
The first time that a TFJA magistrate receives a forensic expert report in computer forensics that demonstrates with hashes and timestamps that the taxpayer's records are complete and that the discrepancy originates in the authority's systems, the dynamics of the trial change. Completely. The magistrate stops evaluating the credibility of documents and begins to evaluate scientific data. And scientific data does not collapse under procedural questions. Scientific data is or it is not.
Duriva evaluates the technical feasibility of the expertise before committing the budget. If the case does not have enough digital evidence to generate a useful opinion, it is said head-on. There is no charge for an expert opinion that will not produce results. That openness is part of the service.
FAQ
How much does a computer forensics cost for a tax discrepancy with SAT?
Expert reports of this nature have a floor of $2,000 dollars. The final cost depends on the complexity: how many fiscal years are involved, how many CFDIs need to be verified, how many servers or accounting systems require auditing. It is always compared against what is at stake. If the tax credit is $3 million pesos, the expert opinion represents less than 2% of what you can lose. And if the expertise saves you that $3 million, the investment justifies itself.
Can expert examination be used both at an appeal and at a contentious trial?
Yeah. The expert evidence is admissible for both. But Doriva's recommendation, based on his experience, is to offer his advice at his contentious trial at the TFJA. In the remedy of revocation, the person who resolves his own SAT -- this presents a structural conflict of interest that requires no explanation. At the contentious trial, an independent judge decides. The likelihood that the expert test will be evaluated with impartiality is significantly higher.
What if the taxpayer's database was altered?
If the forensic expert found that the taxpayer's records were modified after the original capture, report them. Duriva doesn't alter findings or hide bad evidence. The forensic truth has no side. If the taxpayer's database was altered, the taxpayer needs to know before the court, to make informed decisions with his prosecutor. A forensic expert that preserves findings isn't forensic expert -- it's a risk.
What type of accounting system can be audited by forensic expert?
Any system that uses a database. Contpaq, Aspel, SAP, Oracle, Microsip, custom-developed proprietary systems. The forensic methodology does not depend on the specific system. It depends on the structure of the database. And all databases -- SQL Server, MySQL, Oracle, Firebird -- have auditable tables, records, timestamps, and logs.
Can the SAT demand its own computer forensics to refute that of the contributor?
Maybe. And I should legally. But in practice, DRiva has noted that the fiscal authority rarely has an expert counter-test in computer. It presents its system constancy, its certified prints and its jobs. But it doesn't have a forensic expert that says with the same technical rigour: "The file hash that the contributor puts forward doesn't match that we have" or "The metadata were altered." And in the absence of expert evidence, the taxpayer's report remains final.
The SAT is not infallible. Their systems are buggy. Their databases have holes. Their processing is flawed. And when those failures generate tax credits against a taxpayer who operated correctly, the burden of proving the error falls on the taxpayer.
That is the reality of the Mexican tax system. It is unfair in its design. It is overwhelming in its consequences. And it is the reality that computer forensics balances.
Because data is data. A hash doesn't lie. A timestamp has no bias. An audit log is not invented. And when that data demonstrates that the discrepancy is not the taxpayer's fault -- that their records are complete, that their XMLs are correct, that the data chain between their accounting system and the PAC is consistent, and that the only thing that does not add up are the authority's records -- the magistrate has the evidence he needs to resolve fairly.
The fight is not in the Excel sheets. The fight is in the database code. And as long as prosecutors continue to fight with spreadsheets, they will continue to lose battles that they could win.
The tool exists. The methodology is proven. The results speak for themselves.
What's missing is for someone to use it. That someone could be you.

