alpine 3.6
format weakness #29


Weakness Breakdown


A format string exploit occurs when the data of an input string is evaluated as a command by the program. This class of attacks is very similar to buffer overflows since an attacker could execute code, read the stack or cause new behaviors that compromise security. Learn more about format string attacks on OWASP attack index.

Warning code(s):

If format strings can be influenced by an attacker, they can be exploited.

File Name:



The highlighted line of code below is the trigger point of this particular Alpine 3.6 format weakness.

 static void 
	verbose = value("verbose") != NULL;
	if (initialized == 0) {
		initialized = 1;
	if (rand_init == 0)
		rand_init = ssl_rand_init();

static int
ssl_verify_cb(int success, X509_STORE_CTX *store)
	if (success == 0) {
		char data[256];
		X509 *cert = X509_STORE_CTX_get_current_cert(store);
		int depth = X509_STORE_CTX_get_error_depth(store);
		int err = X509_STORE_CTX_get_error(store);

		verify_error_found = 1;
		if (message_number)
			fprintf(stderr, "Message %d: ", message_number);
		fprintf(stderr, catgets(catd, CATSET, 229,
				"Error with certificate at depth: %i\n"),
		X509_NAME_oneline(X509_get_issuer_name(cert), data,
				sizeof data);
		fprintf(stderr, catgets(catd, CATSET, 230, " issuer = %s\n"),
		X509_NAME_oneline(X509_get_subject_name(cert), data,
				sizeof data);
		fprintf(stderr, catgets(catd, CATSET, 231, " subject = %s\n"),
		fprintf(stderr, catgets(catd, CATSET, 232, " err %i: %s\n"),
				err, X509_verify_cert_error_string(err));
		if (ssl_vrfy_decide() != OKAY)
			return 0;
	return 1;

static SSL_METHOD *
ssl_select_method(const char *uhp)
	SSL_METHOD *method;
	char	*cp;

	cp = ssl_method_string(uhp); 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.