rhel 7
format weakness #19

4

Weakness Breakdown


Definition:

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:

lasso-2.5.1/tests/perfs.c

Context:

The highlighted line of code below is the trigger point of this particular Red Hat Enterprise Linux 7 format weakness.

 #endif
	check_good_rc(lasso_login_build_authn_response_msg(idp_login));
}

void
process_authn_response(LassoLogin *sp_login, LassoLogin *idp_login)
{
#if 0
		lasso_profile_set_signature_verify_hint(&sp_login->parent, LASSO_PROFILE_SIGNATURE_VERIFY_HINT_FORCE);
#endif
		check_good_rc(lasso_login_process_authn_response_msg(sp_login, idp_login->parent.msg_body));
		if (sp_login->parent.session) {
			g_object_unref(sp_login->parent.session);
			sp_login->parent.session = NULL;
		}
		check_good_rc(lasso_login_accept_sso(sp_login));
}

void timing(int n, char *text, void (*f)(LassoLogin *sp_login, LassoLogin *idp_login), LassoLogin
		*sp_login, LassoLogin *idp_login)
{
	int i;
	struct timeval start, end;
	int usec;
	fprintf(stdout, text, n);
	gettimeofday(&start, NULL);

	for (i = 0; i < n; i++) {
		f(sp_login, idp_login);
	}
	gettimeofday(&end, NULL);
	usec = (end.tv_sec*1000000+end.tv_usec)-(start.tv_sec*1000000+start.tv_usec);
	fprintf(stdout, " total: %.4f seconds (%f request/second) (%.2f ms/request)\n",
			(double)usec/1000000,
			(double)n/usec*1000000,
			(double)usec/1000/n);
}

int
main(int argc, char *argv[])
{
	LassoServer *sp_server, *idp_server;
	LassoLogin *sp_login, *idp_login;
	int n = 100;
	char sp_metadata[100], sp_pkey[100],
	     idp_metadata[100], idp_pkey[100];
	char *index = "5-saml2";
	GList *providers;
	LassoKey *key;
	LassoProvider *provider; 

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.