Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sun, 9 Jun 2013 01:44:09 +0400
From: Solar Designer <solar@...nwall.com>
To: john-users@...ts.openwall.com
Subject: DokuWiki auto-generated passwords cracker

Hi,

As @mik235 pointed out:

<@mik235> @solardiz @dokuwiki Um, that only has 385641000 possiblities.
Not even worth going over the rng (which has weak seeding in adLDAP.php)

I did not bother verifying if 385641000 is larger or smaller than the
number of possible seeds for the PRNG.  Rather, I went ahead and
modified the KnownForce external mode for this trivial pattern.  Even if
the PRNG has fewer possible seeds, I think this example is of some use:

# A variation of KnownForce configured to try all the 385641000 possible
# auto-generated passwords of DokuWiki versions up to at least 2013-05-10.
[List.External:DokuWiki]
int last;		// Last character position, zero-based
int lastofs;		// Last character position offset into charset[]
int lastid;		// Current character index in the last position
int id[0x7f];		// Current character indices for other positions
int charset[0x7f00];	// Character sets, 0x100 elements for each position

void init()
{
	int A[26], C[26], V[26];
	int length;
	int pos, ofs, i, c;

	i = 0; while (i < 26) { A[i] = C[i] = 1; V[i++] = 0; }
	i = 'a' - 'a'; C[i] = 0; V[i] = 1;
	i = 'e' - 'a'; C[i] = 0; V[i] = 1;
	i = 'i' - 'a'; C[i] = 0; V[i] = 1;
	i = 'o' - 'a'; C[i] = 0; V[i] = 1;
	i = 'u' - 'a'; C[i] = 0; V[i] = 1;
	i = 'q' - 'a'; A[i] = C[i] = 0;
	i = 'x' - 'a'; A[i] = C[i] = 0;
	i = 'y' - 'a'; A[i] = C[i] = 0;

	length = 8;

/* This defines the character sets for different character positions */
	pos = 0;
	while (pos < 6) {
		ofs = pos++ << 8;
		i = 0;
		c = 'a' - 1;
		while (++c <= 'z')
			if (C[c - 'a'])
				charset[ofs + i++] = c;
		charset[ofs + i] = 0;
		ofs = pos++ << 8;
		i = 0;
		c = 'a' - 1;
		while (++c <= 'z')
			if (V[c - 'a'])
				charset[ofs + i++] = c;
		charset[ofs + i] = 0;
		ofs = pos++ << 8;
		i = 0;
		c = 'a' - 1;
		while (++c <= 'z')
			if (A[c - 'a'])
				charset[ofs + i++] = c;
		charset[ofs + i] = 0;
	}
	c = '1';
	while (pos < length) {
		ofs = pos++ << 8;
		i = 0;
		while (c <= '9')
			charset[ofs + i++] = c++;
		charset[ofs + i] = 0;
		c = '0';
	}

	last = length - 1;
	pos = -1;
	while (++pos <= last)
		word[pos] = charset[id[pos] = pos << 8];
	lastid = (lastofs = last << 8) - 1;
	word[pos] = 0;
}

void generate()
{
	int pos;

/* Handle the typical case specially */
	if (word[last] = charset[++lastid]) return;

	word[pos = last] = charset[lastid = lastofs];
	while (pos--) {			// Have a preceding position?
		if (word[pos] = charset[++id[pos]]) return;
		word[pos] = charset[id[pos] = pos << 8];
	}

	word = 0;			// We're done
}

void restore()
{
	int i, c;

/* Calculate the current length and infer the character indices */
	last = 0;
	while (c = word[last]) {
		i = lastofs = last << 8;
		while (charset[i] != c && charset[i]) i++;
		if (!charset[i]) i = lastofs; // Not found
		id[last++] = i;
	}
	lastid = id[--last];
}

Alexander

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.