← back
CVE-2014-6271criticalunder attackCWE-78

CVE-2014-6271

100Vexday Risk Score

Patch now. It under exploitation confirmed by CISA and has a working public exploit.

ssvc Actcvss 9.8epss 100%
from disclosure to weapon0 days
Published on NVDSep 24
1st PoCSep 24
metasploitSep 24
CISA KEV+2683d
exploitation probability
100%top 1% of all CVEs
observed exploitation
yesCISA + VulnCheck
185 public exploit(s)
Action required by CISAfederal deadline: 2022-07-28

Apply updates per vendor instructions.

Summary

Shellshock é uma falha de injeção de comando (CWE-78) no interpretador GNU Bash: até a versão 4.3, o Bash continua executando código colocado depois do fechamento de uma definição de função exportada via variável de ambiente. Qualquer serviço que passe entrada externa para uma variável de ambiente e depois invoque Bash — CGI do Apache, ForceCommand do OpenSSH, clientes DHCP, entre outros — vira ponto de execução remota de código sem autenticação. O CVSS 9.8 reflete corretamente a gravidade: a exploração é trivial, não exige interação do usuário e o impacto é execução arbitrária no contexto do processo que invocou o shell.

Technical detail

O Bash permite exportar funções shell através de variáveis de ambiente cujo valor começa com a sintaxe '() {'. Ao importar essas variáveis na inicialização de uma nova instância, o parser do Bash lê a definição da função, mas — no código vulnerável — não impõe que a string termine ali. Qualquer comando colocado depois do fechamento de chaves da função é interpretado e executado como comando shell normal, fora do contexto da função. Isso significa que o atacante controla integralmente o conteúdo de uma variável de ambiente e usa esse controle para injetar comandos arbitrários que o Bash executa no momento em que é iniciado, mesmo que a aplicação nunca tenha chamado explicitamente essa função.

O vetor de ataque não é o Bash sendo chamado diretamente pelo atacante, e sim uma aplicação privilegiada que aceita entrada externa (cabeçalho HTTP, variável repassada por CGI, comando SSH, opção DHCP) e a coloca em uma variável de ambiente antes de invocar Bash — cruzando uma fronteira de privilégio entre quem define a variável e quem executa o shell. mod_cgi/mod_cgid do Apache repassam cabeçalhos HTTP (como User-Agent, Referer, Cookie) como variáveis de ambiente para scripts CGI; a feature ForceCommand do OpenSSH sshd também expõe variáveis controladas pelo cliente SSH ao Bash executado pelo servidor.

O ponto crítico documentado pelo CERT/CC e pela Red Hat é que a correção original publicada para CVE-2014-6271 foi incompleta: ela impedia a execução de comandos após a função, mas não cobria todos os caminhos de parsing. A vulnerabilidade residual recebeu CVE-2014-7169, e problemas adicionais no mesmo mecanismo geraram CVE-2014-6277, CVE-2014-7186 e CVE-2014-7187. Ou seja, 'corrigir CVE-2014-6271' isoladamente, com o patch original, não elimina o risco — é preciso aplicar o pacote que também trata CVE-2014-7169 em diante.

How it’s exploited

Na prática, a exploração depende de existir uma aplicação que (a) aceite entrada controlada pelo atacante, (b) coloque essa entrada em uma variável de ambiente, e (c) chame Bash para processar algo — direta ou indiretamente. O caso mais explorado foi CGI em servidores Apache com mod_cgi/mod_cgid: o atacante envia uma requisição HTTP com um cabeçalho (por exemplo User-Agent) contendo a string de payload '() { :;}; comando', o servidor CGI copia o cabeçalho para uma variável de ambiente, e o script CGI, ao ser executado via Bash, dispara o comando injetado com os privilégios do processo do servidor web. Não é necessária autenticação nem qualquer interação do usuário — é uma requisição HTTP única.

Outros vetores documentados incluem sshd com ForceCommand habilitado (onde variáveis do cliente SSH são repassadas ao shell forçado, mesmo com uma conta restrita), clientes DHCP que executam scripts de configuração de rede recebendo opções do servidor DHCP como variáveis de ambiente (nesse caso o atacante precisa controlar a resposta DHCP, geralmente estando na mesma rede ou controlando o servidor), e qualquer software que gere ambiente a partir de dados de rede antes de invocar Bash (CUPS, git, alguns clientes de e-mail, dispositivos embarcados que usam Bash como shell padrão).

O CERT/CC classificou a exploração como ativa desde os primeiros dias de divulgação, e a Red Hat relatou circulação de malware explorando a falha em 29/09/2014 — worms automatizados escaneando a internet em busca de servidores CGI vulneráveis para instalar bots de DDoS e mineração. A presença no catálogo KEV da CISA, módulo Metasploit e template Nuclei confirmam que a exploração continua trivial de automatizar mesmo anos depois, contra qualquer instância legada ainda exposta.

Versions

Affected
GNU Bash em todas as versões até 4.3 ('through 4.3', conforme descrição oficial), incluindo ramos legados como 3.0, 3.2 e 4.1 distribuídos por diversas plataformas Unix-like, Linux e macOS.
Fixed in
Não há um único número de versão upstream citado nas fontes consultadas; a correção foi distribuída como patches sobre os pacotes existentes de cada fornecedor, cobrindo CVE-2014-6271 e, em seguida, CVE-2014-7169 (o patch inicial foi incompleto). Exemplos de pacotes corrigidos documentados pela Red Hat: RHEL 7 — bash-4.2.45-5.el7_0.4; RHEL 6 — bash-4.1.2-15.el6_5.2 (e variantes AUS/EUS); RHEL 5 — bash-3.2-33.el5_11.4 (e variantes SJIS/EUS/Long Life); RHEL 4 — bash-3.0-27.el4.4. Outros fornecedores (Debian, Mageia, Oracle Linux, Apple, Juniper, Cisco etc.) publicaram patches equivalentes para suas próprias linhas de versão — consultar o advisory específico de cada um.

How to protect

A mitigação correta é atualizar o pacote Bash para uma versão que trate toda a cadeia CVE-2014-6271 + CVE-2014-7169 (e idealmente os CVEs subsequentes 6277/7186/7187), não apenas o primeiro patch — aplicar somente a correção original de CVE-2014-6271 deixa o sistema explorável via CVE-2014-7169. Nos pacotes Red Hat isso corresponde a: RHEL 7 bash-4.2.45-5.el7_0.4, RHEL 6 bash-4.1.2-15.el6_5.2, RHEL 5 bash-3.2-33.el5_11.4, RHEL 4 bash-3.0-27.el4.4 (mais variantes SJIS e EUS/AUS listadas pelo fornecedor). Distribuições e sistemas com Bash próprio (BSD, macOS, roteadores embarcados) precisam do patch equivalente do respectivo mantenedor/fornecedor; a lista completa de vendors afetados e status está no VU#252743 do CERT/CC.

Quando atualizar não é possível de imediato, o controle compensatório real é reduzir a superfície de exposição: desativar ou substituir scripts CGI que invocam Bash, trocar o shell padrão de serviços de rede (sshd com ForceCommand, DHCP hooks) para um interpretador não vulnerável, ou filtrar/normalizar cabeçalhos HTTP e demais entradas antes de repassá-las como variáveis de ambiente. Regras de WAF que bloqueiam a assinatura '() {' em cabeçalhos ajudam a reduzir exploração automatizada e oportunista, mas não fecham o vetor — atacantes podem variar a codificação ou usar vetores não-HTTP (DHCP, SSH) que o WAF não vê.

O que não funciona: acreditar que aplicar apenas o primeiro patch de setembro de 2014 resolve o problema — isso é exatamente o cenário que gerou CVE-2014-7169 e os CVEs seguintes. Também não basta trocar /bin/sh para outro shell se scripts ou serviços ainda invocam /bin/bash explicitamente.

How to detect

O teste de diagnóstico publicado pela Red Hat e pelo CERT/CC identifica se uma instalação está vulnerável: executar 'env x='"'"'() { :;}; echo vulnerable'"'"' bash -c "echo this is a test"' e verificar se a palavra 'vulnerable' aparece na saída — se aparecer, o Bash ainda processa comandos após a definição de função. Para exploração remota via CGI, o sinal em log de acesso do Apache é a presença da assinatura '() {' em cabeçalhos como User-Agent, Referer, Cookie ou em parâmetros de query string, seguida de comandos shell (curl, wget, /bin/bash, base64 -d) — esse padrão é característico de scanners automatizados e do módulo Metasploit/Nuclei.

Para vetores fora de HTTP (SSH com ForceCommand, DHCP), não há assinatura de rede padronizada e confiável a se observar em logs convencionais de aplicação; a detecção nesses casos depende de monitoramento de execução de processos (EDR) capturando Bash filho gerando processos ou conexões de saída inesperadas a partir de daemons de rede, já que o tráfego em si não expõe claramente a variável de ambiente maliciosa.

Researched and written with AI from the vendor advisory and public analysis, with the sources above. Always confirm the fixed version in the official advisory before acting.
GNU Bash through 4.3 processes trailing strings after function definitions in the values of environment variables, which allows remote attackers to execute arbitrary code via a crafted environment, as demonstrated by vectors involving the ForceCommand feature in OpenSSH sshd, the mod_cgi and mod_cgid modules in the Apache HTTP Server, scripts executed by unspecified DHCP clients, and other situations in which setting the environment occurs across a privilege boundary from Bash execution, aka "ShellShock." NOTE: the original fix for this issue was incorrect; CVE-2014-7169 has been assigned to cover the vulnerability that is still present after the incorrect fix.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Affected products
n/a · n/a
public PoCs found185 VexDay Proof
exploitdbVexDay Proofwww.exploit-db.com/exploits/35115exploitdbVexDay Proofwww.exploit-db.com/exploits/38849exploitdbVexDay Proofwww.exploit-db.com/exploits/34895exploitdbVexDay Proofwww.exploit-db.com/exploits/34839exploitdbVexDay Proofwww.exploit-db.com/exploits/40938exploitdbVexDay Proofwww.exploit-db.com/exploits/34900exploitdbVexDay Proofwww.exploit-db.com/exploits/34765exploitdbVexDay Proofwww.exploit-db.com/exploits/34896exploitdbVexDay Proofwww.exploit-db.com/exploits/34862exploitdbVexDay Proofwww.exploit-db.com/exploits/42938exploitdbVexDay Proofwww.exploit-db.com/exploits/34777exploitdbVexDay Proofwww.exploit-db.com/exploits/39918exploitdbVexDay Proofwww.exploit-db.com/exploits/34766exploitdbwww.exploit-db.com/exploits/36504unverifiedexploitdbwww.exploit-db.com/exploits/36609unverifiedexploitdbwww.exploit-db.com/exploits/35146unverifiedexploitdbwww.exploit-db.com/exploits/34879unverifiedexploitdbwww.exploit-db.com/exploits/34860unverifiedexploitdbwww.exploit-db.com/exploits/37816unverifiedexploitdbwww.exploit-db.com/exploits/36503unverifiedexploitdbwww.exploit-db.com/exploits/40619unverifiedgithubgithub.com/opsxcq/exploit-CVE-2014-6271230githubgithub.com/scottjpack/shellshock_scanner46githubgithub.com/hmlio/vaas-cve-2014-627122githubgithub.com/b4keSn4ke/CVE-2014-627115githubgithub.com/cj1324/CGIShell13githubgithub.com/francisck/shellshock-cgi12githubgithub.com/indiandragon/Shellshock-Vulnerability-Scan11githubgithub.com/P0cL4bs/ShellShock-CGI-Scan6githubgithub.com/npm/ansible-bashpocalypse6githubgithub.com/J0hnTh3Kn1ght/CVE-2014-62715githubgithub.com/zalalov/CVE-2014-62714githubgithub.com/securusglobal/BadBash4githubgithub.com/akr3ch/CVE-2014-62714githubgithub.com/0x00-0x00/CVE-2014-62713githubgithub.com/K3ysTr0K3R/CVE-2014-6271-EXPLOIT3githubgithub.com/akiraaisha/shellshocker-python3githubgithub.com/ramnes/pyshellshock2githubgithub.com/sch3m4/RIS2githubgithub.com/RainMak3r/Rainstorm2githubgithub.com/0xN7y/CVE-2014-62711githubgithub.com/gabemarshall/shocknaww1githubgithub.com/im2sinister/CVE-2014-62711githubgithub.com/proclnas/ShellShock-CGI-Scan1githubgithub.com/ryeyao/CVE-2014-6271_Test1githubgithub.com/Any3ite/CVE-2014-62711githubgithub.com/somhm-solutions/Shell-Shock1githubgithub.com/Gurguii/cgi-bin-shellshock1githubgithub.com/sunnyjiang/shellshocker-android1githubgithub.com/APSL/salt-shellshock1githubgithub.com/TheRealCiscoo/shellshock-poc1githubgithub.com/RadYio/CVE-2014-62711githubgithub.com/V3nG4mxV1p3r/Mobile-Drop-Device-SOC-Detection1githubgithub.com/Anklebiter87/Cgi-bin_bash_Reverse1githubgithub.com/themson/shellshock1githubgithub.com/TheRealCiscoo/Shellshock-Exploit1githubgithub.com/mochizuki875/CVE-2014-6271-Apache-Debian1githubgithub.com/kaleth4/-CVE-2014-62710githubgithub.com/ambjlou/it355-lab4-enterprise-lan-security0githubgithub.com/kaleth4/CVE-2014-62710githubgithub.com/cyberexpert111/Blind-SSRF-to-Remote-Code-Execution-Shellshock-Professional-Bug-Bounty-Report0githubgithub.com/ryancnelson/patched-bash-4.30githubgithub.com/jblaine/cookbook-bash-CVE-2014-62710githubgithub.com/rrreeeyyy/cve-2014-6271-spec0githubgithub.com/justzx2011/bash-up0githubgithub.com/mattclegg/CVE-2014-62710githubgithub.com/ilismal/Nessus_CVE-2014-6271_check0githubgithub.com/woltage/CVE-2014-62710githubgithub.com/ariarijp/vagrant-shellshock0githubgithub.com/dlitz/bash-cve-2014-6271-fixes0githubgithub.com/u20024804/bash-3.2-fixed-CVE-2014-62710githubgithub.com/u20024804/bash-4.2-fixed-CVE-2014-62710githubgithub.com/u20024804/bash-4.3-fixed-CVE-2014-62710githubgithub.com/352926/shellshock_crawler0githubgithub.com/kelleykong/cve-2014-6271-mengjia-kong0githubgithub.com/huanlu/cve-2014-6271-huan-lu0githubgithub.com/Dilith006/CVE-2014-62710githubgithub.com/cyberharsh/Shellbash-CVE-2014-62710githubgithub.com/MuirlandOracle/CVE-2014-6271-IPFire0githubgithub.com/HevenTafese/Penetration-Testing-Walkthrough-Hacksudo-Thor0githubgithub.com/FacundoMfernandez/pentesting-obioba0githubgithub.com/R3fr4kt/Shocker-TJNULL-OSCP-0githubgithub.com/caverm/Shellshock_CVE-2014-62710githubgithub.com/villadora/CVE-2014-62710githubgithub.com/teedeedubya/bash-fix-exploit0githubgithub.com/internero/debian-lenny-bash_3.2.52-cve-2014-62710githubgithub.com/renanvicente/puppet-shellshock0githubgithub.com/Pilou-Pilou/docker_CVE-2014-6271.0githubgithub.com/heikipikker/shellshock-shell0githubgithub.com/kowshik-sundararajan/CVE-2014-62710githubgithub.com/w4fz5uck5/ShockZaum-CVE-2014-62710githubgithub.com/Aruthw/CVE-2014-62710githubgithub.com/cved-sources/cve-2014-62710githubgithub.com/shawntns/exploit-CVE-2014-62710githubgithub.com/Sindadziy/cve-2014-62710githubgithub.com/wenyu1999/bash-shellshock0githubgithub.com/Sindayifu/CVE-2019-14287-CVE-2014-62710githubgithub.com/rashmikadileeshara/CVE-2014-6271-Shellshock-0githubgithub.com/anujbhan/shellshock-victim-host0githubgithub.com/FilipStudeny/-CVE-2014-6271-Shellshock-Remote-Command-Injection-0githubgithub.com/mritunjay-k/CVE-2014-62710githubgithub.com/Brandaoo/CVE-2014-62710githubgithub.com/hanmin0512/CVE-2014-6271_pwnable0githubgithub.com/AlissonFaoli/Shellshock0githubgithub.com/ajansha/shellshock0githubgithub.com/YunchoHang/CVE-2014-6271-SHELLSHOCK0githubgithub.com/moften/CVE-2014-62710githubgithub.com/knightc0de/Shellshock_vuln_Exploit0githubgithub.com/rsherstnev/CVE-2014-62710githubgithub.com/RAJMadhusankha/Shellshock-CVE-2014-6271-Exploitation-and-Analysis0githubgithub.com/DrHaitham/CVE-2014-6271-Shellshock-0githubgithub.com/mtaha-sec/bash-apocalypse0githubgithub.com/andres101c/Shellshock-CVE-2014-62710githubgithub.com/Industri4l-H3ll-Xpl0it3rs/CVE-2014-6271-Shellshock0githubgithub.com/0xBlackash/CVE-2014-62710vulncheckvulncheck.com/xdb/9a279bc7adaaunverifiedvulncheckvulncheck.com/xdb/e150360b38d0unverifiedvulncheckvulncheck.com/xdb/7de685550961unverifiedvulncheckvulncheck.com/xdb/7deee0fd9deeunverifiedvulncheckvulncheck.com/xdb/06510b11bc7funverifiedvulncheckvulncheck.com/xdb/ea6ebbb2e818unverifiedvulncheckvulncheck.com/xdb/a6a6593727f9unverifiedvulncheckvulncheck.com/xdb/38bec3f859fbunverifiedvulncheckvulncheck.com/xdb/bb5d1b3fecc3unverifiedvulncheckvulncheck.com/xdb/0c87a5624456unverifiedvulncheckvulncheck.com/xdb/5df8e24bf0a1unverifiedvulncheckvulncheck.com/xdb/4d2e86dbfb5eunverifiedvulncheckvulncheck.com/xdb/b6fa067a48a7unverifiedvulncheckvulncheck.com/xdb/576415daacbaunverifiedvulncheckvulncheck.com/xdb/bf54ee1b08d5unverifiedvulncheckvulncheck.com/xdb/819c1fcf3fa1unverifiedvulncheckvulncheck.com/xdb/1b466fc06fc0unverifiedvulncheckvulncheck.com/xdb/177e5ecfe706unverifiedvulncheckvulncheck.com/xdb/b4b5de984e30unverifiedvulncheckvulncheck.com/xdb/e8cd174acc84unverifiedvulncheckvulncheck.com/xdb/fbb4b4bb3cedunverifiedvulncheckvulncheck.com/xdb/990c93705921unverifiedvulncheckvulncheck.com/xdb/95ad8f7d9c11unverifiedvulncheckvulncheck.com/xdb/04807f4a086eunverifiedvulncheckvulncheck.com/xdb/9c92078dc7f6unverifiedvulncheckvulncheck.com/xdb/f04bc714ad93unverifiedvulncheckvulncheck.com/xdb/3af8913bb29eunverifiedvulncheckvulncheck.com/xdb/91302a8a527cunverifiedvulncheckvulncheck.com/xdb/e57812c06cafunverifiedvulncheckvulncheck.com/xdb/18c86f55b23dunverifiedvulncheckvulncheck.com/xdb/462fc384771eunverifiedvulncheckvulncheck.com/xdb/fa1741b5fe55unverifiedvulncheckvulncheck.com/xdb/137b7b5051c2unverifiedvulncheckvulncheck.com/xdb/7f347ea4e4c6unverifiedvulncheckvulncheck.com/xdb/4b6744519444unverifiedvulncheckvulncheck.com/xdb/2ffa4dfd961aunverifiedvulncheckvulncheck.com/xdb/b572ab83cdb5unverifiedvulncheckvulncheck.com/xdb/8d2b021f02a5unverifiedvulncheckvulncheck.com/xdb/9550fc6e89edunverifiedvulncheckvulncheck.com/xdb/1b15435d492funverifiedvulncheckvulncheck.com/xdb/6af12f28ca11unverifiedvulncheckvulncheck.com/xdb/87352658799bunverifiedvulncheckvulncheck.com/xdb/eb9720b691f3unverifiedvulncheckvulncheck.com/xdb/771d67861982unverifiedvulncheckvulncheck.com/xdb/ea7dfb5a79c0unverifiedvulncheckvulncheck.com/xdb/89cf85aa3c3dunverifiedvulncheckvulncheck.com/xdb/37913b9c97afunverifiedvulncheckvulncheck.com/xdb/8cb6b0e4bfd9unverifiedvulncheckvulncheck.com/xdb/a69624ba8529unverifiedvulncheckvulncheck.com/xdb/1d5c31767173unverifiedvulncheckvulncheck.com/xdb/daaa4adc42e7unverifiedvulncheckvulncheck.com/xdb/e8c47c4cdbc6unverifiedvulncheckvulncheck.com/xdb/fc729b077d75unverifiedvulncheckvulncheck.com/xdb/9267e8f27a58unverifiedvulncheckvulncheck.com/xdb/26a44b1809c1unverifiedvulncheckvulncheck.com/xdb/a4dc40b36d10unverifiedcve_referencepacketstormsecurity.com/files/128517/VMware-Security-Advisory-2014-0010.htmlunverifiedcve_referencepacketstormsecurity.com/files/128567/CA-Technologies-GNU-Bash-Shellshock.htmlunverifiedcve_referencepacketstormsecurity.com/files/128573/Apache-mod_cgi-Remote-Command-Execution.htmlunverifiedcve_referencepacketstormsecurity.com/files/137376/IPFire-Bash-Environment-Variable-Injection-Shellshock.htmlunverifiedcve_referencepacketstormsecurity.com/files/161107/SonicWall-SSL-VPN-Shellshock-Remote-Code-Execution.htmlunverifiedcve_referencewww.exploit-db.com/exploits/34879/unverifiedcve_referencewww.exploit-db.com/exploits/37816/unverifiedcve_referencewww.exploit-db.com/exploits/38849/unverifiedcve_referencewww.exploit-db.com/exploits/39918/unverifiedcve_referencewww.exploit-db.com/exploits/40619/unverifiedcve_referencewww.exploit-db.com/exploits/40938/unverifiedcve_referencewww.exploit-db.com/exploits/42938/unverifiedvulncheckvulncheck.com/xdb/6eefe54f4c54unverifiedvulncheckvulncheck.com/xdb/909ab6e757c3unverified
⚠ Public resources, to assess the exposure of systems you control or are authorized to test. Test only with authorization.