mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #833] Cost is uninitialized if format doesn't use it, but ldr_filter_costs() is called! #442
Labels
No labels
bug
core branch
documentation
enhancement
enhancement
fixed - pending verify
fuzz bug
good first issue
invalid
invalid
maintenance/cleanup
new cracking mode
new format
new tool
non-trivial
notes/external issues
portability
question
RFC / discussion
testing
WONTFIX
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openwall/john#442
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @magnumripper on GitHub (Oct 27, 2014).
Original GitHub issue: https://github.com/openwall/john/issues/833
Originally assigned to: @frank-dittrich on GitHub.
loader.c:757 (
8f37e8ce) cost figures are uninitialized (array is alloc, not calloc) if format doesn't use costs. But ldr_filter_costs() is called regardless, using those uninitialized values. I saw Valgrind complain over it for raw-md5 and for once it seems not to be a false positive.@frank-dittrich commented on GitHub (Oct 28, 2014):
loader.c:757 has
Are you saying that even though the tunable cost functions in raw-md5 are defined like this
there'll be some of the 3 tunable functions not NULL?
Otherwise, I don't see how here
could be an uninitialized access.
ldr_filter_costs()callsldr_cost_ok()withdb->options->min_costanddb->options->max_costIs this access
of (the uninitialized?) salt->cost[i] what valgrind complains about?
But since I initialize
in
opt_init(), even if salt->cost[i] would be uninitialized,it will always be >= min_cost[i] and <= max_cost[i].I temporarily added
immediately before the if statement in
ldr_cost_ok()and tested both the saltless raw-md5 and the salted sapb format (both without tunable costs).So, salt[i] doesn't even look uninitialized.
Can you enlighten me what I am missing?
I see a (minor) other proble, though:
While this is OK (warning if more than FMT_TUNABLE_COST cost values (or ranges) are specified:
This is not:
In both cases, I was specifying more tunable cost values (or ranges) than the format supports.
I could have stopped with an error message.
@frank-dittrich commented on GitHub (Oct 28, 2014):
When I run john --format=raw-md5 with valgrind, I see
loader.c:1214 is exactly the line I mentioned in my previous comment.
_i_2, salt->cost[i] 0, min_cost[i] 0, max_cost[i] 4294967295
salt->cost[i] can never be < 0 or > UINT_MAX here.
Does that qualify for false positive?
Should I add a source code comment?
@frank-dittrich commented on GitHub (Oct 28, 2014):
I could change the code to always set cost[i] to 0 whenever the corresponding tunable cost reporting function is NULL, just to make valgrind happy. (It just needs to be done once per salt.)
@magnumripper commented on GitHub (Oct 28, 2014):
No, I'm saying because they are null, current_salt->cost[i] is never initialized at all. It's what it happens to be after the alloc. Or so I thought...
But exactly where ARE they initialized then?
@magnumripper commented on GitHub (Oct 28, 2014):
OK; I see. It's not a problem because of the defaults of min_cost and max_cost. So Valgrind is right complaining about it, but it's no issue at all.
@magnumripper commented on GitHub (Oct 28, 2014):
Adding comments or extra initialization is not of much use. Let's just close this?
@frank-dittrich commented on GitHub (Oct 28, 2014):
You could file a valgrind bug report so it doesn't claim the program flow depends on uninitialized values when I compare against min and / or max value of the given type.