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");
...
../../localuser/public_html/.htpasswd
" 등과 같이 publicReport
에 대해 악성 값을 제공할 경우, 응용 프로그램은 지정된 파일을 공격자가 읽을 수 있게 합니다.
...
$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")
...
../../localuser/public_html/.htpasswd
" 등과 같이 publicReport
에 대해 악성 값을 제공할 경우, 응용 프로그램은 지정된 파일을 공격자가 읽을 수 있게 합니다.
...
mask = config_params['perms']
File.chmod(filename, mask)
...
sprintf()
, FormatMessageW()
또는 syslog()
와 같은 함수에 format string 인수로서 전달됩니다.snprintf()
를 사용하여 명령줄 인수를 버퍼에 복사합니다.
int main(int argc, char **argv){
char buf[128];
...
snprintf(buf,128,argv[1]);
}
%x
)를 제공하여 스택의 내용을 읽을 수 있습니다. (이 예제에서는 함수가 서식 지정할 인수를 받지 않습니다.) 공격자는 %n
서식 지정자를 사용하여 스택에 쓸 수 있으므로(의도한 동작인 인수에서 값을 읽는 대신) snprintf()
가 지정한 인수에 지금까지 출력한 바이트 수를 쓰도록 합니다. 이 공격의 정교한 버전은 네 가지 서식 지정자(staggered write)를 사용하여 스택의 포인터 값을 완전히 제어합니다.
printf("%d %d %1$d %1$d\n", 5, 9);
5 9 5 5
Example 1
에서 언급한 것과 같이 네 개의 서식 지정자를 사용하는 것보다 공격을 수행하는 것이 훨씬 간단해집니다.syslog()
함수는 다음과 같이 사용됩니다.
...
syslog(LOG_ERR, cmdBuf);
...
syslog()
의 두 번째 매개 변수가 format string이기 때문에 cmdBuf
에 포함된 서식 지정자는 Example 1
에서 설명한 방식으로 해석됩니다.syslog()
사용 예를 보여줍니다.
...
syslog(LOG_ERR, "%s", cmdBuf);
...
sprintf()
, FormatMessageW()
, syslog()
, NSLog
또는 NSString.stringWithFormat
과 같은 함수에 format string 인수로서 전달됩니다.NSString.stringWithFormat:
의 format string으로 명령줄 인수를 활용합니다.
int main(int argc, char **argv){
char buf[128];
...
[NSString stringWithFormat:argv[1], argv[2] ];
}
%x
)를 제공하여 스택의 내용을 읽을 수 있습니다. (이 예제에서는 함수가 서식 지정할 인수를 받지 않습니다.)
printf("%d %d %1$d %1$d\n", 5, 9);
5 9 5 5
Example 1
에서 언급한 것과 같이 네 개의 서식 지정자를 사용하는 것보다 공격을 수행하는 것이 훨씬 간단해집니다.syslog()
함수는 다음과 같이 사용됩니다.
...
syslog(LOG_ERR, cmdBuf);
...
syslog()
의 두 번째 매개 변수가 format string이기 때문에 cmdBuf
에 포함된 서식 지정자는 Example 1
에서 설명한 방식으로 해석됩니다.syslog()
사용 예를 보여줍니다.예제 4: Apple 코어 클래스는 format string 취약점을 익스플로이트하기 위한 흥미로운 방안을 제공합니다.
...
syslog(LOG_ERR, "%s", cmdBuf);
...
String.stringByAppendingFormat()
함수는 다음과 같이 사용됩니다.
...
NSString test = @"Sample Text.";
test = [test stringByAppendingFormat:[MyClass
formatInput:inputControl.text]];
...
stringByAppendingFormat()
사용 예를 보여줍니다.
...
NSString test = @"Sample Text.";
test = [test stringByAppendingFormat:@"%@", [MyClass
formatInput:inputControl.text]];
...
strncpy()
와 같은 범위 지정 함수도 잘못 사용되면 취약점을 일으킬 수 있습니다. 대부분의 buffer overflow의 원인은 메모리 조작과 데이터의 크기 또는 구성에 대한 가정 위반이 결합된 것입니다.
void wrongNumberArgs(char *s, float f, int d) {
char buf[1024];
sprintf(buf, "Wrong number of %.512s");
}
strncpy()
와 같은 범위 지정 함수도 잘못 사용되면 취약점을 일으킬 수 있습니다. 대부분의 buffer overflow의 원인은 메모리 조작과 데이터의 크기 또는 구성에 대한 가정 위반이 결합된 것입니다.%d
포맷 지정자를 사용하여 float에서 f
를 잘못 변환합니다.
void ArgTypeMismatch(float f, int d, char *s, wchar *ws) {
char buf[1024];
sprintf(buf, "Wrong type of %d", f);
...
}
...
String lang = Request.Form["lang"];
WebClient client = new WebClient();
client.BaseAddress = url;
NameValueCollection myQueryStringCollection = new NameValueCollection();
myQueryStringCollection.Add("q", lang);
client.QueryString = myQueryStringCollection;
Stream data = client.OpenRead(url);
...
en&poll_id=1
같은 lang
을 제공할 가능성을 고려하지 않았기 때문에 공격자는 마음대로 poll_id
를 변경할 수 있게 됩니다.
...
String lang = request.getParameter("lang");
GetMethod get = new GetMethod("http://www.example.com");
get.setQueryString("lang=" + lang + "&poll_id=" + poll_id);
get.execute();
...
en&poll_id=1
같은 lang
을 제공할 가능성을 고려하지 않았기 때문에 공격자는 마음대로 poll_id
를 변경할 수 있게 됩니다.
<%
...
$id = $_GET["id"];
header("Location: http://www.host.com/election.php?poll_id=" . $id);
...
%>
name=alice
를 지정했지만 name=alice&
를 더 추가했으며, 첫 번째 것을 가져오는 서버에서 이것이 사용되면 alice
로 가장하여 이 사용자의 계정에 대한 추가 정보를 획득할 수 있습니다.
...
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
에 표시된 코드는 성공적으로 실행될 수 있지만 코드에 접근할 수 있는 사용자는 빈 HMAC 키가 사용되고 있음을 알아낼 수 있습니다. 프로그램을 공개한 후에는 프로그램에 패치를 적용해야만 빈 HMAC 키를 변경할 수 있습니다. 비양심적인 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 HMAC 함수를 손상시킬 수 있습니다. 또한 Example 1
의 코드는 forgery 및 key recovery 공격에 취약합니다.
...
using (HMAC hmac = HMAC.Create("HMACSHA512"))
{
string hmacKey = "";
byte[] keyBytes = Encoding.ASCII.GetBytes(hmacKey);
hmac.Key = keyBytes;
...
}
...
Example 1
의 코드는 성공적으로 실행될 수 있지만 코드에 접근할 수 있는 사용자는 빈 HMAC 키가 사용되고 있음을 알아낼 수 있습니다. 프로그램을 공개한 후에는 프로그램에 패치를 적용해야만 빈 HMAC 키를 변경할 수 있습니다. 비양심적인 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 HMAC 함수를 손상시킬 수 있습니다. 또한 Example 1
의 코드는 forgery 및 key recovery 공격에 취약합니다.
import "crypto/hmac"
...
hmac.New(md5.New, []byte(""))
...
Example 1
의 코드는 성공적으로 실행될 수 있지만 코드에 접근할 수 있는 사용자는 빈 HMAC 키가 사용되고 있음을 확인할 수 있습니다. 프로그램을 공개한 후에는 프로그램에 패치를 적용해야만 빈 HMAC 키를 변경할 수 있습니다. 비양심적인 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 HMAC 함수를 손상시킬 수 있습니다. 또한 Example 1
의 코드는 forgery 및 key recovery 공격에 취약합니다.
...
private static String hmacKey = "";
byte[] keyBytes = hmacKey.getBytes();
...
SecretKeySpec key = new SecretKeySpec(keyBytes, "SHA1");
Mac hmac = Mac.getInstance("HmacSHA1");
hmac.init(key);
...
Example 1
의 코드는 성공적으로 실행될 수 있지만 코드에 접근할 수 있는 사용자는 빈 HMAC 키가 사용되고 있음을 알아낼 수 있습니다. 프로그램을 공개한 후에는 프로그램에 패치를 적용해야만 빈 HMAC 키를 변경할 수 있습니다. 비양심적인 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 HMAC 함수를 손상시킬 수 있습니다. 또한 Example 1
의 코드는 forgery 및 key recovery 공격에 취약합니다.
...
let hmacKey = "";
let hmac = crypto.createHmac("SHA256", hmacKey);
hmac.update(data);
...
예제 1
의 코드는 성공적으로 실행될 수 있지만 코드에 접근할 수 있는 사용자는 빈 HMAC 키가 사용되고 있음을 알아낼 수 있습니다. 프로그램을 공개한 후에는 프로그램에 패치를 적용해야만 빈 HMAC 키를 변경할 수 있습니다. 비양심적인 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 HMAC 함수를 손상시킬 수 있습니다.
...
CCHmac(kCCHmacAlgSHA256, "", 0, plaintext, plaintextLen, &output);
...
Example 1
의 코드는 성공적으로 실행될 수 있지만 코드에 접근할 수 있는 사용자는 빈 HMAC 키가 사용되고 있음을 알아낼 수 있습니다. 프로그램을 공개한 후에는 프로그램에 패치를 적용해야만 빈 HMAC 키를 변경할 수 있습니다. 비양심적인 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 HMAC 함수를 손상시킬 수 있습니다. 또한 Example 1
의 코드는 forgery 및 key recovery 공격에 취약합니다.
import hmac
...
mac = hmac.new("", plaintext).hexdigest()
...
Example 1
의 코드는 성공적으로 실행될 수 있지만 코드에 접근할 수 있는 사용자는 빈 HMAC 키가 사용되고 있음을 알아낼 수 있습니다. 프로그램을 공개한 후에는 프로그램에 패치를 적용해야만 빈 HMAC 키를 변경할 수 있습니다. 비양심적인 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 HMAC 함수를 손상시킬 수 있습니다. 또한 Example 1
의 코드는 forgery 및 key recovery 공격에 취약합니다.
...
digest = OpenSSL::HMAC.digest('sha256', '', data)
...
Example 1
의 코드는 성공적으로 실행될 수 있지만 코드에 접근할 수 있는 사용자는 빈 HMAC 키가 사용되고 있음을 알아낼 수 있습니다. 프로그램을 공개한 후에는 프로그램에 패치를 적용해야만 빈 HMAC 키를 변경할 수 있습니다. 비양심적인 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 HMAC 함수를 손상시킬 수 있습니다. 또한 Example 1
의 코드는 forgery 및 key recovery 공격에 취약합니다.
...
CCHmac(UInt32(kCCHmacAlgSHA256), "", 0, plaintext, plaintextLen, &output)
...
Example 1
의 코드는 성공적으로 실행될 수 있지만 코드에 접근할 수 있는 사용자는 빈 HMAC 키가 사용되고 있음을 알아낼 수 있습니다. 프로그램을 공개한 후에는 프로그램에 패치를 적용해야만 빈 HMAC 키를 변경할 수 있습니다. 비양심적인 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 HMAC 함수를 손상시킬 수 있습니다. 또한 Example 1
의 코드는 forgery 및 key recovery 공격에 취약합니다.
...
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
에 적절히 관리되는 강력한 암호 값이 포함되어 있더라도 해당 길이를 0으로 전달하여 값이 비거나, null
이거나, 예기치 않게 약한 암호 값을 생성하게 됩니다.
...
$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
에 적절히 관리되는 강력한 암호 값이 포함되어 있더라도 해당 길이를 0으로 전달하여 값이 비거나, null
이거나, 예기치 않게 약한 암호 값을 생성하게 됩니다.
...
encryptionKey = "lakdsljkalkjlksdfkl".
...
...
var encryptionKey:String = "lakdsljkalkjlksdfkl";
var key:ByteArray = Hex.toArray(Hex.fromString(encryptionKey));
...
var aes.ICipher = Crypto.getCipher("aes-cbc", key, padding);
...
...
Blob encKey = Blob.valueOf('YELLOW_SUBMARINE');
Blob encrypted = Crypto.encrypt('AES128', encKey, iv, input);
...
...
using (SymmetricAlgorithm algorithm = SymmetricAlgorithm.Create("AES"))
{
string encryptionKey = "lakdsljkalkjlksdfkl";
byte[] keyBytes = Encoding.ASCII.GetBytes(encryptionKey);
algorithm.Key = keyBytes;
...
}
...
char encryptionKey[] = "lakdsljkalkjlksdfkl";
...
...
<cfset encryptionKey = "lakdsljkalkjlksdfkl" />
<cfset encryptedMsg = encrypt(msg, encryptionKey, 'AES', 'Hex') />
...
...
key := []byte("lakdsljkalkjlksd");
block, err := aes.NewCipher(key)
...
...
private static final String encryptionKey = "lakdsljkalkjlksdfkl";
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 = "lakdsljkalkjlksdfkl";
var algorithm = 'aes-256-ctr';
var cipher = crypto.createCipher(algorithm, encryptionKey);
...
...
{
"username":"scott"
"password":"tiger"
}
...
...
NSString encryptionKey = "lakdsljkalkjlksdfkl";
...
...
$encryption_key = 'hardcoded_encryption_key';
//$filter = new Zend_Filter_Encrypt('hardcoded_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
encryption_key = b'_hardcoded__key_'
cipher = AES.new(encryption_key, AES.MODE_CFB, iv)
msg = iv + cipher.encrypt(b'Attack at dawn')
...
_hardcoded__key_
를 변경할 수 있습니다. 비양심적인 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 시스템에서 암호화된 데이터에 침입할 수 있습니다.
require 'openssl'
...
encryption_key = 'hardcoded_encryption_key'
...
cipher = OpenSSL::Cipher::AES.new(256, 'GCM')
cipher.encrypt
...
cipher.key=encryption_key
...
예제 2: 다음 코드는 하드코드된 암호화 키를 사용하여 AES 암호화를 수행합니다.
...
let encryptionKey = "YELLOW_SUBMARINE"
...
...
CCCrypt(UInt32(kCCEncrypt),
UInt32(kCCAlgorithmAES128),
UInt32(kCCOptionPKCS7Padding),
"YELLOW_SUBMARINE",
16,
iv,
plaintext,
plaintext.length,
ciphertext.mutableBytes,
ciphertext.length,
&numBytesEncrypted)
...
...
-----BEGIN RSA PRIVATE KEY-----
MIICXwIBAAKBgQCtVacMo+w+TFOm0p8MlBWvwXtVRpF28V+o0RNPx5x/1TJTlKEl
...
DiJPJY2LNBQ7jS685mb6650JdvH8uQl6oeJ/aUmq63o2zOw=
-----END RSA PRIVATE KEY-----
...
...
Dim encryptionKey As String
Set encryptionKey = "lakdsljkalkjlksdfkl"
Dim AES As New System.Security.Cryptography.RijndaelManaged
On Error GoTo ErrorHandler
AES.Key = System.Text.Encoding.ASCII.GetBytes(encryptionKey)
...
Exit Sub
...
...
production:
secret_key_base: 0ab25e26286c4fb9f7335947994d83f19861354f19702b7bbb84e85310b287ba3cdc348f1f19c8cdc08a7c6c5ad2c20ad31ecda177d2c74aa2d48ec4a346c40e
...
...
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 = 'secret_key'
RECEIVING
ro_object = lo_hmac.
" update HMAC with input
lo_hmac->update( if_data = input_string ).
" finalise hmac
lo_digest->final( ).
...
...
using (HMAC hmac = HMAC.Create("HMACSHA512"))
{
string hmacKey = "lakdsljkalkjlksdfkl";
byte[] keyBytes = Encoding.ASCII.GetBytes(hmacKey);
hmac.Key = keyBytes;
...
}
import "crypto/hmac"
...
hmac.New(sha256.New, []byte("secret"))
...
...
private static String hmacKey = "lakdsljkalkjlksdfkl";
byte[] keyBytes = hmacKey.getBytes();
...
SecretKeySpec key = new SecretKeySpec(keyBytes, "SHA1");
Mac hmac = Mac.getInstance("HmacSHA1");
hmac.init(key);
...
const hmacKey = "a secret";
const hmac = createHmac('sha256', hmacKey);
hmac.update(data);
...
hmacKey
를 변경할 수 있습니다. 비양심적인 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 HMAC 함수를 손상시킬 수 있습니다.
...
CCHmac(kCCHmacAlgSHA256, "secret", 6, plaintext, plaintextLen, &output);
...
import hmac
...
mac = hmac.new("secret", plaintext).hexdigest()
...
...
digest = OpenSSL::HMAC.digest('sha256', 'secret_key', data)
...
...
CCHmac(UInt32(kCCHmacAlgSHA256), "secret", 6, plaintext, plaintextLen, &output)
...
...
Rfc2898DeriveBytes rdb = new Rfc2898DeriveBytes("password", salt,100000);
...
...
var encryptor = new StrongPasswordEncryptor();
var encryptedPassword = encryptor.encryptPassword("password");
...
const pbkdfPassword = "a secret";
crypto.pbkdf2(
pbkdfPassword,
salt,
numIterations,
keyLen,
hashAlg,
function (err, derivedKey) { ... }
)
...
CCKeyDerivationPBKDF(kCCPBKDF2,
"secret",
6,
salt,
saltLen
kCCPRFHmacAlgSHA256,
100000,
derivedKey,
derivedKeyLen);
...
...
$zip = new ZipArchive();
$zip->open("test.zip", ZipArchive::CREATE);
$zip->setEncryptionIndex(0, ZipArchive::EM_AES_256, "hardcodedpassword");
...
from hashlib import pbkdf2_hmac
...
dk = pbkdf2_hmac('sha256', 'password', salt, 100000)
...
...
key = OpenSSL::PKCS5::pbkdf2_hmac('password', salt, 100000, 256, 'SHA256')
...
...
CCKeyDerivationPBKDF(CCPBKDFAlgorithm(kCCPBKDF2),
"secret",
6,
salt,
saltLen,
CCPseudoRandomAlgorithm(kCCPRFHmacAlgSHA256),
100000,
derivedKey,
derivedKeyLen)
...
Null
암호화 키는 쉽게 해결할 수 없는 방식으로 보안을 침해할 수 있습니다.null
암호화 키를 사용하면 양호한 암호화 알고리즘을 통해 제공되는 보호 수준이 크게 감소할 뿐 아니라 문제 해결도 극도로 어렵게 만들기 때문에 좋은 방법이 아닙니다. 잘못된 코드가 운영 단계에 들어간 후 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. null
암호화 키로 보호되는 계정이 침해되면 시스템 소유자는 보안과 가용성 중 한 가지를 선택해야 합니다.null
암호화 키를 사용하여 AES 암호화를 수행합니다.
...
var encryptionKey:ByteArray = null;
...
var aes.ICipher = Crypto.getCipher("aes-cbc", encryptionKey, padding);
...
null
암호화 키가 사용되고 있음을 알 수 있을 뿐 아니라 기본적인 크랙 기법이라도 사용할 수 있는 사람이라면 누구나 암호화된 데이터를 성공적으로 해독할 가능성이 매우 높습니다. 응용 프로그램을 공개한 후에는 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 시스템에 침입할 수 있습니다. 공격자가 응용 프로그램의 실행 파일에만 접근할 수 있더라도 null
암호화 키의 사용 증거를 추출할 수 있습니다.Null
암호화 키는 쉽게 해결할 수 없는 방식으로 보안을 침해할 수 있습니다.null
암호화 키를 사용하는 것은 좋은 방법이 아닙니다. null
암호화 키를 사용하면 양호한 암호화 알고리즘을 통해 제공되는 보호 수준이 크게 감소할 뿐 아니라 문제 해결도 극도로 어려워집니다. 잘못된 코드가 운영 단계에 들어간 후 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. null
암호화 키로 보호되는 계정이 침해되면 시스템 소유자는 보안과 가용성 중 한 가지를 선택해야 합니다.null
암호화 키를 사용합니다.
...
char encryptionKey[] = null;
...
null
암호화 키가 사용되고 있음을 알 수 있을 뿐 아니라 기본적인 크랙 기법이라도 사용할 수 있는 사람이라면 누구나 암호화된 데이터를 성공적으로 해독할 가능성이 매우 높습니다. 프로그램을 공개한 후에는 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 시스템에 침입할 수 있습니다. 공격자가 응용 프로그램의 실행 파일에만 접근할 수 있더라도 null
암호화 키의 사용 증거를 추출할 수 있습니다.null
암호화 키를 사용하면 양호한 암호화 알고리즘을 통해 제공되는 보호 수준이 크게 감소할 뿐 아니라 문제 해결도 극도로 어렵게 만들기 때문에 좋은 방법이 아닙니다. 잘못된 코드가 운영 단계에 들어간 후 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. null
암호화 키로 보호되는 계정이 침해되면 시스템 소유자는 보안과 가용성 중 한 가지를 선택해야 합니다.null
암호화 키를 사용하여 AES 암호화를 수행합니다.
...
aes.NewCipher(nil)
...
null
암호화 키가 사용되고 있음을 확인할 수 있습니다. 또한 기본적인 크랙 기법이라도 사용할 수 있는 사용자는 암호화된 데이터를 성공적으로 해독할 가능성이 매우 높습니다. 응용 프로그램을 공개한 후에는 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 시스템에 침입할 수 있습니다. 공격자가 응용 프로그램의 실행 파일에만 접근할 수 있더라도 null
암호화 키의 사용 증거를 추출할 수 있습니다.null
암호화 키를 사용하면 양호한 암호화 알고리즘을 통해 제공되는 보호 수준이 크게 감소할 뿐 아니라 문제 해결도 극도로 어렵게 만들기 때문에 좋은 방법이 아닙니다. 잘못된 코드가 운영 단계에 들어간 후 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. null
암호화 키로 보호되는 계정이 침해되면 시스템 소유자는 보안과 가용성 중 한 가지를 선택해야 합니다.null
암호화 키를 사용하여 AES 암호화를 수행합니다.
...
SecretKeySpec key = null;
....
Cipher encryptCipher = Cipher.getInstance("AES");
encryptCipher.init(Cipher.ENCRYPT_MODE, key);
...
null
암호화 키가 사용되고 있음을 알 수 있을 뿐 아니라 기본적인 크랙 기법이라도 사용할 수 있는 사람이라면 누구나 암호화된 데이터를 성공적으로 해독할 가능성이 매우 높습니다. 응용 프로그램을 공개한 후에는 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 시스템에 침입할 수 있습니다. 공격자가 응용 프로그램의 실행 파일에만 접근할 수 있더라도 null
암호화 키의 사용 증거를 추출할 수 있습니다.null
암호화 키를 사용하면 양호한 암호화 알고리즘을 통해 제공되는 보호 수준이 크게 감소할 뿐 아니라 문제 해결도 극도로 어렵게 만들기 때문에 좋은 방법이 아닙니다. 잘못된 코드가 운영 단계에 들어간 후 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. null
암호화 키로 보호되는 계정이 침해되면 시스템 소유자는 보안과 가용성 중 한 가지를 선택해야 합니다.null
암호화 키를 사용하여 AES 암호화를 수행합니다.
...
var crypto = require('crypto');
var encryptionKey = null;
var algorithm = 'aes-256-ctr';
var cipher = crypto.createCipher(algorithm, encryptionKey);
...
null
암호화 키가 사용되고 있음을 알 수 있을 뿐 아니라 기본적인 크랙 기법이라도 사용할 수 있는 사람이라면 누구나 암호화된 데이터를 성공적으로 해독할 가능성이 매우 높습니다. 응용 프로그램을 공개한 후에는 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 시스템에 침입할 수 있습니다. 공격자가 응용 프로그램의 실행 파일에만 접근할 수 있더라도 null
암호화 키의 사용 증거를 추출할 수 있습니다.null
암호화 키를 사용하면 양호한 암호화 알고리즘을 통해 제공되는 보호 수준이 크게 감소할 뿐 아니라 문제 해결도 극도로 어렵게 만들기 때문에 좋은 방법이 아닙니다. 잘못된 코드가 운영 단계에 들어간 후 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. null
암호화 키로 보호되는 계정이 침해되면 시스템 소유자는 보안과 가용성 중 한 가지를 선택해야 합니다.null
암호화 키를 사용하여 AES 암호화를 수행합니다.
...
CCCrypt(kCCEncrypt,
kCCAlgorithmAES,
kCCOptionPKCS7Padding,
nil,
0,
iv,
plaintext,
sizeof(plaintext),
ciphertext,
sizeof(ciphertext),
&numBytesEncrypted);
...
null
암호화 키가 사용되고 있음을 알 수 있을 뿐 아니라 기본적인 크랙 기법이라도 사용할 수 있는 사람이라면 누구나 암호화된 데이터를 성공적으로 해독할 가능성이 매우 높습니다. 응용 프로그램을 공개한 후에는 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 시스템에 침입할 수 있습니다. 공격자가 응용 프로그램의 실행 파일에만 접근할 수 있더라도 null
암호화 키의 사용 증거를 추출할 수 있습니다.null
을 암호화 키 변수로 지정하는 것은 공격자에게 민감하고 암호화된 정보를 노출시킬 수 있으므로 잘못된 방법입니다. null
암호화 키를 사용하면 양호한 암호화 알고리즘을 통해 제공되는 보호 수준이 크게 감소할 뿐 아니라 문제 해결도 극도로 어려워집니다. 잘못된 코드가 운영 단계에 들어간 후 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. null
암호화 키로 보호되는 계정이 침해되면 시스템 소유자는 보안과 가용성 중 한 가지를 선택해야 합니다.null
로 초기화합니다.
...
$encryption_key = NULL;
$filter = new Zend_Filter_Encrypt($encryption_key);
$filter->setVector('myIV');
$encrypted = $filter->filter('text_to_be_encrypted');
print $encrypted;
...
null
암호화 키가 사용되고 있음을 알 수 있을 뿐 아니라 기본적인 크랙 기법이라도 사용할 수 있는 사람이는 누구든지 암호화된 데이터를 성공적으로 해독할 가능성이 매우 높습니다. 프로그램을 공개한 후에는 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 시스템에 침입할 수 있습니다. 공격자가 응용 프로그램의 실행 파일에만 접근할 수 있더라도 null
암호화 키의 사용 증거를 추출할 수 있습니다.null
암호화 키를 사용하면 양호한 암호화 알고리즘을 통해 제공되는 보호 수준이 크게 감소할 뿐 아니라 문제 해결도 극도로 어렵게 만들기 때문에 좋은 방법이 아닙니다. 잘못된 코드가 운영 단계에 들어간 후 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. null
암호화 키로 보호되는 계정이 침해되면 시스템 소유자는 보안과 가용성 중 한 가지를 선택해야 합니다.null
암호화 키가 사용되고 있음을 알 수 있을 뿐 아니라 기본적인 크랙 기법이라도 사용할 수 있는 사람이라면 누구나 암호화된 데이터를 성공적으로 해독할 가능성이 매우 높습니다. 응용 프로그램을 공개한 후에는 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 시스템에 침입할 수 있습니다. 공격자가 응용 프로그램의 실행 파일에만 접근할 수 있더라도 null
암호화 키의 사용 증거를 추출할 수 있습니다.None
을 암호화 키 변수로 지정하는 것은 공격자에게 민감하고 암호화된 정보를 노출시킬 수 있으므로 잘못된 방법입니다. null
암호화 키를 사용하면 양호한 암호화 알고리즘을 통해 제공되는 보호 수준이 크게 감소할 뿐 아니라 문제 해결도 극도로 어려워집니다. 잘못된 코드가 운영 단계에 들어간 후 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. null
암호화 키로 보호되는 계정이 침해되면 시스템 소유자는 보안과 가용성 중 한 가지를 선택해야 합니다.null
로 초기화합니다.
...
from Crypto.Ciphers import AES
cipher = AES.new(None, AES.MODE_CFB, iv)
msg = iv + cipher.encrypt(b'Attack at dawn')
...
null
암호화 키가 사용되고 있음을 알 수 있을 뿐 아니라 기본적인 크랙 기법이라도 사용할 수 있는 사람이는 누구든지 암호화된 데이터를 성공적으로 해독할 가능성이 매우 높습니다. 프로그램을 공개한 후에는 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 시스템에 침입할 수 있습니다. 공격자가 응용 프로그램의 실행 파일에만 접근할 수 있더라도 null
암호화 키의 사용 증거를 추출할 수 있습니다.null
암호화 키를 사용하는 것은 좋은 방법이 아닙니다. null
암호화 키를 사용하면 양호한 암호화 알고리즘을 통해 제공되는 보호 수준이 크게 감소할 뿐 아니라 문제 해결도 극도로 어려워집니다. 잘못된 코드가 운영 단계에 들어간 후 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. null
암호화 키로 보호되는 계정이 침해되면 시스템 소유자는 보안과 가용성 중 한 가지를 선택해야 합니다.null
암호화 키가 사용되고 있음을 알 수 있을 뿐 아니라 기본적인 크랙 기법이라도 사용할 수 있는 사람이는 누구든지 암호화된 데이터를 성공적으로 해독할 가능성이 매우 높습니다. 프로그램을 공개한 후에는 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 시스템에 침입할 수 있습니다. 공격자가 응용 프로그램의 실행 파일에만 접근할 수 있더라도 null
암호화 키의 사용 증거를 추출할 수 있습니다.Null
암호화 키는 쉽게 해결할 수 없는 방식으로 보안을 침해할 수 있습니다.null
암호화 키를 사용하는 것은 좋은 방법이 아닙니다. null
암호화 키를 사용하면 양호한 암호화 알고리즘을 통해 제공되는 보호 수준이 크게 감소할 뿐 아니라 문제 해결도 극도로 어려워집니다. 잘못된 코드가 운영 단계에 들어간 후 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. null
암호화 키로 보호되는 계정이 침해되면 시스템 소유자는 보안과 가용성 중 한 가지를 선택해야 합니다.null
암호화 키를 사용하여 AES 암호화를 수행합니다.
...
CCCrypt(UInt32(kCCEncrypt),
UInt32(kCCAlgorithmAES128),
UInt32(kCCOptionPKCS7Padding),
nil,
0,
iv,
plaintext,
plaintext.length,
ciphertext.mutableBytes,
ciphertext.length,
&numBytesEncrypted)
...
null
암호화 키가 사용되고 있음을 알 수 있을 뿐 아니라 기본적인 크랙 기법이라도 사용할 수 있는 사람이라면 누구나 암호화된 데이터를 성공적으로 해독할 가능성이 매우 높습니다. 프로그램을 공개한 후에는 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 시스템에 침입할 수 있습니다. 공격자가 응용 프로그램의 실행 파일에만 접근할 수 있더라도 null
암호화 키의 사용 증거를 추출할 수 있습니다.null
암호화 키를 사용하면 양호한 암호화 알고리즘을 통해 제공되는 보호 수준이 크게 감소할 뿐 아니라 문제 해결도 극도로 어렵게 만들기 때문에 좋은 방법이 아닙니다. 잘못된 코드가 운영 단계에 들어간 후 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. null
암호화 키로 보호되는 계정이 침해되면 시스템 소유자는 보안과 가용성 중 한 가지를 선택해야 합니다.null
암호화 키를 사용하여 AES 암호화를 수행합니다.
...
Dim encryptionKey As String
Set encryptionKey = vbNullString
Dim AES As New System.Security.Cryptography.RijndaelManaged
On Error GoTo ErrorHandler
AES.Key = System.Text.Encoding.ASCII.GetBytes(encryptionKey)
...
Exit Sub
...
null
암호화 키가 사용되고 있음을 알 수 있을 뿐 아니라 기본적인 크랙 기법이라도 사용할 수 있는 사람이라면 누구나 암호화된 데이터를 성공적으로 해독할 가능성이 매우 높습니다. 응용 프로그램을 공개한 후에는 null
암호화 키를 변경하려면 소프트웨어 패치가 필요합니다. 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 시스템에 침입할 수 있습니다. 공격자가 응용 프로그램의 실행 파일에만 접근할 수 있더라도 null
암호화 키의 사용 증거를 추출할 수 있습니다.null
암호를 기반으로 암호화 키를 생성하여 사용하면 쉽게 해결할 수 없는 방식으로 시스템 보안을 손상시킬 수 있습니다.null
값을 전달하는 것은 좋은 방법이 아닙니다. 이 경우, 결과로 파생되는 키는 제공된 솔트만을 기반으로 하게 되어 크게 약해지며 문제를 해결하기도 극도로 어렵습니다. 잘못된 코드가 운영 단계에 들어간 후에는 소프트웨어 패치 없이는 null
암호를 변경할 수 없는 경우가 많습니다. null
비밀번호를 토대로 파생된 키를 통해 보호되는 계정이 침해되면 시스템 소유자는 보안과 가용성 중 한 가지를 선택할 수밖에 없습니다.null
값을 전달합니다.
...
var encryptor = new StrongPasswordEncryptor();
var encryptedPassword = encryptor.encryptPassword(null);
...
null
암호 인수를 기반으로 하나 이상의 암호화 키가 생성된다는 것을 알아차릴 수 있을 뿐 아니라, 기본적인 크랙 기법이라도 사용할 수 있는 사용자는 누구든지 잘못된 키를 통해 보호되는 리소스에 성공적으로 접근할 수 있는 가능성이 매우 높습니다. 공격자가 null
암호를 기반으로 하는 키를 생성하는 데 사용되는 솔트 값에도 접근할 수 있는 경우 이러한 키를 크랙하는 것은 하찮은 일에 불과합니다. 프로그램을 공개한 후에는 프로그램에 패치를 적용해야만 null
암호를 변경할 수 있습니다. 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 시스템에 침입할 수 있습니다. 공격자가 응용 프로그램의 실행 파일에만 접근할 수 있더라도 null
암호의 사용 증거를 추출할 수 있습니다.null
암호를 기반으로 암호화 키를 생성하여 사용하면 쉽게 해결할 수 없는 방식으로 시스템 보안을 손상시킬 수 있습니다.null
값을 전달하는 것은 좋은 방법이 아닙니다. 이 경우, 결과로 파생되는 키는 제공된 솔트만을 기반으로 하게 되어 크게 약해지며 문제를 해결하기도 극도로 어렵습니다. 잘못된 코드가 운영 단계에 들어간 후에는 소프트웨어 패치 없이는 null
암호를 변경할 수 없는 경우가 많습니다. null
비밀번호를 토대로 파생된 키를 통해 보호되는 계정이 침해되면 시스템 소유자는 보안과 가용성 중 한 가지를 선택할 수밖에 없습니다.null
값을 전달합니다.
...
CCKeyDerivationPBKDF(kCCPBKDF2,
nil,
0,
salt,
saltLen
kCCPRFHmacAlgSHA256,
100000,
derivedKey,
derivedKeyLen);
...
null
암호 인수를 기반으로 하나 이상의 암호화 키가 생성된다는 것을 알아차릴 수 있을 뿐 아니라, 기본적인 크랙 기법이라도 사용할 수 있는 사용자는 누구든지 잘못된 키를 통해 보호되는 리소스에 성공적으로 접근할 수 있는 가능성이 매우 높습니다. 공격자가 null
암호를 기반으로 하는 키를 생성하는 데 사용되는 솔트 값에도 접근할 수 있는 경우 이러한 키를 크랙하는 것은 하찮은 일에 불과합니다. 프로그램을 공개한 후에는 프로그램에 패치를 적용해야만 null
암호를 변경할 수 있습니다. 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 시스템에 침입할 수 있습니다. 공격자가 응용 프로그램의 실행 파일에만 접근할 수 있더라도 null
암호의 사용 증거를 추출할 수 있습니다.null
암호를 기반으로 암호화 키를 생성하여 사용하면 쉽게 해결할 수 없는 방식으로 시스템 보안을 손상시킬 수 있습니다.null
값을 전달하는 것은 좋은 방법이 아닙니다. 이 경우, 결과로 파생되는 키는 제공된 솔트만을 기반으로 하게 되어 크게 약해지며 문제를 해결하기도 극도로 어렵습니다. 잘못된 코드가 운영 단계에 들어간 후에는 소프트웨어 패치 없이는 null
암호를 변경할 수 없는 경우가 많습니다. null
비밀번호를 토대로 파생된 키를 통해 보호되는 계정이 침해되면 시스템 소유자는 보안과 가용성 중 한 가지를 선택할 수밖에 없습니다.null
값을 전달합니다.
...
CCKeyDerivationPBKDF(CCPBKDFAlgorithm(kCCPBKDF2),
nil,
0,
salt,
saltLen,
CCPseudoRandomAlgorithm(kCCPRFHmacAlgSHA256),
100000,
derivedKey,
derivedKeyLen)
...
null
암호 인수를 기반으로 하나 이상의 암호화 키가 생성된다는 것을 알아차릴 수 있을 뿐 아니라, 기본적인 크랙 기법이라도 사용할 수 있는 사용자는 누구든지 잘못된 키를 통해 보호되는 리소스에 성공적으로 접근할 수 있는 가능성이 매우 높습니다. 공격자가 null
암호를 기반으로 하는 키를 생성하는 데 사용되는 솔트 값에도 접근할 수 있는 경우 이러한 키를 크랙하는 것은 하찮은 일에 불과합니다. 프로그램을 공개한 후에는 프로그램에 패치를 적용해야만 null
암호를 변경할 수 있습니다. 직원이 이 정보에 대한 접근 권한을 갖게 되면 이를 사용하여 시스템에 침입할 수 있습니다. 공격자가 응용 프로그램의 실행 파일에만 접근할 수 있더라도 null
암호의 사용 증거를 추출할 수 있습니다.
from Crypto.PublicKey import RSA
key = RSA.generate(2048)
f = open('mykey.pem','w')
f.write(key.exportKey(format='PEM'))
f.close()
require 'openssl'
key = OpenSSL::PKey::RSA.new 2048
File.open('mykey.pem', 'w') do |file|
file.write(key.to_pem)
end
chroot()
와 같은 작업을 수행하는 데 필요한 높은 수준의 권한은 작업을 수행한 직후 삭제해야 합니다.chroot()
등의 권한 있는 함수를 호출하려면 먼저 root
권한을 획득해야 합니다. 권한 있는 작업이 완료되자 마자 프로그램은 root
권한을 삭제하고 호출한 사용자의 권한 수준으로 돌아가야 합니다.chroot()
를 호출하여 응용 프로그램을 APP_HOME
밑의 파일 시스템의 부분 집합으로 제한합니다. 그런 다음 코드는 사용자가 지정한 파일을 열고 파일의 내용을 처리합니다.
...
chroot(APP_HOME);
chdir("/");
FILE* data = fopen(argv[1], "r+");
...
setuid()
를 호출하지 않으면 응용 프로그램이 계속 불필요한 root
권한으로 동작하게 됩니다. 악의적인 연산이 수퍼유저 권한으로 수행되기 때문에 공격자가 응용 프로그램에 대한 익스플로이트에 성공하면 권한 상승 공격이 일어날 수 있습니다. 응용 프로그램이 root
사용자가 아닌 권한 수준으로 떨어지면 피해 가능성이 대폭 줄어듭니다.
...
DATA log_msg TYPE bal_s_msg.
val = request->get_form_field( 'val' ).
log_msg-msgid = 'XY'.
log_msg-msgty = 'E'.
log_msg-msgno = '123'.
log_msg-msgv1 = 'VAL: '.
log_msg-msgv2 = val.
CALL FUNCTION 'BAL_LOG_MSG_ADD'
EXPORTING
I_S_MSG = log_msg
EXCEPTIONS
LOG_NOT_FOUND = 1
MSG_INCONSISTENT = 2
LOG_IS_FULL = 3
OTHERS = 4.
...
val
에 문자열 "FOO
"을 전송하면 다음 항목이 기록됩니다.
XY E 123 VAL: FOO
FOO XY E 124 VAL: BAR
" 문자열을 전송하는 경우 다음 항목이 기록됩니다.
XY E 123 VAL: FOO XY E 124 VAL: BAR
var params:Object = LoaderInfo(this.root.loaderInfo).parameters;
var val:String = String(params["username"]);
var value:Number = parseInt(val);
if (value == Number.NaN) {
trace("Failed to parse val = " + val);
}
val
에 문자열 "twenty-one
"을 전송하면 다음 항목이 기록됩니다.
Failed to parse val=twenty-one
twenty-one%0a%0aINFO:+User+logged+out%3dbadguy
" 문자열을 전송하는 경우 다음 항목이 기록됩니다.
Failed to parse val=twenty-one
User logged out=badguy
...
string val = (string)Session["val"];
try {
int value = Int32.Parse(val);
}
catch (FormatException fe) {
log.Info("Failed to parse val= " + val);
}
...
val
에 문자열 "twenty-one
"을 전송하면 다음 항목이 기록됩니다.
INFO: Failed to parse val=twenty-one
twenty-one%0a%0aINFO:+User+logged+out%3dbadguy
" 문자열을 전송하는 경우 다음 항목이 기록됩니다.
INFO: Failed to parse val=twenty-one
INFO: User logged out=badguy
long value = strtol(val, &endPtr, 10);
if (*endPtr != '\0')
syslog(LOG_INFO,"Illegal value = %s",val);
...
val
에 문자열 "twenty-one
"을 전송하면 다음 항목이 기록됩니다.
Illegal value=twenty-one
twenty-one\n\nINFO: User logged out=evil
" 문자열을 전송하는 경우 다음 항목이 기록됩니다.
INFO: Illegal value=twenty-one
INFO: User logged out=evil
...
01 LOGAREA.
05 VALHEADER PIC X(50) VALUE 'VAL: '.
05 VAL PIC X(50).
...
EXEC CICS
WEB READ
FORMFIELD(NAME)
VALUE(VAL)
...
END-EXEC.
EXEC DLI
LOG
FROM(LOGAREA)
LENGTH(50)
END-EXEC.
...
VAL
에 문자열 "FOO
"을 전송하면 다음 항목이 기록됩니다.
VAL: FOO
FOO VAL: BAR
" 문자열을 전송하는 경우 다음 항목이 기록됩니다.
VAL: FOO VAL: BAR
<cflog file="app_log" application="No" Thread="No"
text="Failed to parse val="#Form.val#">
val
에 문자열 "twenty-one
"을 전송하면 다음 항목이 기록됩니다.
"Information",,"02/28/01","14:50:37",,"Failed to parse val=twenty-one"
twenty-one%0a%0a%22Information%22%2C%2C%2202/28/01%22%2C%2214:53:40%22%2C%2C%22User%20logged%20out:%20badguy%22
" 문자열을 전송하는 경우 다음 항목이 기록됩니다.
"Information",,"02/28/01","14:50:37",,"Failed to parse val=twenty-one"
"Information",,"02/28/01","14:53:40",,"User logged out: badguy"
func someHandler(w http.ResponseWriter, r *http.Request){
r.parseForm()
name := r.FormValue("name")
logout := r.FormValue("logout")
...
if (logout){
...
} else {
log.Printf("Attempt to log out: name: %s logout: %s", name, logout)
}
}
logout
에 대해 "twenty-one
" 문자열을 제출하고 "admin
"이라는 이름을 가진 사용자를 생성할 수 있는 경우 다음 항목이 기록됩니다.
Attempt to log out: name: admin logout: twenty-one
admin+logout:+1+++++++++++++++++++++++
"라는 사용자 이름을 생성할 수 있으면 다음 항목이 기록됩니다.
Attempt to log out: name: admin logout: 1 logout: twenty-one
...
String val = request.getParameter("val");
try {
int value = Integer.parseInt(val);
}
catch (NumberFormatException nfe) {
log.info("Failed to parse val = " + val);
}
...
val
에 문자열 "twenty-one
"을 전송하면 다음 항목이 기록됩니다.
INFO: Failed to parse val=twenty-one
twenty-one%0a%0aINFO:+User+logged+out%3dbadguy
" 문자열을 전송하는 경우 다음 항목이 기록됩니다.
INFO: Failed to parse val=twenty-one
INFO: User logged out=badguy
Example 1
을 Android 플랫폼에 맞게 조정합니다.
...
String val = this.getIntent().getExtras().getString("val");
try {
int value = Integer.parseInt();
}
catch (NumberFormatException nfe) {
Log.e(TAG, "Failed to parse val = " + val);
}
...
var cp = require('child_process');
var http = require('http');
var url = require('url');
function listener(request, response){
var val = url.parse(request.url, true)['query']['val'];
if (isNaN(val)){
console.log("INFO: Failed to parse val = " + val);
}
...
}
...
http.createServer(listener).listen(8080);
...
val
에 문자열 "twenty-one
"을 전송하면 다음 항목이 기록됩니다.
INFO: Failed to parse val = twenty-one
twenty-one%0a%0aINFO:+User+logged+out%3dbadguy
" 문자열을 전송하는 경우 다음 항목이 기록됩니다.
INFO: Failed to parse val=twenty-one
INFO: User logged out=badguy
long value = strtol(val, &endPtr, 10);
if (*endPtr != '\0')
NSLog("Illegal value = %s",val);
...
val
에 문자열 "twenty-one
"을 전송하면 다음 항목이 기록됩니다.
INFO: Illegal value=twenty-one
twenty-one\n\nINFO: User logged out=evil
" 문자열을 전송하는 경우 다음 항목이 기록됩니다.
INFO: Illegal value=twenty-one
INFO: User logged out=evil
<?php
$name =$_GET['name'];
...
$logout =$_GET['logout'];
if(is_numeric($logout))
{
...
}
else
{
trigger_error("Attempt to log out: name: $name logout: $val");
}
?>
logout
에 대해 "twenty-one
" 문자열을 제출하고 "admin
"이라는 이름을 가진 사용자를 생성할 수 있는 경우 다음 항목이 기록됩니다.
PHP Notice: Attempt to log out: name: admin logout: twenty-one
admin+logout:+1+++++++++++++++++++++++
"라는 사용자 이름을 생성할 수 있으면 다음 항목이 기록됩니다.
PHP Notice: Attempt to log out: name: admin logout: 1 logout: twenty-one
name = req.field('name')
...
logout = req.field('logout')
if (logout):
...
else:
logger.error("Attempt to log out: name: %s logout: %s" % (name,logout))
logout
에 대해 "twenty-one
" 문자열을 제출하고 "admin
"이라는 이름을 가진 사용자를 생성할 수 있는 경우 다음 항목이 기록됩니다.
Attempt to log out: name: admin logout: twenty-one
admin+logout:+1+++++++++++++++++++++++
"라는 사용자 이름을 생성할 수 있으면 다음 항목이 기록됩니다.
Attempt to log out: name: admin logout: 1 logout: twenty-one
...
val = req['val']
unless val.respond_to?(:to_int)
logger.info("Failed to parse val")
logger.info(val)
end
...
val
에 문자열 "twenty-one
"을 전송하면 다음 항목이 기록됩니다.
INFO: Failed to parse val
INFO: twenty-one
twenty-one%0a%0aINFO:+User+logged+out%3dbadguy
" 문자열을 전송하는 경우 다음 항목이 기록됩니다.
INFO: Failed to parse val
INFO: twenty-one
INFO: User logged out=badguy
...
let num = Int(param)
if num == nil {
NSLog("Illegal value = %@", param)
}
...
val
에 문자열 "twenty-one
"을 전송하면 다음 항목이 기록됩니다.
INFO: Illegal value = twenty-one
twenty-one\n\nINFO: User logged out=evil
" 문자열을 전송하는 경우 다음 항목이 기록됩니다.
INFO: Illegal value=twenty-one
INFO: User logged out=evil
...
Dim Val As Variant
Dim Value As Integer
Set Val = Request.Form("val")
If IsNumeric(Val) Then
Set Value = Val
Else
App.EventLog "Failed to parse val=" & Val, 1
End If
...
val
에 문자열 "twenty-one
"을 전송하면 다음 항목이 기록됩니다.
Failed to parse val=twenty-one
twenty-one%0a%0a+User+logged+out%3dbadguy
" 문자열을 전송하는 경우 다음 항목이 기록됩니다.
Failed to parse val=twenty-one
User logged out=badguy
CREATE
명령을 만듭니다. 공격자는 이 매개 변수를 사용하여 서버로 전송되는 명령을 수정하고 CRLF 문자를 사용하여 새 명령을 삽입할 수 있습니다.
...
final String foldername = request.getParameter("folder");
IMAPFolder folder = (IMAPFolder) store.getFolder("INBOX");
...
folder.doCommand(new IMAPFolder.ProtocolCommand() {
@Override
public Object doCommand(IMAPProtocol imapProtocol) throws ProtocolException {
try {
imapProtocol.simpleCommand("CREATE " + foldername, null);
} catch (Exception e) {
// Handle Exception
}
return null;
}
});
...
USER
및 PASS
명령을 만듭니다. 공격자는 이 매개 변수를 사용하여 서버로 전송되는 명령을 수정하고 CRLF 문자를 사용하여 새 명령을 삽입할 수 있습니다.
...
String username = request.getParameter("username");
String password = request.getParameter("password");
...
POP3SClient pop3 = new POP3SClient(proto, false);
pop3.login(username, password)
...
VRFY
명령을 작성합니다. 공격자는 이 매개 변수를 사용하여 서버로 전송된 명령을 수정하고 CRLF 문자를 사용하는 새 명령을 주입할 수 있습니다.
...
c, err := smtp.Dial(x)
if err != nil {
log.Fatal(err)
}
user := request.FormValue("USER")
c.Verify(user)
...
VRFY
명령을 만듭니다. 공격자는 이 매개 변수를 사용하여 서버로 전송되는 명령을 수정하고 CRLF 문자를 사용하여 새 명령을 삽입할 수 있습니다.
...
String user = request.getParameter("user");
SMTPSSLTransport transport = new SMTPSSLTransport(session,new URLName(Utilities.getProperty("smtp.server")));
transport.connect(Utilities.getProperty("smtp.server"), username, password);
transport.simpleCommand("VRFY " + user);
...
VRFY
명령을 만듭니다. 공격자는 이 매개 변수를 사용하여 서버로 전송되는 명령을 수정하고 CRLF 문자를 사용하여 새 명령을 삽입할 수 있습니다.
...
user = request.GET['user']
session = smtplib.SMTP(smtp_server, smtp_tls_port)
session.ehlo()
session.starttls()
session.login(username, password)
session.docmd("VRFY", user)
...