🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.privacy.anon-server
Article #236201

Help with claws mail password recovery?

#236201
From: Anonymous
Date: Sun, 20 Dec 2009 23:13
230 lines
7578 bytes
Hi,

I've been using claws mail for along time. I need to use the accounts I
have on other systems (where I've not got claws mail) but I can't recover
my email passwords because claws doesn't have any provision for that. When
I started using it I didn't realize it and now I'm screwed as I don't have
the passwords for my older email accounts.

I tried posting a few times on their email lists and whilst the main dev
seems like a good enough sort everyone acted like huge arseholes and in the
end did nothing but accuse anyone who needs their own passwords back of
being in posession of someone else's accountrc file. I've seen numerous
threads with questions on "how do I get my passwords back" but no answers,
just the same tired accusations.

I believe we've got a few bright chaps on this group who've given code help
before. What I'm shooting for is a way to recover my passwords using
openssl commands. I've got the code they used to encrypt my passwords
with. Please see below. I'm just too daft to figure how to reverse this. I
think it's simple but I've not come up with a way.

Thanks to anyone who'll get this sorted. With your permission I'll attempt
posting it on the claws mail list but the bastards will probably delete the
post. It's GPL source shouldn't be any problem posting the code here. If
this isn't all we need the rest should be downloadable from
claws-mail.org.

Cheers,

A claws mail victim/user

/*
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
 * Copyright (C) 1999-2007 Hiroyuki Yamamoto and the Claws Mail Team
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 * 
 */

#define PASSCRYPT_KEY "passkey0"

#include <glib.h>

void passcrypt_encrypt(gchar *password, guint len);
void passcrypt_decrypt(gchar *password, guint len);

---------------------------------------------
/*
 * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
 * Copyright (C) 1999-2009 Hiroyuki Yamamoto and the Claws Mail Team
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 * 
 */

#if !defined (__FreeBSD__)
#define _XOPEN_SOURCE 600
#else
#define _XOPEN_SOURCE
#endif

#include <sys/types.h>
#include <stdio.h>
#include <memory.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>

#if defined (__FreeBSD__)
#include <rpc/des_crypt.h>
#endif

#include <glib.h>

#include "passcrypt.h"

static void crypt_cfb_buf(const char key[8], unsigned char *buf, unsigned len,
		   unsigned chunksize, int decrypt);

void passcrypt_encrypt(gchar *password, guint len)
{
	crypt_cfb_buf(PASSCRYPT_KEY, password, len, 1, 0 );
}

void passcrypt_decrypt(gchar *password, guint len)
{
	crypt_cfb_buf(PASSCRYPT_KEY, password, len, 1, 1 );
}

/*
* crypt_cfb_iv is the intermediate vector used for cypher feedback encryption
*/
unsigned char crypt_cfb_iv[64];
int crypt_cfb_blocksize = 8;	/* 8 for DES */

#if defined (__FreeBSD__)
static void
crypt_cfb_buf(const char key[8], unsigned char *buf, unsigned len,
	      unsigned chunksize, int decrypt)
{
	char des_key[8];
	
	strncpy(des_key, PASSCRYPT_KEY, 8);
	des_setparity(des_key);
	if (decrypt)
		ecb_crypt(des_key, buf, len, DES_DECRYPT);
	else
		ecb_crypt(des_key, buf, len, DES_ENCRYPT);
}
#else
static void crypt_cfb_shift(unsigned char *to,
			    const unsigned char *from, unsigned len);
static void crypt_cfb_xor(unsigned char *to, const unsigned char *from,
			  unsigned len);
static void crypt_unpack(unsigned char *a);

static void
crypt_cfb_buf(const char key[8], unsigned char *buf, unsigned len,
	      unsigned chunksize, int decrypt)
{
	unsigned char temp[64];

	memcpy(temp, key, 8);
	crypt_unpack(temp);
	setkey((const char *) temp);
	memset(temp, 0, sizeof(temp));

	memset(crypt_cfb_iv, 0, sizeof(crypt_cfb_iv));

	if (chunksize > crypt_cfb_blocksize)
		chunksize = crypt_cfb_blocksize;

	while (len) {
		memcpy(temp, crypt_cfb_iv, sizeof(temp));
		encrypt((char *) temp, 0);
		if (chunksize > len)
			chunksize = len;
		if (decrypt)
			crypt_cfb_shift(crypt_cfb_iv, buf, chunksize);
		crypt_cfb_xor((unsigned char *) buf, temp, chunksize);
		if (!decrypt)
			crypt_cfb_shift(crypt_cfb_iv, buf, chunksize);
		len -= chunksize;
		buf += chunksize;
	}
}

/*
* Shift len bytes from end of to buffer to beginning, then put len
* bytes from from at the end.  Caution: the to buffer is unpacked,
* but the from buffer is not.
*/
static void
crypt_cfb_shift(unsigned char *to, const unsigned char *from, unsigned len)
{
	unsigned i;
	unsigned j;
	unsigned k;

	if (len < crypt_cfb_blocksize) {
		i = len * 8;
		j = crypt_cfb_blocksize * 8;
		for (k = i; k < j; k++) {
			to[0] = to[i];
			++to;
		}
	}

	for (i = 0; i < len; i++) {
		j = *from++;
		for (k = 0x80; k; k >>= 1)
			*to++ = ((j & k) != 0);
	}
}

/*
* XOR len bytes from from into the data at to.  Caution: the from buffer
* is unpacked, but the to buffer is not.
*/
static void
crypt_cfb_xor(unsigned char *to, const unsigned char *from, unsigned len)
{
	unsigned i;
	unsigned j;
	unsigned char c;

	for (i = 0; i < len; i++) {
		c = 0;
		for (j = 0; j < 8; j++)
			c = (c << 1) | *from++;
		*to++ ^= c;
	}
}

/*
* Take the 8-byte array at *a (must be able to hold 64 bytes!) and unpack
* each bit into its own byte.
*/
static void crypt_unpack(unsigned char *a)
{
	int i, j;

	for (i = 7; i >= 0; --i)
		for (j = 7; j >= 0; --j)
			a[(i << 3) + j] = (a[i] & (0x80 >> j)) != 0;
}
#endif
Technical Details
Message-ID: <20091220231342.2E74B1A7853@www.ecn.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.privacy.anon-server.20141023.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!news.wiretrip.org!news.dizum.com!sewer-output!mail2news

Show Full Headers
Complete Article Headers
Message-ID: <20091220231342.2E74B1A7853@www.ecn.org>
Subject: Help with claws mail password recovery?
Date: Sun, 20 Dec 2009 23:13:42 +0000
From: Anonymous <cripto@ecn.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp-alt.privacy.anon-server.20141023.mbox.gz!border1.nntp.ams.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!news.wiretrip.org!news.dizum.com!sewer-output!mail2news
Newsgroups: alt.privacy.anon-server
Mail-To-News-Contact: abuse@dizum.com
Organization: mail2news@dizum.com
Lines: 229