A new security vulnerability known as the Bash or Shellshock bug could spell disaster for major digital companies, small-scale Web hosts and even Internet-connected devices.

The quarter-century-old security flaw allows malicious code execution within the bash shell (commonly accessed through Command Prompt on PC or Mac's Terminal application) to take over an operating system and access confidential information.

A post from open-source software company Red Hat warned that "it is common for a lot of programs to run Bash shell in the background," and the bug is "triggered" when extra code is added within the lines of Bash code.

Security expert Robert Graham has warned that the Bash bug is bigger than Heartbleed because "the bug interacts with other software in unexpected ways" and because an "enormous percentage" of software interacts with the shell.

"We'll never be able to catalogue all the software out there that is vulnerable to the Bash bug," Graham said. "While the known systems (like your Web server) are patched, unknown systems remain unpatched. We see that with the Heartbleed bug: six months later, hundreds of thousands of systems remain vulnerable."

Ars Technica reports that the vulnerability could affect Unix and Linux devices, as well as hardware running Max OS X. According to Ars, a test on Mac OS X Mavericks (version 10.9.4) showed that it has "a vulnerable version of Bash".

I think I was wrong saying #shellshock was as big as #heartbleed. It's bigger. — Robert Graham (@ErrataRob) September 25, 2014

Graham warned that the Bash bug was also particularly dangerous for connected Internet-of-things devices because their software is built using Bash scripts, which are "less likely to be patched...[and] more likely to expose the vulnerability to the outside world". Similarly, Graham said the bug has existed for a "long, long time" meaning a great number of older devices will be vulnerable.

"The number of systems needing to be patched, but which won't be, is much larger than Heartbleed," he said.

The Heartbleed bug, the major security vulnerability revealed in April, was introduced into OpenSSL more than two years ago, allowing random bits of memory to be retrieved from impacted servers. Security researcher Bruce Schneier called the flaw "catastrophic".

"On the scale of 1 to 10, this is an 11," he said, estimating that half a million websites were vulnerable.

Patching the shell

Tod Beardsley, an engineering manager at security firm Rapid7, warned that even though the vulnerability's complexity was low, the wide range of devices affected require that system administrators apply patches immediately.

"This vulnerability is potentially a very big deal," Beardsley told CNET. "It's rated a 10 for severity, meaning it has maximum impact, and 'low' for complexity of exploitation -- meaning it's pretty easy for attackers to use it.

"The affected software, Bash, is widely used so attackers can use this vulnerability to remotely execute a huge variety of devices and Web servers. Using this vulnerability, attackers can potentially take over the operating system, access confidential information, make changes etc. Anybody with systems using bash needs to deploy the patch immediately."

Attackers can potentially take over the operating system, access confidential information, make changes. Tod Beardsley

After conducting a scan of the Internet to test for the vulnerability, Graham reported that the bug "can easily worm past firewalls and infect lots of systems" which he says would be "'game over' for large networks". Similar to Beardsley, Graham said the problem needed immediate attention.

"Scan your network for things like Telnet, FTP, and old versions of Apache (masscan is extremely useful for this). Anything that responds is probably an old device needing a Bash patch. And, since most of them can't be patched, you are likely screwed."

Updated at 5:22 p.m. AEST to include initial background on the Bash bug.