Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Safe to download and compile .v from evil source ?

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Safe to download and compile .v from evil source ?


Chronological Thread 
  • From: Timothy Carstens <intoverflow AT gmail.com>
  • To: coq-club AT inria.fr
  • Subject: Re: [Coq-Club] Safe to download and compile .v from evil source ?
  • Date: Sat, 1 Feb 2020 20:30:36 -0800
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=intoverflow AT gmail.com; spf=Pass smtp.mailfrom=intoverflow AT gmail.com; spf=None smtp.helo=postmaster AT mail-lf1-f51.google.com
  • Ironport-phdr: 9a23:iHNMfh+akDMPMf9uRHKM819IXTAuvvDOBiVQ1KB41u8cTK2v8tzYMVDF4r011RmVBNmdt6kP1LOe8/i5HzBZutDZ6DFKWacPfidNsd8RkQ0kDZzNImzAB9muURYHGt9fXkRu5XCxPBsdMs//Y1rPvi/6tmZKSV3wOgVvO+v6BJPZgdip2OCu4Z3TZBhDiCagbb9oIxi6sArcutMZjIZsJao8yAbFqWZMd+hK2G9kP12ekwvy68uq4JJv7yFcsO89+sBdVqn3Y742RqFCAjQ8NGA16szrtR3dQgaK+3ARTGYYnAdWDgbc9B31UYv/vSX8tupmxSmVJtb2QqwuWTSj9KhkVhnlgzoaOjEj8WHXjstwjL9HoB+kuhdyzZLYbJ2TOfFjeK7WYNEUSndbXstJWCNBDIGzYYsBAeQCIOhWsZXyqkAUoheiHwShHv/jxiNKi3LwwKY00/4hEQbD3AE4AdwOsXHUrNLpNKcSUeG+0bfFwi/Zb/NNxTfy9o7Icgs8qvyLXLJwd9bRyU4xFwzblFWQp4jlPzSb1+kWvGib6vBvVeOri2I9tw5xpT2vy94qh4LUhYwV0kjJ+TtlzIsxP9G1S052bcS5HJZRtSyWLYt7Tt4kTmp1oig10KcGtoS+fCUSyJQo2Rrfa/uffoiN+B3jVeKRLS58hHJrZb6znhiy/Ei9xuHmWcm011FKriVBktbSrHwCyxvT6s2fRvt8+EeuxyqP2hjN5u1YJU04j6nWJp47zrItl5ces17PEy/rlEnuia+ZbEQk+uym6+T9ZbXmo4eRN45yigHiNaQuhNKwAf42MggKWGia9/+x1LLm/ULjQbVKiuc6nbXesJDfPcgbvLK2AxdJ0oY/7BayFyup0NMBnXUeMF1FfA+HgJPyNlHVIPH4CO+/jE62nDdqwfDGJLzhDY/XInjNireyNYp6vkVb0U84yc1Vz5NSELAIZvzpCWHrs9mNMh48NBC00q7MAc9myo4YQirbA6mFN73fq1GM4f0HLOyFZYtTszH4fat2r8XyhGM0zAdONZKi2oEaPSjhQqZWZn6BaH+pue8vVH8Qt1NnHuPvgVyGFzVUYiTqBv9u1nQAEIujSLz7aMWtjbiGhnrpG5RXYiVCBAnJHyqxMYqDXPgIZWSZJcozymVVB4jkcJco0FSVjCG/zrNmKuTO/ShB7MDs0dF046vYkhRgrDE=

Sorry for my part in any confusion <3

Consider the following workflow:
1. User goes to website and downloads .tgz
2. User extracts .tgz, finds a bunch of .v files
3. README.md says "The safety guarantee is expressed in foo.v"
4. Independent expert in computer science reads foo.v, reads basic_definitions.v, and says "yep: the safety guarantee means what you think it means. if it typechecks, then you're good to go."
5. User runs coqc foo.v

My question was: is this safe for the user to do, or is it possible that coqc foo.v might hack their computer?

The interesting question is whether Coq intentionally has features that can facilitate this: things like the ability to run shell commands, write to files at arbitrary paths, explore the file system in any way, open sockets, run arbitrary ocaml, etc.

[ Ignore memory safety for a moment; I'll assume no one knows if coqc is memory safe for the same reasons no one knows if any program is memory safe (no formal methods - yet!) ]

If so, then (5) is inherently an unsafe thing to do, and in that case I don't see how Coq could be used to certify untrusted code. You'd need to first do a code review of the ltac and everything else to convince yourself that it was safe to compile. IMHO this should change in the future, simply on the appeal of the use case described above. One of Coq's best application domains is the verification of real world computing artifacts, after all.


Again, I don't want people to think I'm raising giant alarm bells here - Coq is undergoing a lot of changes right now as a platform, and I respect the autonomy of the Coq maintainers to decide what problems to tackle and in what order. In my opinion they have shown excellent judgement thus far and I do not seek to interfere in their plans.


On Sat, Feb 1, 2020 at 7:48 PM jonikelee AT gmail.com <jonikelee AT gmail.com> wrote:
There's some confusion here, perhaps all mine, about the distinction
between Coq as a system for verifying code (which it can do) vs. Coq
and the environment it runs in as a verified system (which it isn't).
It seems to me that these questions have been mixing those two very
different concepts.

Coq, merely by virtue of it being a system for verifying code, does not
enhance trust of itself and the environment it is run in being safe
to use to check that some other code can be verified.  One level of
trust does not eliminate the need for trusting the other level.

If you run Coq in a way such that something malicious can substitute
'echo "Qed!"' for your Coq prover without you knowing it is
doing so, then there is nothing Coq nor its developers can do to save
you.  Yet I am sure this must be obvious to all, so it must be me that
is still confused about your questions.



On Sun, 2 Feb 2020 15:50:27 +1300
Marco Servetto <marco.servetto AT gmail.com> wrote:

> > Also: "put it in a container" doesn't address the other use case I
> > mentioned above: namely, telling people that they can use Coq to
> > certify the safety/correctness of untrusted code. 
>
> To make this more explicit:
> if there was an online service that gives you "proven correct and
> safe code1" and the corresponding coq proof code2; would running such
> proof be a valid certification that such code1 is
> correct and safe? or, is it possible that during the execution of
> code2 arbitrary behavior makes a "yes" result even if the proof in
> itself if bogus?
> Note how running coq in a container or not does not really change the
> issue here.




Archive powered by MHonArc 2.6.18.

Top of Page