
Cryptkeeper sets the same password “p” independently of user input - m-ou-se
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=852751
======
jhdevos
> It looks as though cryptkeeper makes assumptions about encfs' command-line
> interface that are no longer valid.

This looks like a developer mistaking a command line interface for an API.

Unless an (interactive) CL interface is explicitly marked as being an API, and
documented in such a way, and regression tests exist to make sure the
interface remains backwards-compatible - you should never program against it.
Ask for a proper API to access.

(edit: formatting)

~~~
hueving
If you offer a cli with output reasonable to parse as a text stream, assume
someone is going to script against it and don't change the args without
detecting and warning on the old usage.

~~~
JoshTriplett
Better yet, _don 't_ offer a CLI as the primary interface; provide a
reasonable library to use instead.

~~~
zimbatm
A CLI is usable by any language that can fork/exec and read/write IO. A
library is more likely to be usable by only one language.

~~~
JoshTriplett
A C library, or a library with a C interface, is usable by any language with
an FFI.

~~~
3pt14159
That's true in theory, but in practice most Ruby developers don't know how to
use C or the FFI well enough to build a library out of a C or C++ library.

It's reasonable to shell out sometimes. It's what Github did when they were
first starting. It's what 500px did when they were first starting. Trying to
do everything the right way early on is just going to slow you down.

~~~
deong
I think with security-related software in particular, the proper answer there
is "tough". If you can't figure out how to call a C function, you should
probably just not write critical software.

~~~
marcoperaza
One of the important lessons that the profession has yet to fully internalize
is that there is very little software that is _NOT_ security-related.

~~~
Kalium
It's very, very difficult to get product managers to internalize that there
are real security restrictions on how they can enable users to make things
pretty.

Almost everything is security-related. Almost nobody is willing to work with
this.

------
ChuckMcM
Ouch. For a long time this form of error was the #1 cause of system breakage
in SunOS. Someone would go in and change an option or add a 'version' line
that would print before the output, or re-order how you typed args, and
_blam!_ a bunch of bug reports would come flying in what some program was
broken (sometimes commercial programs where now source was available) because
they had system('foo bar bletch'); in them somewhere.

Very hard to test for as there weren't explicit dependencies and no amount of
'don't count on this output staying the same' warning messages helped.

------
nilssonanders
The 'p' it sends is asked for by encfs when setting up a new encrypted folder
(not when mounting an existing in encfs).

As the comment in the code says, it's for setting the pre-configured
"Paranoia" mode (AES, PBKDF2, IV-chaining, etc) in encfs.

Bad that it's not checking any results whatsoever when sending stuff..

[1] [https://linux.die.net/man/1/encfs](https://linux.die.net/man/1/encfs)

------
baby
> But later, when I mounted it once again, cryptkeeper said the password is
> wrong (though, I 100% know, it's true!).

Is it a vulnerability if the product wasn't even working in the first place?

~~~
akjainaj
What if you create a folder, encrypt it, and then never bother to mount it
again? You'd think it's safe when it isn't.

~~~
baby
Then you're screwed fucked because you don't know how to decrypt your own
data.

------
pawadu
This issue highlights another common problem on FOSS:

If I create a small utility "just for fun" and someone includes it in a major
distro and then nobody (including myself) touches it for 10 years, who is to
blame if there are security (or any other) issues with the software?

~~~
benchaney
Whoever included it in a major distro is to blame.

~~~
pawadu
Yes, but is there any kind of vetting process in any of the major distros?

Does any distro (outside OpenBSD) have a continuous process of re-evaluating
included packages?

~~~
madez
Since quite some time I'm more than annoyed by the unnecessary complexity and
difficulty of traditional distributions caused by inconsistent system tools
and backwards compatibility with antique things that block modernization and
simplification.

Do you know whether OpenBSD strives for consistency and throws away stuff when
there is a better alternative?

~~~
gkya
The whole BSD family of operating systems provide far better consistency than
the Linux distro universe, as they are the ones to directly maintain the base
system's codebase (POSIX utilites, OS-specific utilites, the kernel, the
drivers, init system). Linux distros, on the other hand, are just a
juxtaposition of software from a plethora of sources.

------
TazeTSchnitzel
Yet another example of why command-line interfaces are not safe. Can we start
to use something other than arrays of null-terminated strings for input?

~~~
zython
CLI- as opposed to what ? What other option is there that is easier and safer
to implement ?

~~~
pjmlp
Actual libraries.

~~~
SixSigma
And then someone wraps it in a CLI interface.

What you need is a kernel that exposes programs as a file system like plan9

~~~
pjmlp
That is what the REPL like on Lisp Machines, Interlisp-D, Smalltalk,
Mesa/Cedar, Oberon is for.

------
fergie
How can you ever know if encryption is working properly?

~~~
adrianN
Steal very important data from the NSA, encrypt it, wait.

~~~
dogma1138
Rubber hose cryptanalysis, if your adversary has not quarrels using it, make
sure that your encryption is not strong enough to mandate employing it.

~~~
adrianN
Finding out whether your encryption is strong does require some determination.

------
mhogomchungu
The bug here is probably with encfs and most frontend tools to enc are doing
exactly what cryptkeeper is doing.

For those who want alternative to cryptkeeper,there is SiriKali[1], next
version will be released on Feb 1st and it will have support for OSX.

    
    
        execlp ("encfs", "encfs", "-S", crypt_dir, mount_dir, NULL);
    

That line of code also has a bug as its wrong to pass NULL in C++ to a
variadic function. IMHO,usage of NULL in C++ should be strongly discouraged in
all cases.

[1]
[https://github.com/mhogomchungu/sirikali](https://github.com/mhogomchungu/sirikali)

~~~
fnj
Incorrect. execlp _requires_ a NULL to terminate the argument list. How else
would the called function know when to stop processing arguments?

To quote the linux man page, "The list of arguments _must_ be terminated by a
NULL pointer...".

~~~
merijnv
The original paster didn't say that a null pointer was incorrect, merely that
using NULL in C++ was. Which, in recent versions of C++ it certainly is. The
correct way to specify a null pointer in C++ is 'nullptr', NULL has been
deprecated because it's definition '(void*)0' leads to typing issues for
templates.

~~~
CJefferson
No, that's exactly wrong (in this case).

For variadic C functions, you MUST use 0 (or NULL, which is the same as 0).
Passing nullptr will case abort() to be called (as is the case whenever you
pass a C++ class into a variadic function).

~~~
CJefferson
Reply (to myself, based on a correction)

Apologises, I mis-remembered the rule -- it is only C++ types which have a
non-trivial destructor which cause an abort when you pass them to a variadic
funciton.

HOWEVER. This is still undefined behaviour. nullptr is an object of type
std::nullptr_t. When you pass it to execlp, it just gets pushed through as a
bit-pattern (as with any type passed to a variadic C function), and there is
no guarantee what comes out looks like a "true" (void*)0 C-style null pointer.

~~~
ben0x539
There isn't a guarantee that NULL has a bit pattern that's the same as a true
(void _)0 C-style null pointer either.

I didn't look it up directly but apparently NULL is allowed to be nullptr
instead of 0, and nullptr converts to void_ in varargs arguments.

I think C/C++ also allow actual null pointers to have different bit patterns
than the integer zero, so in C++03 passing NULL to terminate a varargs
argument list would technically be incorrect, or maybe implementation-defined.

~~~
CJefferson
Damn, there is a special exception in the definition of vararg functions, just
for nullptr! _throws things in the air_ I give up having discussions about
C++.

~~~
ben0x539
I give up too, because the HN formatting is actively fighting me.

------
db48x
It should at least have been using `expect`!

------
ComodoHacker
What bothers me is how it got into 'testing' without any actual testing. This
tells something about processes in Debian.

~~~
Sir_Cmpwn
testing is _for_ testing, you know. Testing happens there, not earlier.

------
borplk
A great example of the falsehood that people often repeat mindlessly about
"thousands of eyeballs watching the source".

~~~
nine_k
See, that user actually watched the source and readily detected the bug.

I just wonder if thousands, or hundreds, or at least a dozen eyeballs actually
watched this source. I suspect 1-2 pairs of eyeballs would detect the problem
if a proper code review was done.

Even better, if an automated test existed for this pretty critical piece of
code (passing the password around), thousands of eyeballs won't even be needed
that badly.

I suspect that just too few people actually use this piece of software. If a
large org used it, they probably would have tested this, or even audited the
code.

Anyway, it's _great_ that everyone has access to the code, so the bug was
detected by a user. For closed-source software, a ticket like this might
linger longer for a developer's attention.

~~~
borplk
Oh if only it was more popular, yeah just like Heartbleed was caught in
OpenSSL.

My point was the eyeballs argument is often made as a claim about the absence
of bugs at the present time.

When in fact it simply means "it is possible for people to look at it and find
and fix bugs" no more no less.

The mere ability does not magically translate to security. And the ability
does not automatically imply that it is being done.

