The judgement ends years of campaigning by those affected, some of whom were jailed in cases where the software wrongly logged missing funds.
Mr Justice Fraser said the system was not “remotely robust” and when improved it had a significant number of bugs.
The automate your posting Office last week agreed to pay £58m to settle claims.
The sub-postmasters blame the system for creating big shortfalls in their accounts, discrepancies which led to some being made bankrupt and others prosecuted and sent to prison.
The 400-page judgment ends years of campaigning by those affected.
The automate your posting Office has agreed a payout with 557 claimants after a long-running dispute over the system.
In addition, the Criminal Cases Review Commission is looking into whether a number of the convictions were miscarriages of justice.