vul
int64
CWE ID
string
path
string
language
string
description
string
func_before
string
artifacts_list
list
supported_code
string
0
CWE-79
314100-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_ADD_SLASHES); $sanitized = filter_var($tainted, FILTER_SANITIZE_FULL_SPECIAL_CHARS); $dataflow = $sanitized; $pre = "<script>alert(Hello"; $post = ");</script>"; $context = ($pre . ($dataflow . $post)); printf("Print this: %d", $context); ?...
null
null
1
CWE-122
70028-v1.0.0/src/testcases/CWE122_Heap_Based_Buffer_Overflow/s05/CWE122_Heap_Based_Buffer_Overflow__cpp_dest_char_cpy_13.cpp
cplusplus
CWE: 122 Heap Based Buffer Overflow BadSource: Allocate using new[] and set data pointer to a small buffer GoodSource: Allocate using new[] and set data pointer to a large buffer Sink: cpy BadSink : Copy string to data using strcpy Flow Variant: 13 Control flow: if(GLOBAL_CONST_FIVE==5) and if(GLOBAL_CONST_FIVE!=...
#include "std_testcase.h" #include <wchar.h> namespace CWE122_Heap_Based_Buffer_Overflow__cpp_dest_char_cpy_13 { #ifndef OMITBAD void bad() { char * data; data = NULL; if(GLOBAL_CONST_FIVE==5) { data = new char[50]; data[0] = '\0'; } { char source[100]; ...
[ { "hashes": { "sha-256": "0fe1db5ab1f72448f547231f2860b33fa7c3b135bb88c23b53deed3089fef36a" }, "length": 3976, "location": { "uri": "70028-v1.0.0/src/testcases/CWE122_Heap_Based_Buffer_Overflow/s05/CWE122_Heap_Based_Buffer_Overflow__cpp_dest_char_cpy_13.cpp" }, "sourceLanguage": ...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__cpp_dest_char_cpy_13.cpp Label Definition File: CWE122_Heap_Based_Buffer_Overflow__cpp_dest.label.xml Template File: sources-sink-13.tmpl.cpp */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Allocate using new[] ...
1
CWE-762
242650-v2.0.0/src/testcases/CWE762_Mismatched_Memory_Management_Routines/s03/CWE762_Mismatched_Memory_Management_Routines__delete_int64_t_realloc_08.cpp
cplusplus
CWE: 762 Mismatched Memory Management Routines BadSource: realloc Allocate data using realloc() GoodSource: Allocate data using new Sinks: GoodSink: Deallocate data using free() BadSink : Deallocate data using delete Flow Variant: 08 Control flow: if(staticReturnsTrue()) and if(staticReturnsFalse())
#include "std_testcase.h" static int staticReturnsTrue() { return 1; } static int staticReturnsFalse() { return 0; } namespace CWE762_Mismatched_Memory_Management_Routines__delete_int64_t_realloc_08 { #ifndef OMITBAD void bad() { int64_t * data; data = NULL; if(staticReturnsTrue()) { ...
[ { "hashes": { "sha-256": "e5059b5c709398073b6a7359b18d613a6071125f5d671f7f0a9dbd7aef1aa6e4" }, "length": 5228, "location": { "uri": "242650-v2.0.0/src/testcases/CWE762_Mismatched_Memory_Management_Routines/s03/CWE762_Mismatched_Memory_Management_Routines__delete_int64_t_realloc_08.cpp" ...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE762_Mismatched_Memory_Management_Routines__delete_int64_t_realloc_08.cpp Label Definition File: CWE762_Mismatched_Memory_Management_Routines__delete.label.xml Template File: sources-sinks-08.tmpl.cpp */ /* * @description * CWE: 762 Mismatched Memory Management Routines...
0
CWE-89
404859-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $pdo = new PDO("mysql:host=mysql;port=3306;dbname=myDB", "username", "password"); # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_FULL_SPECIAL_CHARS]); $tainted = $tainted["t"]; $sanitized = bindec($tainted); $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE pin ="...
null
null
0
CWE-79
488957-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_URL]); $tainted = $tainted["t"]; $sanitized = soundex($tainted); $dataflow = $sanitized; $context = (("<img src=\"" . $dataflow) . "\"/>"); exit($context); ?>
null
null
0
CWE-79
273499-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init $legal = ["safe1", "safe2"]; # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_EMAIL]); $tainted = $tainted["t"]; if(in_array($tainted, $legal, true)) { $sanitized = $tainted; $dataflow = $sanitized; $context = (("Hello to \"" . $dataflow) . "\""); vprintf("This%s", $conte...
null
null
1
CWE-415
240073-v2.0.0/src/testcases/CWE415_Double_Free/s01/CWE415_Double_Free__malloc_free_char_03.c
c
CWE: 415 Double Free BadSource: Allocate data using malloc() and Deallocate data using free() GoodSource: Allocate data using malloc() Sinks: GoodSink: do nothing BadSink : Deallocate data using free() Flow Variant: 03 Control flow: if(5==5) and if(5!=5)
#include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD void CWE415_Double_Free__malloc_free_char_03_bad() { char * data; data = NULL; if(5==5) { data = (char *)malloc(100*sizeof(char)); if (data == NULL) {exit(-1);} free(data); } if(5==5) { ...
[ { "hashes": { "sha-256": "e909b1b249c5ea1eb729a310d5f5f78e3d11de136395ad037f5cf625173333da" }, "length": 4430, "location": { "uri": "240073-v2.0.0/src/testcases/CWE415_Double_Free/s01/CWE415_Double_Free__malloc_free_char_03.c" }, "sourceLanguage": "c" }, { "hashes": { ...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE415_Double_Free__malloc_free_char_03.c Label Definition File: CWE415_Double_Free__malloc_free.label.xml Template File: sources-sinks-03.tmpl.c */ /* * @description * CWE: 415 Double Free * BadSource: Allocate data using malloc() and Deallocate data using free() * Go...
1
CWE-89
413246-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $db = new SQLite3("/var/www/db/database.db"); # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_ADD_SLASHES); $sanitized = strstr($tainted, "1"); $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE pin =" . $dataflow) . ";"); $results = $db->query($context); while(($row = $resu...
null
null
0
CWE-89
360342-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $servername = "mysql"; $username = "username"; $password = "password"; $dbName = "myDB"; $db = new mysqli($servername, $username, $password, $dbName); # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_NUMBER_FLOAT]); $tainted = $tainted["t"]; $sanitized = urlencode($tainted); $dat...
null
null
0
CWE-89
382444-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $info = ["Database" => "myDB", "UID" => "SA", "PWD" => "Msql12345678!"]; $db = sqlsrv_connect("mssql", $info); if($db == false) { die(print_r(sqlsrv_errors(), true)); } # Sample $tainted = $_REQUEST; $tainted = $tainted["t"]; if(is_bool($tainted)) { $sanitized = $tainted; $dataflow = $sanitized; ...
null
null
0
CWE-79
254392-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_SPECIAL_CHARS]); $tainted = $tainted["t"]; $sanitized = metaphone($tainted, 9); $dataflow = $sanitized; $pre = "<script>alert(Hello"; $post = ");</script>"; $context = ($pre . ($dataflow . $post)); echo($context); ?>
null
null
1
CWE-89
437701-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $servername = "mysql"; $username = "username"; $password = "password"; $dbName = "myDB"; $db = new mysqli($servername, $username, $password, $dbName); # Sample $tainted = $_POST; $tainted = $tainted["t"]; $sanitized = strtr($tainted, "'", " "); $dataflow = $sanitized; $context = (("SELECT * FROM users WH...
null
null
0
CWE-89
476390-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $pdo = new PDO("mysql:host=mysql;port=3306;dbname=myDB", "username", "password"); # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_NUMBER_FLOAT); $sanitized = str_replace("'", "", $tainted); $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE pin =" . $dataflow) . ";"); $resul...
null
null
1
CWE-762
114472-v1.0.0/src/testcases/CWE762_Mismatched_Memory_Management_Routines/s03/CWE762_Mismatched_Memory_Management_Routines__delete_int64_t_malloc_53a.cpp
cplusplus
CWE: 762 Mismatched Memory Management Routines BadSource: malloc Allocate data using malloc() GoodSource: Allocate data using new Sinks: GoodSink: Deallocate data using free() BadSink : Deallocate data using delete Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a fo...
#include "std_testcase.h" namespace CWE762_Mismatched_Memory_Management_Routines__delete_int64_t_malloc_53 { #ifndef OMITBAD void badSink_b(int64_t * data); void bad() { int64_t * data; data = NULL; data = (int64_t *)malloc(100*sizeof(int64_t)); badSink_b(data); } #endif #ifndef OMITGO...
[ { "hashes": { "sha-256": "467e7fc17ed433fa5af924b629a0a5ff0a63da03c96e04411f8ba09a0f3a8138" }, "length": 2791, "location": { "uri": "114472-v1.0.0/src/testcases/CWE762_Mismatched_Memory_Management_Routines/s03/CWE762_Mismatched_Memory_Management_Routines__delete_int64_t_malloc_53a.cpp" ...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE762_Mismatched_Memory_Management_Routines__delete_int64_t_malloc_53a.cpp Label Definition File: CWE762_Mismatched_Memory_Management_Routines__delete.label.xml Template File: sources-sinks-53a.tmpl.cpp */ /* * @description * CWE: 762 Mismatched Memory Management Routine...
0
CWE-79
278277-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = $_COOKIE; $tainted = $tainted["t"]; $sanitized = gzcompress($tainted); $dataflow = $sanitized; $context = (("<a href=\"" . $dataflow) . "\">link</a>"); vprintf("This%s", $context); ?>
null
null
0
CWE-79
393864-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_URL); if(settype($tainted, "bool")) { $sanitized = $tainted; $dataflow = $sanitized; $context = (("Hello to '" . $dataflow) . "'"); trigger_error($context, E_USER_ERROR); } ?>
null
null
0
CWE-79
427692-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_URL]); $tainted = $tainted["t"]; $sanitized = htmlspecialchars($tainted, ENT_COMPAT); $dataflow = $sanitized; $pre = "<script>alert(\"Hello"; $post = "\");</script>"; $context = ($pre . ($dataflow . $post)); exit($context); ?>
null
null
0
CWE-79
334203-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_SPECIAL_CHARS); if(is_integer($tainted)) { $sanitized = $tainted; $dataflow = $sanitized; $context = (("<a href=\"" . $dataflow) . "\">link</a>"); printf("Print this: %d", $context); } ?>
null
null
1
CWE-23
90083-v1.0.0/src/testcases/CWE23_Relative_Path_Traversal/s01/CWE23_Relative_Path_Traversal__char_environment_fopen_34.cpp
cplusplus
CWE: 23 Relative Path Traversal BadSource: environment Read input from an environment variable GoodSource: Use a fixed file name Sinks: fopen BadSink : Open the file named in data using fopen() Flow Variant: 34 Data flow: use of a union containing two methods of accessing the same data (within the same function)
#include "std_testcase.h" #ifdef _WIN32 #define BASEPATH "c:\\temp\\" #else #include <wchar.h> #define BASEPATH "/tmp/" #endif #define ENV_VARIABLE "ADD" #ifdef _WIN32 #define GETENV getenv #else #define GETENV getenv #endif #ifdef _WIN32 #define FOPEN fopen #else #define FOPEN fopen #endif namespace CWE23_Relativ...
[ { "hashes": { "sha-256": "b37341ce7748daaf78e56ae55a3951ee7de58a4e7a38cab40c62203c4fd31dba" }, "length": 3628, "location": { "uri": "90083-v1.0.0/src/testcases/CWE23_Relative_Path_Traversal/s01/CWE23_Relative_Path_Traversal__char_environment_fopen_34.cpp" }, "sourceLanguage": "cp...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE23_Relative_Path_Traversal__char_environment_fopen_34.cpp Label Definition File: CWE23_Relative_Path_Traversal.label.xml Template File: sources-sink-34.tmpl.cpp */ /* * @description * CWE: 23 Relative Path Traversal * BadSource: environment Read input from an environm...
0
CWE-79
486489-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_URL); if(settype($tainted, "int")) { $sanitized = $tainted; $dataflow = $sanitized; $pre = "<script>alert(\"Hello"; $post = "\");</script>"; $context = ($pre . ($dataflow . $post)); printf("Print this: %d", $context); } ?>
null
null
0
CWE-79
366300-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_NUMBER_INT); $sanitized = htmlentities($tainted, ENT_NOQUOTES); $dataflow = $sanitized; $context = (("<a href=\"" . $dataflow) . "\">link</a>"); printf("Print this: %s", $context); ?>
null
null
0
CWE-79
388692-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = apache_request_headers(); $tainted = $tainted["t"]; $sanitized = strripos($tainted, "needle"); $dataflow = $sanitized; $context = ("Hello" . $dataflow); vprintf("This%d", $context); ?>
null
null
0
CWE-79
369575-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_NUMBER_FLOAT); $sanitized = urlencode($tainted); $dataflow = $sanitized; $context = ("Hello" . $dataflow); exit($context); ?>
null
null
0
CWE-79
403892-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_NUMBER_INT]); $tainted = $tainted["t"]; $sanitized = $tainted+= 0; $dataflow = $sanitized; $context = (("Hello to '" . $dataflow) . "'"); user_error($context); ?>
null
null
1
CWE-78
246371-v2.0.0/src/testcases/CWE78_OS_Command_Injection/s05/CWE78_OS_Command_Injection__wchar_t_connect_socket_execl_09.c
c
CWE: 78 OS Command Injection BadSource: connect_socket Read data using a connect socket (client side) GoodSource: Fixed string Sink: execl BadSink : execute command with wexecl Flow Variant: 09 Control flow: if(GLOBAL_CONST_TRUE) and if(GLOBAL_CONST_FALSE)
#include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH L"%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT L"cmd.exe" #define COMMAND_ARG1 L"/c" #define COMMAND_ARG2 L"dir " #define COMMAND_ARG3 data #else #include <unistd.h> #define COMMAND_INT_PATH L"/bin/sh" #define COMMAND_INT L"sh" #...
[ { "hashes": { "sha-256": "8702f82e35676496835152f84b3d040fa65875c320f4bf5c4db54e11d5624b57" }, "length": 6878, "location": { "uri": "246371-v2.0.0/src/testcases/CWE78_OS_Command_Injection/s05/CWE78_OS_Command_Injection__wchar_t_connect_socket_execl_09.c" }, "sourceLanguage": "c" ...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__wchar_t_connect_socket_execl_09.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-09.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: connect_socket Read data using a conne...
0
CWE-89
405674-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $servername = "mysql"; $username = "username"; $password = "password"; $dbName = "myDB"; $db = new mysqli($servername, $username, $password, $dbName); # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_NUMBER_FLOAT]); $tainted = $tainted["t"]; $sanitized = str_word_count($tainted, ...
null
null
0
CWE-89
435186-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $servername = "mysql"; $username = "username"; $password = "password"; $dbName = "myDB"; $db = new mysqli($servername, $username, $password, $dbName); # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_URL]); $tainted = $tainted["t"]; $sanitized = filter_var($tainted, FILTER_SANITI...
null
null
0
CWE-79
451546-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_EMAIL); if(fnmatch("*", $tainted, 0)) { $sanitized = $tainted; $dataflow = $sanitized; $context = (("<img src=\"" . $dataflow) . "\"/>"); user_error($context); } ?>
null
null
1
CWE-114
62489-v1.0.0/src/testcases/CWE114_Process_Control/CWE114_Process_Control__w32_wchar_t_relativePath_32.c
c
CWE: 114 Process Control BadSource: relativePath Hard code the relative pathname to the library GoodSource: Hard code the full pathname to the library Sink: BadSink : Load a dynamic link library Flow Variant: 32 Data flow using two pointers to the same value within the same function
#include "std_testcase.h" #include <wchar.h> #include <windows.h> #ifndef OMITBAD void CWE114_Process_Control__w32_wchar_t_relativePath_32_bad() { wchar_t * data; wchar_t * *dataPtr1 = &data; wchar_t * *dataPtr2 = &data; wchar_t dataBuffer[100] = L""; data = dataBuffer; { wchar_t * d...
[ { "hashes": { "sha-256": "ef3fa5bf67106c137a9b9b109370ab9c84811ca7d222d040911c9c57b3c7fcbc" }, "length": 3636, "location": { "uri": "62489-v1.0.0/src/testcases/CWE114_Process_Control/CWE114_Process_Control__w32_wchar_t_relativePath_32.c" }, "sourceLanguage": "c" }, { "has...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE114_Process_Control__w32_wchar_t_relativePath_32.c Label Definition File: CWE114_Process_Control__w32.label.xml Template File: sources-sink-32.tmpl.c */ /* * @description * CWE: 114 Process Control * BadSource: relativePath Hard code the relative pathname to the libra...
0
CWE-79
293160-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_URL); if(is_int($tainted)) { $sanitized = $tainted; $dataflow = $sanitized; $context = (("Hello to \"" . $dataflow) . "\""); printf("Print this: %d", $context); } ?>
null
null
0
CWE-79
432059-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_URL]); $tainted = $tainted["t"]; if(gettype($tainted) == "integer") { $sanitized = $tainted; $dataflow = $sanitized; $context = (("<a href=\"" . $dataflow) . "\">link</a>"); vprintf("This%s", $context); } ?>
null
null
0
CWE-79
285849-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_SPECIAL_CHARS]); $tainted = $tainted["t"]; if(settype($tainted, "float")) { $sanitized = $tainted; $dataflow = $sanitized; $context = ("Hello" . $dataflow); trigger_error($context, E_USER_ERROR); } ?>
null
null
0
CWE-79
411804-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = $_REQUEST; $tainted = $tainted["t"]; $sanitized = gzencode($tainted, 9); $dataflow = $sanitized; $pre = "<script>alert(\"Hello"; $post = "\");</script>"; $context = ($pre . ($dataflow . $post)); printf("Print this: %d", $context); ?>
null
null
0
CWE-79
301384-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_NUMBER_INT); $sanitized = htmlentities($tainted); $dataflow = $sanitized; $pre = "<script>alert(\"Hello"; $post = "\");</script>"; $context = ($pre . ($dataflow . $post)); printf("Print this: %d", $context); ?>
null
null
0
CWE-89
349111-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $pdo = new PDO("mysql:host=mysql;port=3306;dbname=myDB", "username", "password"); # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_NUMBER_FLOAT); if(ctype_digit($tainted)) { $sanitized = $tainted; $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE password ='" . $datafl...
null
null
0
CWE-89
309873-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $info = ["Database" => "myDB", "UID" => "SA", "PWD" => "Msql12345678!"]; $db = sqlsrv_connect("mssql", $info); if($db == false) { die(print_r(sqlsrv_errors(), true)); } # Sample $tainted = $_POST; $tainted = $tainted["t"]; $sanitized = base64_encode($tainted); $dataflow = $sanitized; $context = (("SELE...
null
null
1
CWE-89
492501-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $db = pg_pconnect("host=postgres-server port=5432 user=postgres password=postgres123 dbname=myDB"); # Sample $tainted = $_REQUEST; $tainted = $tainted["t"]; $sanitized = html_entity_decode($tainted); $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE pin =" . $dataflow) . ";"); $result = pg_...
null
null
1
CWE-89
480962-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $info = ["Database" => "myDB", "UID" => "SA", "PWD" => "Msql12345678!"]; $db = sqlsrv_connect("mssql", $info); if($db == false) { die(print_r(sqlsrv_errors(), true)); } # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_FULL_SPECIAL_CHARS); $sanitized = sscanf($tainted, "foo %s"); $saniti...
null
null
1
CWE-79
275074-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_FULL_SPECIAL_CHARS]); $tainted = $tainted["t"]; $sanitized = str_ireplace("'", "", $tainted); $dataflow = $sanitized; $context = (("<a href=\"" . $dataflow) . "\">link</a>"); printf("Print this: %s", $context); ?>
null
null
0
CWE-89
362842-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $dsn = "DATABASE=myDB;HOSTNAME=ibm_db2;PORT=50000;PROTOCOL=TCPIP;UID=db2inst1;PWD=ibm_db2_pw;"; $db = db2_connect($dsn, "", ""); # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_NUMBER_INT]); $tainted = $tainted["t"]; if(is_bool($tainted)) { $sanitized = $tainted; $dataflow =...
null
null
0
CWE-79
300373-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_ADD_SLASHES); if(is_integer($tainted)) { $sanitized = $tainted; $dataflow = $sanitized; $pre = "<script>alert(\"Hello"; $post = "\");</script>"; $context = ($pre . ($dataflow . $post)); trigger_error($context, E_USER_ERROR); } ?...
null
null
0
CWE-79
308777-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_EMAIL]); $tainted = $tainted["t"]; $sanitized = strtr($tainted, "'", " "); $dataflow = $sanitized; $context = (("<img src=\"" . $dataflow) . "\"/>"); vprintf("This%d", $context); ?>
null
null
1
CWE-773
116674-v1.0.0/src/testcases/CWE773_Missing_Reference_to_Active_File_Descriptor_or_Handle/CWE773_Missing_Reference_to_Active_File_Descriptor_or_Handle__fopen_16.c
c
CWE: 773 Missing Reference to Active File Descriptor or Handle BadSource: Create a file handle using fopen() Sinks: GoodSink: Close the file handle before reusing it BadSink : Reassign the file handle before closing it Flow Variant: 16 Control flow: while(1)
#include "std_testcase.h" #ifndef OMITBAD void CWE773_Missing_Reference_to_Active_File_Descriptor_or_Handle__fopen_16_bad() { FILE * data; data = NULL; data = fopen("BadSource_fopen.txt", "w+"); while(1) { data = fopen("BadSink_fopen.txt", "w+"); if (data != ...
[ { "hashes": { "sha-256": "4708bd4a74a7eba0df39539c1a6326273a2815a4165e4c65226d5ecf1d4bc99f" }, "length": 2961, "location": { "uri": "116674-v1.0.0/src/testcases/CWE773_Missing_Reference_to_Active_File_Descriptor_or_Handle/CWE773_Missing_Reference_to_Active_File_Descriptor_or_Handle__fope...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE773_Missing_Reference_to_Active_File_Descriptor_or_Handle__fopen_16.c Label Definition File: CWE773_Missing_Reference_to_Active_File_Descriptor_or_Handle__fopen.label.xml Template File: source-sinks-16.tmpl.c */ /* * @description * CWE: 773 Missing Reference to Active ...
0
CWE-79
313644-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_NUMBER_FLOAT); $sanitized = bindec($tainted); $dataflow = $sanitized; $context = (("Hello to '" . $dataflow) . "'"); vprintf("This%d", $context); ?>
null
null
0
CWE-89
388868-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $db = new SQLite3("/var/www/db/database.db"); # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_SPECIAL_CHARS); $sanitized = str_ireplace(["\"", "'", "<", ">"], "", $tainted); $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE password =\"" . $dataflow) . "\";"); $results = $d...
null
null
0
CWE-89
462905-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $dsn = "DATABASE=myDB;HOSTNAME=ibm_db2;PORT=50000;PROTOCOL=TCPIP;UID=db2inst1;PWD=ibm_db2_pw;"; $db = db2_connect($dsn, "", ""); # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_URL]); $tainted = $tainted["t"]; $sanitized = ($tainted + 0.0); $dataflow = $sanitized; $context = (("...
null
null
1
CWE-590
106275-v1.0.0/src/testcases/CWE590_Free_Memory_Not_on_Heap/s01/CWE590_Free_Memory_Not_on_Heap__delete_array_class_alloca_32.cpp
cplusplus
CWE: 590 Free Memory Not on Heap BadSource: alloca Data buffer is allocated on the stack with alloca() GoodSource: Allocate memory on the heap Sink: BadSink : Print then free data Flow Variant: 32 Data flow using two pointers to the same value within the same function
#include "std_testcase.h" #include <wchar.h> namespace CWE590_Free_Memory_Not_on_Heap__delete_array_class_alloca_32 { #ifndef OMITBAD void bad() { TwoIntsClass * data; TwoIntsClass * *dataPtr1 = &data; TwoIntsClass * *dataPtr2 = &data; data = NULL; { TwoIntsClass * data = *dataPtr1; ...
[ { "hashes": { "sha-256": "a1f8ff88a41b828611dee37746adcf4545e4f849ae7c5df1bedaea6ba8719828" }, "length": 3528, "location": { "uri": "106275-v1.0.0/src/testcases/CWE590_Free_Memory_Not_on_Heap/s01/CWE590_Free_Memory_Not_on_Heap__delete_array_class_alloca_32.cpp" }, "sourceLanguage...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE590_Free_Memory_Not_on_Heap__delete_array_class_alloca_32.cpp Label Definition File: CWE590_Free_Memory_Not_on_Heap__delete_array.label.xml Template File: sources-sink-32.tmpl.cpp */ /* * @description * CWE: 590 Free Memory Not on Heap * BadSource: alloca Data buffer ...
0
CWE-89
454282-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $info = ["Database" => "myDB", "UID" => "SA", "PWD" => "Msql12345678!"]; $db = sqlsrv_connect("mssql", $info); if($db == false) { die(print_r(sqlsrv_errors(), true)); } # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_NUMBER_INT); $sanitized = bin2hex($tainted); $dataflow = $sanitized; ...
null
null
0
CWE-79
271956-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_NUMBER_FLOAT); if(ctype_cntrl($tainted)) { $sanitized = $tainted; $dataflow = $sanitized; $pre = "<script>alert(\"Hello"; $post = "\");</script>"; $context = ($pre . ($dataflow . $post)); trigger_error($context, E_USER_ERROR); } ...
null
null
0
CWE-89
488202-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $servername = "mysql"; $username = "username"; $password = "password"; $dbName = "myDB"; $db = new mysqli($servername, $username, $password, $dbName); # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_NUMBER_INT); $sanitized = strspn($tainted, "needle)"); $dataflow = $sanitized; $context =...
null
null
1
CWE-36
97272-v1.0.0/src/testcases/CWE36_Absolute_Path_Traversal/s04/CWE36_Absolute_Path_Traversal__wchar_t_environment_ifstream_07.cpp
cplusplus
CWE: 36 Absolute Path Traversal BadSource: environment Read input from an environment variable GoodSource: Full path and file name Sink: ifstream BadSink : Open the file named in data using ifstream::open() Flow Variant: 07 Control flow: if(staticFive==5) and if(staticFive!=5)
#include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #define ENV_VARIABLE L"ADD" #ifdef _WIN32 #define GETENV _wgetenv #else #define GETENV getenv #endif #include <fstream> using namespace std; static int staticFive = 5; namespace CWE36_Absolute_Path_Traversal__wchar_t_environment_ifstream_07 { #i...
[ { "hashes": { "sha-256": "5b66396d500875b9443bb496aef2549d6399188022fc68a647d2057a65b31cda" }, "length": 4441, "location": { "uri": "97272-v1.0.0/src/testcases/CWE36_Absolute_Path_Traversal/s04/CWE36_Absolute_Path_Traversal__wchar_t_environment_ifstream_07.cpp" }, "sourceLanguage...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE36_Absolute_Path_Traversal__wchar_t_environment_ifstream_07.cpp Label Definition File: CWE36_Absolute_Path_Traversal.label.xml Template File: sources-sink-07.tmpl.cpp */ /* * @description * CWE: 36 Absolute Path Traversal * BadSource: environment Read input from an en...
0
CWE-89
339587-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $pdo = new PDO("mysql:host=mysql;port=3306;dbname=myDB", "username", "password"); # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_SPECIAL_CHARS]); $tainted = $tainted["t"]; $sanitized = $tainted+= 0.0; $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE password ='" ...
null
null
0
CWE-79
488019-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_UNSAFE_RAW); $sanitized = sscanf($tainted, "foo %d"); $sanitized = implode($sanitized, "_"); $dataflow = $sanitized; $context = (("Hello to \"" . $dataflow) . "\""); printf("Print this: %s", $context); ?>
null
null
0
CWE-79
268573-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = apache_request_headers(); $tainted = $tainted["t"]; $sanitized = strspn($tainted, "needle)"); $dataflow = $sanitized; $context = (("Hello to \"" . $dataflow) . "\""); print($context); ?>
null
null
0
CWE-79
315957-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_NUMBER_INT); $sanitized = ord($tainted); $dataflow = $sanitized; $context = (("Hello to '" . $dataflow) . "'"); vprintf("This%s", $context); ?>
null
null
0
CWE-79
500515-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_ADD_SLASHES]); $tainted = $tainted["t"]; $sanitized = (int)($tainted); $dataflow = $sanitized; $context = (("<img src=\"" . $dataflow) . "\"/>"); printf("Print this: %s", $context); ?>
null
null
0
CWE-79
252381-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_SPECIAL_CHARS); $sanitized = bindec($tainted); $dataflow = $sanitized; $context = (("<a href=\"" . $dataflow) . "\">link</a>"); exit($context); ?>
null
null
0
CWE-79
301620-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_URL); $sanitized = filter_var($tainted, FILTER_SANITIZE_SPECIAL_CHARS); $dataflow = $sanitized; $context = (("<img src=\"" . $dataflow) . "\"/>"); print($context); ?>
null
null
0
CWE-79
409788-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_NUMBER_INT); $sanitized = count_chars($tainted); $dataflow = $sanitized; $context = (("<a href=\"" . $dataflow) . "\">link</a>"); printf("Print this: %d", $context); ?>
null
null
0
CWE-89
451969-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $servername = "mysql"; $username = "username"; $password = "password"; $dbName = "myDB"; $db = new mysqli($servername, $username, $password, $dbName); # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_UNSAFE_RAW); $sanitized = (int)($tainted); $dataflow = $sanitized; $context = (("SELECT * FROM use...
null
null
0
CWE-89
255340-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $info = ["Database" => "myDB", "UID" => "SA", "PWD" => "Msql12345678!"]; $db = sqlsrv_connect("mssql", $info); if($db == false) { die(print_r(sqlsrv_errors(), true)); } # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_NUMBER_INT]); $sanitized = json_encode($tainted, JSON_PRETTY...
null
null
0
CWE-79
482159-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_URL); $sanitized = bin2hex($tainted); $dataflow = $sanitized; $context = (("Hello to '" . $dataflow) . "'"); vprintf("This%d", $context); ?>
null
null
0
CWE-79
495037-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = $_REQUEST; $tainted = $tainted["t"]; $sanitized = hexdec($tainted); $dataflow = $sanitized; $context = (("Hello to \"" . $dataflow) . "\""); vprintf("This%s", $context); ?>
null
null
1
CWE-124
75218-v1.0.0/src/testcases/CWE124_Buffer_Underwrite/s03/CWE124_Buffer_Underwrite__wchar_t_alloca_cpy_33.cpp
cplusplus
CWE: 124 Buffer Underwrite BadSource: Set data pointer to before the allocated memory buffer GoodSource: Set data pointer to the allocated memory buffer Sinks: cpy BadSink : Copy string to data using wcscpy Flow Variant: 33 Data flow: use of a C++ reference to data within the same function
#include "std_testcase.h" #include <wchar.h> namespace CWE124_Buffer_Underwrite__wchar_t_alloca_cpy_33 { #ifndef OMITBAD void bad() { wchar_t * data; wchar_t * &dataRef = data; wchar_t * dataBuffer = (wchar_t *)ALLOCA(100*sizeof(wchar_t)); wmemset(dataBuffer, L'A', 100-1); dataBuffer[100-1] = L'...
[ { "hashes": { "sha-256": "1876bf687ad44b968c7801b9eedae899d5a5809f6ce3034e7e4b88059600db86" }, "length": 3091, "location": { "uri": "75218-v1.0.0/src/testcases/CWE124_Buffer_Underwrite/s03/CWE124_Buffer_Underwrite__wchar_t_alloca_cpy_33.cpp" }, "sourceLanguage": "cplusplus" }, ...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE124_Buffer_Underwrite__wchar_t_alloca_cpy_33.cpp Label Definition File: CWE124_Buffer_Underwrite.stack.label.xml Template File: sources-sink-33.tmpl.cpp */ /* * @description * CWE: 124 Buffer Underwrite * BadSource: Set data pointer to before the allocated memory buf...
1
CWE-190
83046-v1.0.0/src/testcases/CWE190_Integer_Overflow/s02/CWE190_Integer_Overflow__int_connect_socket_multiply_41.c
c
CWE: 190 Integer Overflow BadSource: connect_socket Read data using a connect socket (client side) GoodSource: Set data to a small, non-zero number (two) Sinks: multiply GoodSink: Ensure there will not be an overflow before multiplying data by 2 BadSink : If data is positive, multiply by 2, which can cause an over...
#include "std_testcase.h" #ifdef _WIN32 #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") #define CLOSE_SOCKET closesocket #else #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #define INVALID_SOCKET -1 #def...
[ { "hashes": { "sha-256": "6b140dcf45385724d6297c86f50ccd1a021c202b1a7dec2e70f05575d6a39ded" }, "length": 7441, "location": { "uri": "83046-v1.0.0/src/testcases/CWE190_Integer_Overflow/s02/CWE190_Integer_Overflow__int_connect_socket_multiply_41.c" }, "sourceLanguage": "c" }, {...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE190_Integer_Overflow__int_connect_socket_multiply_41.c Label Definition File: CWE190_Integer_Overflow__int.label.xml Template File: sources-sinks-41.tmpl.c */ /* * @description * CWE: 190 Integer Overflow * BadSource: connect_socket Read data using a connect socket (c...
1
CWE-427
103229-v1.0.0/src/testcases/CWE427_Uncontrolled_Search_Path_Element/CWE427_Uncontrolled_Search_Path_Element__wchar_t_environment_65a.c
c
CWE: 427 Uncontrolled Search Path Element BadSource: environment Read input from an environment variable GoodSource: Use a hardcoded path Sinks: BadSink : Set the environment variable Flow Variant: 65 Data/control flow: data passed as an argument from one function to a function in a different source file called vi...
#include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define NEW_PATH L"%SystemRoot%\\system32" #define PUTENV _wputenv #else #define NEW_PATH L"/bin" #define PUTENV putenv #endif #define ENV_VARIABLE L"ADD" #ifdef _WIN32 #define GETENV _wgetenv #else #define GETENV getenv #endif #ifndef OMITBAD void CWE427...
[ { "hashes": { "sha-256": "d8743f3d9bd151ecf90ce89931b88371c4be53cfa1be5f467abf0ab7c672bddf" }, "length": 3365, "location": { "uri": "103229-v1.0.0/src/testcases/CWE427_Uncontrolled_Search_Path_Element/CWE427_Uncontrolled_Search_Path_Element__wchar_t_environment_65a.c" }, "sourceL...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE427_Uncontrolled_Search_Path_Element__wchar_t_environment_65a.c Label Definition File: CWE427_Uncontrolled_Search_Path_Element.label.xml Template File: sources-sink-65a.tmpl.c */ /* * @description * CWE: 427 Uncontrolled Search Path Element * BadSource: environment Re...
1
CWE-89
475176-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $pdo = new PDO("mysql:host=mysql;port=3306;dbname=myDB", "username", "password"); # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_URL]); $tainted = $tainted["t"]; $sanitized = filter_var($tainted, FILTER_SANITIZE_URL); $dataflow = $sanitized; $context = (("SELECT * FROM users WH...
null
null
0
CWE-79
300021-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_URL]); $tainted = $tainted["t"]; if(is_real($tainted)) { $sanitized = $tainted; $dataflow = $sanitized; $context = (("Hello to '" . $dataflow) . "'"); echo($context); } ?>
null
null
1
CWE-191
238546-v1.0.0/src/testcases/CWE191_Integer_Underflow/s05/CWE191_Integer_Underflow__short_min_predec_32.c
c
CWE: 191 Integer Underflow BadSource: min Set data to the min value for short GoodSource: Set data to a small, non-zero number (negative two) Sinks: decrement GoodSink: Ensure there will not be an underflow before decrementing data BadSink : Decrement data, which can cause an Underflow Flow Variant: 32 Data flow ...
#include "std_testcase.h" #ifndef OMITBAD void CWE191_Integer_Underflow__short_min_predec_32_bad() { short data; short *dataPtr1 = &data; short *dataPtr2 = &data; data = 0; { short data = *dataPtr1; data = SHRT_MIN; *dataPtr1 = data; } { short data ...
[ { "hashes": { "sha-256": "8f991d00727ff400eb33cc124c72b0baa8f0e49dc876f2d721a9fbcbffadd545" }, "length": 3528, "location": { "uri": "238546-v1.0.0/src/testcases/CWE191_Integer_Underflow/s05/CWE191_Integer_Underflow__short_min_predec_32.c" }, "sourceLanguage": "c" }, { "ha...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE191_Integer_Underflow__short_min_predec_32.c Label Definition File: CWE191_Integer_Underflow.label.xml Template File: sources-sinks-32.tmpl.c */ /* * @description * CWE: 191 Integer Underflow * BadSource: min Set data to the min value for short * GoodSource: Set data...
0
CWE-79
363473-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_NUMBER_INT); $sanitized = filter_var($tainted, FILTER_SANITIZE_ADD_SLASHES); $dataflow = $sanitized; $pre = "<script>alert(\"Hello"; $post = "\");</script>"; $context = ($pre . ($dataflow . $post)); printf("Print this: %d", $context); ?>
null
null
0
CWE-79
331613-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_NUMBER_FLOAT]); $tainted = $tainted["t"]; $sanitized = substr_replace($tainted, "bob", 50); $dataflow = $sanitized; $context = (("Hello to \"" . $dataflow) . "\""); vprintf("This%d", $context); ?>
null
null
0
CWE-79
252320-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = $_GET; $tainted = $tainted["t"]; $sanitized = base64_encode($tainted); $dataflow = $sanitized; $pre = "<script>alert(Hello"; $post = ");</script>"; $context = ($pre . ($dataflow . $post)); printf("Print this: %s", $context); ?>
null
null
0
CWE-79
459966-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_NUMBER_INT]); $tainted = $tainted["t"]; $sanitized = $tainted+= 0; $dataflow = $sanitized; $pre = "<script>alert(Hello"; $post = ");</script>"; $context = ($pre . ($dataflow . $post)); print($context); ?>
null
null
0
CWE-79
407345-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_EMAIL]); $sanitized = http_build_query($tainted); $dataflow = $sanitized; $context = (("Hello to '" . $dataflow) . "'"); vprintf("This%s", $context); ?>
null
null
0
CWE-79
383406-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_NUMBER_INT); $sanitized = htmlentities($tainted, ENT_COMPAT); $dataflow = $sanitized; $pre = "<script>alert(\"Hello"; $post = "\");</script>"; $context = ($pre . ($dataflow . $post)); print($context); ?>
null
null
0
CWE-89
443218-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $dsn = "DATABASE=myDB;HOSTNAME=ibm_db2;PORT=50000;PROTOCOL=TCPIP;UID=db2inst1;PWD=ibm_db2_pw;"; $db = db2_connect($dsn, "", ""); # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_URL); $sanitized = ord($tainted); $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE password ='" ...
null
null
0
CWE-89
275072-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $dsn = "DATABASE=myDB;HOSTNAME=ibm_db2;PORT=50000;PROTOCOL=TCPIP;UID=db2inst1;PWD=ibm_db2_pw;"; $db = db2_connect($dsn, "", ""); # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_NUMBER_INT); $sanitized = sscanf($tainted, "foo %s"); $sanitized = implode($sanitized, "_"); $dataflow = $sanit...
null
null
1
CWE-23
91030-v1.0.0/src/testcases/CWE23_Relative_Path_Traversal/s03/CWE23_Relative_Path_Traversal__wchar_t_console_fopen_11.cpp
cplusplus
CWE: 23 Relative Path Traversal BadSource: console Read input from the console GoodSource: Use a fixed file name Sink: fopen BadSink : Open the file named in data using fopen() Flow Variant: 11 Control flow: if(globalReturnsTrue()) and if(globalReturnsFalse())
#include "std_testcase.h" #ifdef _WIN32 #define BASEPATH L"c:\\temp\\" #else #include <wchar.h> #define BASEPATH L"/tmp/" #endif #ifdef _WIN32 #define FOPEN _wfopen #else #define FOPEN fopen #endif namespace CWE23_Relative_Path_Traversal__wchar_t_console_fopen_11 { #ifndef OMITBAD void bad() { wchar_t * data; ...
[ { "hashes": { "sha-256": "01a4ea606d4010967c387abfc7a164b8f98c3ed7a14286dc9dc40811d0c5c88d" }, "length": 4595, "location": { "uri": "91030-v1.0.0/src/testcases/CWE23_Relative_Path_Traversal/s03/CWE23_Relative_Path_Traversal__wchar_t_console_fopen_11.cpp" }, "sourceLanguage": "cpl...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE23_Relative_Path_Traversal__wchar_t_console_fopen_11.cpp Label Definition File: CWE23_Relative_Path_Traversal.label.xml Template File: sources-sink-11.tmpl.cpp */ /* * @description * CWE: 23 Relative Path Traversal * BadSource: console Read input from the console * G...
0
CWE-79
411295-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = apache_request_headers(); $tainted = $tainted["t"]; $sanitized = str_replace(" ", "", $tainted); $dataflow = $sanitized; $context = ("Hello" . $dataflow); printf("Print this: %d", $context); ?>
null
null
0
CWE-79
472803-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_NUMBER_INT]); $tainted = $tainted["t"]; $sanitized = sha1($tainted, false); $dataflow = $sanitized; $pre = "<script>alert(Hello"; $post = ");</script>"; $context = ($pre . ($dataflow . $post)); vprintf("This%s", $context); ?>
null
null
1
CWE-134
81474-v1.0.0/src/testcases/CWE134_Uncontrolled_Format_String/s05/CWE134_Uncontrolled_Format_String__wchar_t_file_printf_41.c
c
CWE: 134 Uncontrolled Format String BadSource: file Read input from a file GoodSource: Copy a fixed string into data Sinks: printf GoodSink: wprintf with %s as the first argument and data as the second BadSink : wprintf with only data as an argument Flow Variant: 41 Data flow: data passed as an argument from one ...
#include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #ifdef _WIN32 #define FILENAME "C:\\temp\\file.txt" #else #define FILENAME "/tmp/file.txt" #endif #ifndef OMITBAD static void badSink(wchar_t * data) { wprintf(data); } void CWE134_Uncontrolled_Format_String__wchar_t_file_printf_41_bad() {...
[ { "hashes": { "sha-256": "c3c8d176c4033a8463bd9419669287f280e11fbc280975f079a7af0d3c68b04d" }, "length": 4439, "location": { "uri": "81474-v1.0.0/src/testcases/CWE134_Uncontrolled_Format_String/s05/CWE134_Uncontrolled_Format_String__wchar_t_file_printf_41.c" }, "sourceLanguage": ...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE134_Uncontrolled_Format_String__wchar_t_file_printf_41.c Label Definition File: CWE134_Uncontrolled_Format_String.label.xml Template File: sources-sinks-41.tmpl.c */ /* * @description * CWE: 134 Uncontrolled Format String * BadSource: file Read input from a file * Go...
0
CWE-79
382822-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = $_POST; $tainted = $tainted["t"]; $sanitized = gzdeflate($tainted, 9); $dataflow = $sanitized; $context = (("<img src=\"" . $dataflow) . "\"/>"); trigger_error($context, E_USER_ERROR); ?>
null
null
0
CWE-79
256835-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_SPECIAL_CHARS); $sanitized = hash_hmac("md5", $tainted, "salt"); $dataflow = $sanitized; $pre = "<script>alert(\"Hello"; $post = "\");</script>"; $context = ($pre . ($dataflow . $post)); print($context); ?>
null
null
0
CWE-79
468200-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_SPECIAL_CHARS]); $tainted = $tainted["t"]; $sanitized = substr_count($tainted, "needle"); $dataflow = $sanitized; $pre = "<script>alert(Hello"; $post = ");</script>"; $context = ($pre . ($dataflow . $post)); printf("Print this: %d",...
null
null
1
CWE-761
241349-v2.0.0/src/testcases/CWE761_Free_Pointer_Not_at_Start_of_Buffer/CWE761_Free_Pointer_Not_at_Start_of_Buffer__char_connect_socket_32.c
c
CWE: 761 Free Pointer not at Start of Buffer BadSource: connect_socket Read data using a connect socket (client side) Sinks: GoodSink: free() memory correctly at the start of the buffer BadSink : free() memory not at the start of the buffer Flow Variant: 32 Data flow: two pointers to the same value within the same...
#include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") #define CLOSE_SOCKET closesocket #else #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #define IN...
[ { "hashes": { "sha-256": "77108c3bae2380d86b666192dda01857193dde7a8592b678180e17500864784f" }, "length": 8613, "location": { "uri": "241349-v2.0.0/src/testcases/CWE761_Free_Pointer_Not_at_Start_of_Buffer/CWE761_Free_Pointer_Not_at_Start_of_Buffer__char_connect_socket_32.c" }, "so...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE761_Free_Pointer_Not_at_Start_of_Buffer__char_connect_socket_32.c Label Definition File: CWE761_Free_Pointer_Not_at_Start_of_Buffer.label.xml Template File: source-sinks-32.tmpl.c */ /* * @description * CWE: 761 Free Pointer not at Start of Buffer * BadSource: connect...
1
CWE-134
235241-v2.0.0/src/testcases/CWE134_Uncontrolled_Format_String/s05/CWE134_Uncontrolled_Format_String__wchar_t_environment_snprintf_43.cpp
cplusplus
CWE: 134 Uncontrolled Format String BadSource: environment Read input from an environment variable GoodSource: Copy a fixed string into data Sinks: snprintf GoodSink: snwprintf with %s as the third argument and data as the fourth BadSink : snwprintf with data as the third argument Flow Variant: 43 Data flow: data...
#include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #define ENV_VARIABLE L"ADD" #ifdef _WIN32 #define GETENV _wgetenv #else #define GETENV getenv #endif #ifdef _WIN32 #define SNPRINTF _snwprintf #else #define SNPRINTF swprintf #endif namespace CWE134_Uncontrolled_Format_String__wchar_t_environment_s...
[ { "hashes": { "sha-256": "e4a5d52affd572e3a363564adca9b9596e57de48950d81106246d9c707216f1e" }, "length": 4316, "location": { "uri": "235241-v2.0.0/src/testcases/CWE134_Uncontrolled_Format_String/s05/CWE134_Uncontrolled_Format_String__wchar_t_environment_snprintf_43.cpp" }, "sourc...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE134_Uncontrolled_Format_String__wchar_t_environment_snprintf_43.cpp Label Definition File: CWE134_Uncontrolled_Format_String.label.xml Template File: sources-sinks-43.tmpl.cpp */ /* * @description * CWE: 134 Uncontrolled Format String * BadSource: environment Read inp...
0
CWE-79
302986-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_EMAIL]); $tainted = $tainted["t"]; if(is_float($tainted)) { $sanitized = $tainted; $dataflow = $sanitized; $context = (("<a href=\"" . $dataflow) . "\">link</a>"); trigger_error($context, E_USER_ERROR); } ?>
null
null
1
CWE-197
89208-v1.0.0/src/testcases/CWE197_Numeric_Truncation_Error/s02/CWE197_Numeric_Truncation_Error__short_connect_socket_41.c
c
CWE: 197 Numeric Truncation Error BadSource: connect_socket Read data using a connect socket (client side) GoodSource: Less than CHAR_MAX Sink: BadSink : Convert data to a char Flow Variant: 41 Data flow: data passed as an argument from one function to another in the same source file
#include "std_testcase.h" #ifdef _WIN32 #include <winsock2.h> #include <windows.h> #include <direct.h> #pragma comment(lib, "ws2_32") #define CLOSE_SOCKET closesocket #else #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #define INVALID_SOCKET -1 #def...
[ { "hashes": { "sha-256": "398b5073ee33e170f44538e2d38dd1681456cc59b1dd59bd1fbf1cfba8db3c2c" }, "length": 5046, "location": { "uri": "89208-v1.0.0/src/testcases/CWE197_Numeric_Truncation_Error/s02/CWE197_Numeric_Truncation_Error__short_connect_socket_41.c" }, "sourceLanguage": "c"...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE197_Numeric_Truncation_Error__short_connect_socket_41.c Label Definition File: CWE197_Numeric_Truncation_Error__short.label.xml Template File: sources-sink-41.tmpl.c */ /* * @description * CWE: 197 Numeric Truncation Error * BadSource: connect_socket Read data using a...
0
CWE-79
337601-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = apache_request_headers(); $tainted = $tainted["t"]; $sanitized = htmlentities($tainted, ENT_COMPAT); $dataflow = $sanitized; $context = (("Hello to \"" . $dataflow) . "\""); echo($context); ?>
null
null
0
CWE-89
413031-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $servername = "mysql"; $username = "username"; $password = "password"; $dbName = "myDB"; $db = new mysqli($servername, $username, $password, $dbName); # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_FULL_SPECIAL_CHARS]); $tainted = $tainted["t"]; $sanitized = substr_replace($tai...
null
null
0
CWE-79
479665-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = $_COOKIE; $tainted = $tainted["t"]; $sanitized = htmlspecialchars($tainted); $dataflow = $sanitized; $context = (("Hello to \"" . $dataflow) . "\""); vprintf("This%d", $context); ?>
null
null
1
CWE-36
97579-v1.0.0/src/testcases/CWE36_Absolute_Path_Traversal/s04/CWE36_Absolute_Path_Traversal__wchar_t_file_ofstream_42.cpp
cplusplus
CWE: 36 Absolute Path Traversal BadSource: file Read input from a file GoodSource: Full path and file name Sink: ofstream BadSink : Open the file named in data using ofstream::open() Flow Variant: 42 Data flow: data returned from one function to another in the same source file
#include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #ifdef _WIN32 #define FILENAME "C:\\temp\\file.txt" #else #define FILENAME "/tmp/file.txt" #endif #include <fstream> using namespace std; namespace CWE36_Absolute_Path_Traversal__wchar_t_file_ofstream_42 { #ifndef OMITBAD static wchar_t * badSourc...
[ { "hashes": { "sha-256": "135f7dfd87581de94f1022a79b46e0b72f2e25937833a16e6642efd38aea39de" }, "length": 3681, "location": { "uri": "97579-v1.0.0/src/testcases/CWE36_Absolute_Path_Traversal/s04/CWE36_Absolute_Path_Traversal__wchar_t_file_ofstream_42.cpp" }, "sourceLanguage": "cpl...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE36_Absolute_Path_Traversal__wchar_t_file_ofstream_42.cpp Label Definition File: CWE36_Absolute_Path_Traversal.label.xml Template File: sources-sink-42.tmpl.cpp */ /* * @description * CWE: 36 Absolute Path Traversal * BadSource: file Read input from a file * GoodSourc...
0
CWE-79
439206-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = getallheaders(); $tainted = $tainted["t"]; $sanitized = str_word_count($tainted, 0); $dataflow = $sanitized; $pre = "<script>alert(Hello"; $post = ");</script>"; $context = ($pre . ($dataflow . $post)); echo($context); ?>
null
null
0
CWE-79
484509-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_NUMBER_FLOAT); $sanitized = urlencode($tainted); $dataflow = $sanitized; $pre = "<script>alert(\"Hello"; $post = "\");</script>"; $context = ($pre . ($dataflow . $post)); printf("Print this: %s", $context); ?>
null
null
1
CWE-690
111009-v1.0.0/src/testcases/CWE690_NULL_Deref_From_Return/s01/CWE690_NULL_Deref_From_Return__char_calloc_53a.c
c
CWE: 690 Unchecked Return Value To NULL Pointer BadSource: calloc Allocate data using calloc() Sinks: GoodSink: Check to see if the data allocation failed and if not, use data BadSink : Dont check for NULL and use data Flow Variant: 53 Data flow: data passed as an argument from one function through two others to a...
#include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD void CWE690_NULL_Deref_From_Return__char_calloc_53b_badSink(char * data); void CWE690_NULL_Deref_From_Return__char_calloc_53_bad() { char * data; data = NULL; data = (char *)calloc(20, sizeof(char)); CWE690_NULL_Deref_From_Return__c...
[ { "hashes": { "sha-256": "9467603a9726b8672d012e6395684c6efe639146a6561d382b7cb2a0acd586be" }, "length": 2576, "location": { "uri": "111009-v1.0.0/src/testcases/CWE690_NULL_Deref_From_Return/s01/CWE690_NULL_Deref_From_Return__char_calloc_53a.c" }, "sourceLanguage": "c" }, { ...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE690_NULL_Deref_From_Return__char_calloc_53a.c Label Definition File: CWE690_NULL_Deref_From_Return.free.label.xml Template File: source-sinks-53a.tmpl.c */ /* * @description * CWE: 690 Unchecked Return Value To NULL Pointer * BadSource: calloc Allocate data using call...
0
CWE-79
402030-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_NUMBER_INT); $sanitized = htmlspecialchars($tainted, ENT_QUOTES); $dataflow = $sanitized; $pre = "<script>alert(Hello"; $post = ");</script>"; $context = ($pre . ($dataflow . $post)); echo($context); ?>
null
null
0
CWE-89
283612-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $servername = "mysql"; $username = "username"; $password = "password"; $dbName = "myDB"; $db = new mysqli($servername, $username, $password, $dbName); # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_EMAIL); $sanitized = (double)($tainted); $dataflow = $sanitized; $context = (("SELECT * F...
null
null
0
CWE-89
414520-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $servername = "mysql"; $username = "username"; $password = "password"; $dbName = "myDB"; $db = new mysqli($servername, $username, $password, $dbName); # Sample $tainted = apache_request_headers(); $tainted = $tainted["t"]; if(gettype($tainted) == "boolean") { $sanitized = $tainted; $dataflow = $sanit...
null
null
0
CWE-89
340612-v1.0.0/src/sample.php
php
Improper Neutralization of Special Elements used in an SQL Command ('SQL Injection').
<?php # Init $db = pg_pconnect("host=postgres-server port=5432 user=postgres password=postgres123 dbname=myDB"); # Sample $tainted = filter_input_array(INPUT_GET, ["t" => FILTER_SANITIZE_NUMBER_INT]); $tainted = $tainted["t"]; $sanitized = strspn($tainted, "needle)"); $dataflow = $sanitized; $context = (("SELECT * FR...
null
null
0
CWE-79
438273-v1.0.0/src/sample.php
php
Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
<?php # Init # Sample $tainted = filter_input(INPUT_GET, "t", FILTER_SANITIZE_EMAIL); $sanitized = substr_replace($tainted, "bob", 50); $dataflow = $sanitized; $context = ("Hello" . $dataflow); exit($context); ?>
null
null