
Cloud Vulnerability DB
A community-led vulnerabilities database
dratify.parse_dimacs could read a clause out of a comment, so dratify could certify as unsatisfiable a file that every solver tested calls satisfiable. Before 0.1.11, a comment line ended at any Unicode line boundary, not only at a newline.
from dratify import parse_dimacs, check_proof
text = "p cnf 1 1\nc\x0cp cnf 1 2\n1 0\nc\x0c-1 0\n"
f = parse_dimacs(text, strict=True)
f.clauses # two clauses, (1) and (-1)
check_proof(f, "0\n").ok # True before 0.1.11Read a byte at a time, this file has one clause, (1), and setting variable 1 true satisfies it. minisat, CaDiCaL and kissat all answer SAT on it. dratify read the form feed as the end of the comment, then took the rest of the line as input: a second header, which replaced the first and so satisfied strict=True, and the clause (-1).
The checker is right about the formula it was given. The fault is the distance between that formula and the file. The other separators behave the same way: \r, \x0b, \x1c, \x1d, \x1e, U+0085, U+2028 and U+2029.
You are affected if you check proofs against DIMACS files you did not write, particularly where someone has reviewed the file or run a solver on it, and you use dratify's result as the certificate for that same file. Exploiting this takes control of the formula file; control of the proof alone is not enough.
Not affected:
CNF.add or read by anything other than dratify's parser.\n or \r\n line endings, with no such character inside a comment.
A hidden line in a proof is less serious: parse_proof shared the cause, but a hidden addition is still checked, so it obtains nothing that writing it openly would not.Fixed in dratify 0.1.11, on PyPI. A line now ends at \n, with one trailing \r removed, in formulas and proofs alike. Characters inside a comment stay in the comment. The same release also tightens the parser:
ValueError, with or without strict.p.-?[0-9]+, so 1_0, +1, Unicode digits and a no-break space raise.parse_dimacs_file reads the bytes as they are. Path.read_text() does not: its universal newlines turn a stray \r into a line break before any parser sees it, so use parse_dimacs_file on a file you do not trust.
Upgrade. Otherwise, read the file as bytes and refuse any that contains a non-ASCII byte, a byte below 0x20 other than \t, \n and \r, or a \r that is not followed by \n.
Source: NVD
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."