permissions := strconv.Atoi(os.Getenv("filePermissions"));
fMode := os.FileMode(permissions)
os.chmod(filePath, fMode);
...
String permissionMask = System.getProperty("defaultFileMask");
Path filePath = userFile.toPath();
...
Set<PosixFilePermission> perms = PosixFilePermissions.fromString(permissionMask);
Files.setPosixFilePermissions(filePath, perms);
...
$rName = $_GET['publicReport'];
chmod("/home/". authenticateUser . "/public_html/" . rName,"0755");
...
publicReport
, como "../../localuser/public_html/.htpasswd
", o aplicativo tornará o arquivo especificado como legível para o invasor.
...
$mask = $CONFIG_TXT['perms'];
chmod($filename,$mask);
...
permissions = os.getenv("filePermissions");
os.chmod(filePath, permissions);
...
...
rName = req['publicReport']
File.chmod("/home/#{authenticatedUser}/public_html/#{rName}", "0755")
...
publicReport
, como "../../localuser/public_html/.htpasswd
", o aplicativo tornará o arquivo especificado como legível para o invasor.
...
mask = config_params['perms']
File.chmod(filename, mask)
...
...
HttpRequest req = new HttpRequest();
req.setEndpoint('http://example.com');
HTTPResponse res = new Http().send(req);
...
HttpResponse
de entrada, res
, pode ter sido comprometida, pois ela é entregue através de um canal não criptografado e não autenticado.
var account = new CloudStorageAccount(storageCredentials, false);
...
String url = 'http://10.0.2.2:11005/v1/key';
Response response = await get(url, headers: headers);
...
response
, pode ter sido comprometida, pois ela é entregue por meio de um canal não criptografado e não autenticado.
helloHandler := func(w http.ResponseWriter, req *http.Request) {
io.WriteString(w, "Hello, world!\n")
}
http.HandleFunc("/hello", helloHandler)
log.Fatal(http.ListenAndServe(":8080", nil))
URL url = new URL("http://www.android.com/");
HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
try {
InputStream in = new BufferedInputStream(urlConnection.getInputStream());
readStream(in);
...
}
instream
, pode ter sido comprometido, pois ele é entregue através de um canal não criptografado e não autenticado.
var http = require('http');
...
http.request(options, function(res){
...
});
...
http.IncomingMessage
, res
, pode ter sido comprometido, uma vez que é entregue por meio de um canal não criptografado e não autenticado.
NSString * const USER_URL = @"http://localhost:8080/igoat/user";
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:USER_URL]];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
...
stream_socket_enable_crypto($fp, false);
...
require 'net/http'
conn = Net::HTTP.new(URI("http://www.website.com/"))
in = conn.get('/index.html')
...
in
, pode ter sido comprometido, pois ele é entregue através de um canal não criptografado e não autenticado.
val url = Uri.from(scheme = "http", host = "192.0.2.16", port = 80, path = "/")
val responseFuture: Future[HttpResponse] = Http().singleRequest(HttpRequest(uri = url))
responseFuture
, pode ter sido comprometida, pois ela é entregue através de um canal não criptografado e não autenticado.
let USER_URL = "http://localhost:8080/igoat/user"
let request : NSMutableURLRequest = NSMutableURLRequest(URL:NSURL(string:USER_URL))
let conn : NSURLConnection = NSURLConnection(request:request, delegate:self)
Config.PreferServerCipherSuites
controla se o servidor segue a preferência de conjunto de criptografia do cliente ou do servidor. O uso do conjunto de criptografia de preferência do cliente poderá introduzir vulnerabilidades de segurança, caso ele possua problemas conhecidos.PreferServerCipherSuites
como false
.
conf := &tls.Config{
PreferServerCipherSuites: false,
}
client = SSHClient()
algorithms_to_disable = { "ciphers": untrusted_user_input }
client.connect(host, port, "user", "password", disabled_algorithms=algorithms_to_disable)
SSHClient.connect(...)
a usar o algoritmo mais fraco 3DES-CBC.
...
Using(SqlConnection DBconn = new SqlConnection("Data Source=210.10.20.10,1433; Initial Catalog=myDataBase;User ID=myUsername;Password=myPassword;"))
{
...
}
...
...
insecure_config = {
'user': username,
'password': retrievedPassword,
'host': databaseHost,
'port': "3306",
'ssl_disabled': True
}
mysql.connector.connect(**insecure_config)
...
NSURLSession
, NSURLConnection
ou CFURL
no iOS 9 ou OS X El Capitan, que forçam o aplicativo a usar HTTPS
com TLS 1.2
para todas as comunicações de rede com o servidor back-end.Info.plist
irão desativar totalmente o App Transport Security:Exemplo 2: As seguintes entradas no aplicativo
<key>NSAppTransportSecurity</key>
<dict>
<!--Include to allow all connections (DANGER)-->
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
Info.plist
irão desativar o App Transport Security para yourserver.com
:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>yourserver.com</key>
<dict>
<!--Include to allow subdomains-->
<key>NSIncludesSubdomains</key>
<true/>
<!--Allow plain HTTP requests-->
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<!--Downgrades TLS version-->
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
<a href="http://www.example.com/index.html"/>
www.example.com
para carregar sua própria página da Web.
...
ManagedChannel channel = Grpc.newChannelBuilder("hostname", InsecureChannelCredentials.create()).build();
...
None
. Os dados enviados com configurações de credencial de canal não seguras não são confiáveis.root_certificates
será definido como None
, o valor do parâmetro private_key
será definido como None
e o valor do parâmetro certificate_chain
será definido como None
.
...
channel_creds = grpc.ssl_channel_credentials()
...
...
Server server = Grpc.newServerBuilderForPort(port, InsecureServerCredentials.create())
...
None
ou False
. Os dados enviados de e para um servidor com configurações de credenciais de servidor inseguras não são confiáveis.
...
pk_cert_chain = your_organization.securelyGetPrivateKeyCertificateChainPairs()
server_creds = grpc.ssl_server_credentials(pk_cert_chain)
...
HSTS
(HTTP Strict Transport Security), mas não aplica essa proteção a subdomínios, o que permite aos invasores roubar informações confidenciais de conexões de subdomínios realizando ataques de remoção de HTTPS.HSTS
(HTTP Strict Transport Security) é um cabeçalho de segurança que instrui o navegador a sempre se conectar a um site que retorna os cabeçalhos HSTS via SSL/TLS durante um período especificado no cabeçalho. Qualquer conexão com o servidor via HTTP é substituída automaticamente por uma conexão HTTPS, mesmo que o usuário digite uma URL com http://
na barra de URL do navegador.
<http auto-config="true">
...
<headers>
...
<hsts include-sub-domains="false" />
</headers>
</http>
HSTS
), mas falha ao aplicar essa proteção a subdomínios, permitindo aos atacantes roubar informações confidenciais das conexões de subdomínios ao realizar ataques de retirada de HTTPS.HSTS
) é um cabeçalho de segurança que instrui o navegador a sempre conectar a um site que retorne os cabeçalhos HSTS via SSL/TLS durante um período especificado no cabeçalho. Qualquer conexão ao servidor via HTTP será automaticamente substituída por uma conexão HTTPS, mesmo se o usuário digitar http://
na barra de URL do navegador.HSTS
(HTTP Strict Transport Security). Isso permite que invasores substituam conexões SSL/TLS por conexões HTTP simples e roubem informações confidenciais executando ataques de remoção de HTTPS.HSTS
(HTTP Strict Transport Security) é um cabeçalho de segurança que instrui o navegador a sempre se conectar a um site que retorna os cabeçalhos HSTS via SSL/TLS durante um período especificado no cabeçalho. Qualquer conexão com o servidor via HTTP é substituída automaticamente por uma conexão HTTPS, mesmo que o usuário digite uma URL com http://
na barra de URL do navegador.
<http auto-config="true">
...
<headers>
...
<hsts disabled="true" />
</headers>
</http>
HSTS
), o que permite que invasores substituam conexões SSL/TLS por HTTP simples e roubem informações confidenciais executando ataques de remoção de HTTPS.HSTS
) é um cabeçalho de segurança que instrui o navegador a sempre conectar a um site que retorne os cabeçalhos HSTS via SSL/TLS durante um período especificado no cabeçalho. Qualquer conexão ao servidor via HTTP será automaticamente substituída por uma conexão HTTPS, mesmo se o usuário digitar http://
na barra de URL do navegador.HSTS
), o que permite aos atacantes substituir as conexões SSL/TLS por conexões HTTP simples e roubar informações confidenciais ao realizar ataques de remoção de HTTPS.HSTS
) é um cabeçalho de segurança que instrui o navegador a sempre conectar a um site que retorne os cabeçalhos HSTS via SSL/TLS durante um período especificado no cabeçalho. Qualquer conexão ao servidor via HTTP será automaticamente substituída por uma conexão HTTPS, mesmo se o usuário digitar http://
na barra de URL do navegador.modp2
para inicializar um protocolo de troca de chaves Diffie-Hellman, que usa um número primo de 1024 bits:
const dh = getDiffieHellman('modp2');
dh.generateKeys();
...
HSTS
(HTTP Strict Transport Security) usando um tempo de expiração insuficiente. Isso permite que os invasores substituam as conexões HTTPS por HTTP simples e roubem informações confidenciais executando ataques de remoção de HTTPS.HSTS
(HTTP Strict Transport Security) é um cabeçalho de segurança que instrui o navegador a sempre se conectar a um site que retorna os cabeçalhos HSTS via SSL/TLS durante um período especificado no cabeçalho. Qualquer conexão com o servidor via HTTP é substituída automaticamente por uma conexão HTTPS, mesmo que o usuário digite uma URL com http://
na barra de URL do navegador.
@Override
protected void configure(HttpSecurity http) throws Exception {
http.httpStrictTransportSecurity().maxAgeInSeconds(300);
}
HSTS
) utilizando um tempo de expiração insuficiente, o que permite aos atacantes substituir as conexões HTTPS por conexões HTTP simples e roubar informações confidenciais ao realizar ataques de remoção de HTTPS.HSTS
) é um cabeçalho de segurança que instrui o navegador a sempre conectar a um site que retorne os cabeçalhos HSTS via SSL/TLS durante um período especificado no cabeçalho. Qualquer conexão ao servidor via HTTP será automaticamente substituída por uma conexão HTTPS, mesmo se o usuário digitar http://
na barra de URL do navegador.SmtpClient
está configurado incorretamente, sem usar SSL/TLS para se comunicar com um servidor SMTP:
string to = "bob@acme.com";
string from = "alice@acme.com";
MailMessage message = new MailMessage(from, to);
message.Subject = "SMTP client.";
message.Body = @"Envie com facilidade uma mensagem de e-mail por um aplicativo.";
SmtpClient client = new SmtpClient("smtp.acme.com");
client.UseDefaultCredentials = true;
client.Send(message);
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="smtp.acme.com" />
<property name="port" value="25" />
<property name="javaMailProperties">
<props>
<prop key="mail.smtp.auth">true</prop>
</props>
</property>
</bean>
session = smtplib.SMTP(smtp_server, smtp_port)
session.ehlo()
session.login(username, password)
session.sendmail(frm, to, content)
device.createInsecureRfcommSocketToServiceRecord(MY_UUID);
...
var options = {
port: 443,
path: '/',
key : fs.readFileSync('my-server-key.pem'),
cert : fs.readFileSync('server-cert.pem'),
...
}
https.createServer(options);
...
secureProtocol
como SSLv23_method
, o servidor será inerentemente inseguro quando secureProtocol
não for especificamente substituído.
NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration ephemeralSessionConfiguration];
[configuration setTLSMinimumSupportedProtocol = kSSLProtocol3];
NSURLSession *mySession = [NSURLSession sessionWithConfiguration:configuration delegate:self delegateQueue:operationQueue];
let configuration : NSURLSessionConfiguration = NSURLSessionConfiguration.defaultSessionConfiguration()
let mySession = NSURLSession(configuration: configuration, delegate: self, delegateQueue: operationQueue)
...
encryptionKey = "".
...
...
var encryptionKey:String = "";
var key:ByteArray = Hex.toArray(Hex.fromString(encryptionKey));
...
var aes.ICipher = Crypto.getCipher("aes-cbc", key, padding);
...
...
char encryptionKey[] = "";
...
...
<cfset encryptionKey = "" />
<cfset encryptedMsg = encrypt(msg, encryptionKey, 'AES', 'Hex') />
...
...
key := []byte("");
block, err := aes.NewCipher(key)
...
...
private static String encryptionKey = "";
byte[] keyBytes = encryptionKey.getBytes();
SecretKeySpec key = new SecretKeySpec(keyBytes, "AES");
Cipher encryptCipher = Cipher.getInstance("AES");
encryptCipher.init(Cipher.ENCRYPT_MODE, key);
...
...
var crypto = require('crypto');
var encryptionKey = "";
var algorithm = 'aes-256-ctr';
var cipher = crypto.createCipher(algorithm, encryptionKey);
...
...
CCCrypt(kCCEncrypt,
kCCAlgorithmAES,
kCCOptionPKCS7Padding,
"",
0,
iv,
plaintext,
sizeof(plaintext),
ciphertext,
sizeof(ciphertext),
&numBytesEncrypted);
...
...
$encryption_key = '';
$filter = new Zend_Filter_Encrypt($encryption_key);
$filter->setVector('myIV');
$encrypted = $filter->filter('text_to_be_encrypted');
print $encrypted;
...
...
from Crypto.Ciphers import AES
cipher = AES.new("", AES.MODE_CFB, iv)
msg = iv + cipher.encrypt(b'Attack at dawn')
...
require 'openssl'
...
dk = OpenSSL::PKCS5::pbkdf2_hmac_sha1(password, salt, 100000, 0) # returns an empty string
...
...
CCCrypt(UInt32(kCCEncrypt),
UInt32(kCCAlgorithmAES128),
UInt32(kCCOptionPKCS7Padding),
"",
0,
iv,
plaintext,
plaintext.length,
ciphertext.mutableBytes,
ciphertext.length,
&numBytesEncrypted)
...
...
Dim encryptionKey As String
Set encryptionKey = ""
Dim AES As New System.Security.Cryptography.RijndaelManaged
On Error GoTo ErrorHandler
AES.Key = System.Text.Encoding.ASCII.GetBytes(encryptionKey)
...
Exit Sub
...
...
DATA: lo_hmac TYPE Ref To cl_abap_hmac,
Input_string type string.
CALL METHOD cl_abap_hmac=>get_instance
EXPORTING
if_algorithm = 'SHA3'
if_key = space
RECEIVING
ro_object = lo_hmac.
" update HMAC with input
lo_hmac->update( if_data = input_string ).
" finalise hmac
lo_digest->final( ).
...
Example 1
pode ser executado com êxito, mas qualquer usuário que tiver acesso a ele será capaz de descobrir que ele utiliza uma chave HMAC vazia. Depois que o programa é distribuído, provavelmente não há forma de alterar a chave HMAC vazia, a não ser que um patch seja aplicado ao programa. Um funcionário desonesto com acesso a essas informações poderia usá-las para comprometer a função HMAC. Além disso, o código no Example 1
é vulnerável a ataques de falsificação e recuperação de chave.
...
using (HMAC hmac = HMAC.Create("HMACSHA512"))
{
string hmacKey = "";
byte[] keyBytes = Encoding.ASCII.GetBytes(hmacKey);
hmac.Key = keyBytes;
...
}
...
Example 1
pode ser executado com êxito, mas qualquer usuário que tiver acesso a ele será capaz de descobrir que ele utiliza uma chave HMAC vazia. Depois que o programa é distribuído, provavelmente não há forma de alterar a chave HMAC vazia, a não ser que um patch seja aplicado ao programa. Um funcionário desonesto com acesso a essas informações poderia usá-las para comprometer a função HMAC. Além disso, o código no Example 1
é vulnerável a ataques de falsificação e recuperação de chave.
import "crypto/hmac"
...
hmac.New(md5.New, []byte(""))
...
Example 1
pode ser executado com êxito, mas qualquer usuário que tiver acesso a ele pode descobrir que ele utiliza uma chave HMAC vazia. Depois que o programa é distribuído, não há forma de alterar a chave HMAC vazia, a não ser que um patch seja aplicado ao programa. Um funcionário desonesto com acesso a essas informações poderia usá-las para comprometer a função HMAC. Além disso, o código no Example 1
é vulnerável a ataques de falsificação e recuperação de chave.
...
private static String hmacKey = "";
byte[] keyBytes = hmacKey.getBytes();
...
SecretKeySpec key = new SecretKeySpec(keyBytes, "SHA1");
Mac hmac = Mac.getInstance("HmacSHA1");
hmac.init(key);
...
Example 1
pode ser executado com êxito, mas qualquer usuário que tiver acesso a ele será capaz de descobrir que ele utiliza uma chave HMAC vazia. Depois que o programa é distribuído, provavelmente não há forma de alterar a chave HMAC vazia, a não ser que um patch seja aplicado ao programa. Um funcionário desonesto com acesso a essas informações poderia usá-las para comprometer a função HMAC. Além disso, o código no Example 1
é vulnerável a ataques de falsificação e recuperação de chave.
...
let hmacKey = "";
let hmac = crypto.createHmac("SHA256", hmacKey);
hmac.update(data);
...
Exemplo 1
pode ser executado com êxito, mas qualquer usuário com acesso a ele poderá descobrir que ele utiliza uma chave HMAC vazia. Depois que o programa é distribuído, provavelmente não há forma de alterar a chave HMAC vazia, a não ser que um patch seja aplicado ao programa. Um funcionário desonesto com acesso a essas informações poderia usá-las para comprometer a função HMAC.
...
CCHmac(kCCHmacAlgSHA256, "", 0, plaintext, plaintextLen, &output);
...
Example 1
pode ser executado com êxito, mas qualquer usuário que tiver acesso a ele será capaz de descobrir que ele utiliza uma chave HMAC vazia. Depois que o programa é distribuído, provavelmente não há forma de alterar a chave HMAC vazia, a não ser que um patch seja aplicado ao programa. Um funcionário desonesto com acesso a essas informações poderia usá-las para comprometer a função HMAC. Além disso, o código no Example 1
é vulnerável a ataques de falsificação e recuperação de chave.
import hmac
...
mac = hmac.new("", plaintext).hexdigest()
...
Example 1
pode ser executado com êxito, mas qualquer usuário que tiver acesso a ele será capaz de descobrir que ele utiliza uma chave HMAC vazia. Depois que o programa é distribuído, provavelmente não há forma de alterar a chave HMAC vazia, a não ser que um patch seja aplicado ao programa. Um funcionário desonesto com acesso a essas informações poderia usá-las para comprometer a função HMAC. Além disso, o código no Example 1
é vulnerável a ataques de falsificação e recuperação de chave.
...
digest = OpenSSL::HMAC.digest('sha256', '', data)
...
Example 1
pode ser executado com êxito, mas qualquer usuário que tiver acesso a ele será capaz de descobrir que ele utiliza uma chave HMAC vazia. Depois que o programa é distribuído, provavelmente não há forma de alterar a chave HMAC vazia, a não ser que um patch seja aplicado ao programa. Um funcionário desonesto com acesso a essas informações poderia usá-las para comprometer a função HMAC. Além disso, o código no Example 1
é vulnerável a ataques de falsificação e recuperação de chave.
...
CCHmac(UInt32(kCCHmacAlgSHA256), "", 0, plaintext, plaintextLen, &output)
...
Example 1
pode ser executado com êxito, mas qualquer usuário que tiver acesso a ele será capaz de descobrir que ele utiliza uma chave HMAC vazia. Depois que o programa é distribuído, provavelmente não há forma de alterar a chave HMAC vazia, a não ser que um patch seja aplicado ao programa. Um funcionário desonesto com acesso a essas informações poderia usá-las para comprometer a função HMAC. Além disso, o código no Example 1
é vulnerável a ataques de falsificação e recuperação de chave.
...
Rfc2898DeriveBytes rdb = new Rfc2898DeriveBytes("", salt,100000);
...
...
var encryptor = new StrongPasswordEncryptor();
var encryptedPassword = encryptor.encryptPassword("");
...
const pbkdfPassword = "";
crypto.pbkdf2(
pbkdfPassword,
salt,
numIterations,
keyLen,
hashAlg,
function (err, derivedKey) { ... }
)
...
CCKeyDerivationPBKDF(kCCPBKDF2,
"",
0,
salt,
saltLen
kCCPRFHmacAlgSHA256,
100000,
derivedKey,
derivedKeyLen);
...
...
CCKeyDerivationPBKDF(kCCPBKDF2,
password,
0,
salt,
saltLen
kCCPRFHmacAlgSHA256,
100000,
derivedKey,
derivedKeyLen);
...
password
contenha um valor de senha forte e gerenciado de maneira adequada, passar o tamanho como zero resultará em um valor vazio, null
, ou em um valor de senha inesperadamente fraco.
...
$zip = new ZipArchive();
$zip->open("test.zip", ZipArchive::CREATE);
$zip->setEncryptionIndex(0, ZipArchive::EM_AES_256, "");
...
from hashlib import pbkdf2_hmac
...
dk = pbkdf2_hmac('sha256', '', salt, 100000)
...
...
key = OpenSSL::PKCS5::pbkdf2_hmac('', salt, 100000, 256, 'SHA256')
...
...
CCKeyDerivationPBKDF(CCPBKDFAlgorithm(kCCPBKDF2),
"",
0,
salt,
saltLen,
CCPseudoRandomAlgorithm(kCCPRFHmacAlgSHA256),
100000,
derivedKey,
derivedKeyLen)
...
...
CCKeyDerivationPBKDF(CCPBKDFAlgorithm(kCCPBKDF2),
password,
0,
salt,
saltLen,
CCPseudoRandomAlgorithm(kCCPRFHmacAlgSHA256),
100000,
derivedKey,
derivedKeyLen)
...
password
contenha um valor de senha forte e gerenciado de maneira adequada, passar o tamanho como zero resultará em um valor vazio, null
, ou em um valor de senha inesperadamente fraco.