vul
int64
CWE ID
string
path
string
language
string
description
string
func_before
string
artifacts_list
list
supported_code
string
1
CWE-78
247379-v2.0.0/src/testcases/CWE78_OS_Command_Injection/s06/CWE78_OS_Command_Injection__wchar_t_environment_execlp_41.c
c
CWE: 78 OS Command Injection BadSource: environment Read input from an environment variable GoodSource: Fixed string Sink: execlp BadSink : execute command with wexeclp Flow Variant: 41 Data flow: data passed as an argument from one function to another in the same source file
#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": "0f44a0edfcea9707779e367923e38af8da29b20cbdca43e32cec2faa7db829a4" }, "length": 4079, "location": { "uri": "247379-v2.0.0/src/testcases/CWE78_OS_Command_Injection/s06/CWE78_OS_Command_Injection__wchar_t_environment_execlp_41.c" }, "sourceLanguage": "c" ...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__wchar_t_environment_execlp_41.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-41.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: environment Read input from an environme...
1
CWE-79
408148-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 = (string)($tainted); $dataflow = $sanitized; $pre = "<script>alert(Hello"; $post = ");</script>"; $context = ($pre . ($dataflow . $post)); echo($context); ?>
null
null
0
CWE-79
380178-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 = filter_var($tainted, FILTER_SANITIZE_EMAIL); $dataflow = $sanitized; $context = ("Hello" . $dataflow); vprintf("This%d", $context); ?>
null
null
1
CWE-675
110150-v1.0.0/src/testcases/CWE675_Duplicate_Operations_on_Resource/CWE675_Duplicate_Operations_on_Resource__freopen_01.c
c
CWE: 675 Duplicate Operations on Resource BadSource: freopen Open and close a file using freopen() and flose() GoodSource: Open a file using fopen() Sinks: GoodSink: Do nothing BadSink : Close the file Flow Variant: 01 Baseline
#include "std_testcase.h" #ifndef OMITBAD void CWE675_Duplicate_Operations_on_Resource__freopen_01_bad() { FILE * data; data = NULL; data = freopen("BadSource_freopen.txt","w+",stdin); fclose(data); fclose(data); } #endif #ifndef OMITGOOD static void goodG2B() { FILE * data; ...
[ { "hashes": { "sha-256": "23de942633577d2e099c943ce815ceae44f03b44b1ed08abd2ed253d78403e6b" }, "length": 2678, "location": { "uri": "110150-v1.0.0/src/testcases/CWE675_Duplicate_Operations_on_Resource/CWE675_Duplicate_Operations_on_Resource__freopen_01.c" }, "sourceLanguage": "c"...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE675_Duplicate_Operations_on_Resource__freopen_01.c Label Definition File: CWE675_Duplicate_Operations_on_Resource.label.xml Template File: sources-sinks-01.tmpl.c */ /* * @description * CWE: 675 Duplicate Operations on Resource * BadSource: freopen Open and close a fi...
1
CWE-121
63540-v1.0.0/src/testcases/CWE121_Stack_Based_Buffer_Overflow/s02/CWE121_Stack_Based_Buffer_Overflow__CWE193_wchar_t_alloca_memcpy_54a.c
c
CWE: 121 Stack Based Buffer Overflow BadSource: Point data to a buffer that does not have space for a NULL terminator GoodSource: Point data to a buffer that includes space for a NULL terminator Sink: memcpy BadSink : Copy string to data using memcpy() Flow Variant: 54 Data flow: data passed as an argument from o...
#include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #define SRC_STRING L"AAAAAAAAAA" #ifndef OMITBAD void CWE121_Stack_Based_Buffer_Overflow__CWE193_wchar_t_alloca_memcpy_54b_badSink(wchar_t * data); void CWE121_Stack_Based_Buffer_Overflow__CWE193_wchar_t_alloca_memcpy_54_bad() { wchar_t * dat...
[ { "hashes": { "sha-256": "6a7b65543f93c264663c29374a772da79938012b73498992290813204a0ed35e" }, "length": 3294, "location": { "uri": "63540-v1.0.0/src/testcases/CWE121_Stack_Based_Buffer_Overflow/s02/CWE121_Stack_Based_Buffer_Overflow__CWE193_wchar_t_alloca_memcpy_54a.c" }, "sourc...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE121_Stack_Based_Buffer_Overflow__CWE193_wchar_t_alloca_memcpy_54a.c Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE193.label.xml Template File: sources-sink-54a.tmpl.c */ /* * @description * CWE: 121 Stack Based Buffer Overflow * BadSource: Point data ...
0
CWE-79
453172-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 = gzencode($tainted, 9); $dataflow = $sanitized; $context = (("<a href=\"" . $dataflow) . "\">link</a>"); echo($context); ?>
null
null
1
CWE-23
91839-v1.0.0/src/testcases/CWE23_Relative_Path_Traversal/s04/CWE23_Relative_Path_Traversal__wchar_t_listen_socket_ofstream_04.cpp
cplusplus
CWE: 23 Relative Path Traversal BadSource: listen_socket Read data using a listen socket (server side) GoodSource: Use a fixed file name Sink: ofstream BadSink : Open the file named in data using ofstream::open() Flow Variant: 04 Control flow: if(STATIC_CONST_TRUE) and if(STATIC_CONST_FALSE)
#include "std_testcase.h" #ifdef _WIN32 #define BASEPATH L"c:\\temp\\" #else #include <wchar.h> #define BASEPATH L"/tmp/" #endif #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/sock...
[ { "hashes": { "sha-256": "25fc6ad5e1f00a51206222c31f96fc764aaeb85033e9825ebd498bfded11a260" }, "length": 6937, "location": { "uri": "91839-v1.0.0/src/testcases/CWE23_Relative_Path_Traversal/s04/CWE23_Relative_Path_Traversal__wchar_t_listen_socket_ofstream_04.cpp" }, "sourceLangua...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE23_Relative_Path_Traversal__wchar_t_listen_socket_ofstream_04.cpp Label Definition File: CWE23_Relative_Path_Traversal.label.xml Template File: sources-sink-04.tmpl.cpp */ /* * @description * CWE: 23 Relative Path Traversal * BadSource: listen_socket Read data using a...
0
CWE-89
466539-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_EMAIL); $sanitized = htmlspecialchars($tainted, ENT_QUOTES); $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE password ='" . $dataflow) . "';")...
null
null
1
CWE-79
433777-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 = htmlspecialchars($tainted, ENT_COMPAT); $dataflow = $sanitized; $context = (("<a href=\"" . $dataflow) . "\">link</a>"); trigger_error($context, E_USER_ERROR); ?>
null
null
1
CWE-78
245979-v2.0.0/src/testcases/CWE78_OS_Command_Injection/s04/CWE78_OS_Command_Injection__char_listen_socket_execlp_68a.c
c
CWE: 78 OS Command Injection BadSource: listen_socket Read data using a listen socket (server side) GoodSource: Fixed string Sink: execlp BadSink : execute command with execlp Flow Variant: 68 Data flow: data passed as a global variable from one function to another in different source files
#include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define COMMAND_INT_PATH "%WINDIR%\\system32\\cmd.exe" #define COMMAND_INT "cmd.exe" #define COMMAND_ARG1 "/c" #define COMMAND_ARG2 "dir " #define COMMAND_ARG3 data #else #include <unistd.h> #define COMMAND_INT_PATH "/bin/sh" #define COMMAND_INT "sh" #define...
[ { "hashes": { "sha-256": "c813ff0264fddb508afd96ead184b514e837a14e0a00347e500fac9b845cb18e" }, "length": 6114, "location": { "uri": "245979-v2.0.0/src/testcases/CWE78_OS_Command_Injection/s04/CWE78_OS_Command_Injection__char_listen_socket_execlp_68a.c" }, "sourceLanguage": "c" ...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE78_OS_Command_Injection__char_listen_socket_execlp_68a.c Label Definition File: CWE78_OS_Command_Injection.strings.label.xml Template File: sources-sink-68a.tmpl.c */ /* * @description * CWE: 78 OS Command Injection * BadSource: listen_socket Read data using a listen ...
0
CWE-79
322776-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_ireplace(["\"", "'", "<", ">"], "", $tainted); $dataflow = $sanitized; $context = (("Hello to \"" . $dataflow) . "\""); echo($context); ?>
null
null
0
CWE-89
473043-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_INT); if(is_float($tainted)) { $sanitized = $tainted; $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE password =\"" . $dataflow) ...
null
null
0
CWE-79
439952-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 = str_ireplace(["\"", "'", "<", ">"], "", $tainted); $dataflow = $sanitized; $context = (("Hello to \"" . $dataflow) . "\""); echo($context); ?>
null
null
0
CWE-89
409672-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(INPUT_GET, "t", FILTER_SANITIZE_URL); $sanitized = rawurlencode($tainted); $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE password ='" . $dataflow) . "';")...
null
null
0
CWE-79
392459-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); if(is_bool($tainted)) { $sanitized = $tainted; $dataflow = $sanitized; $pre = "<script>alert(Hello"; $post = ");</script>"; $context = ($pre . ($dataflow . $post)); user_error($context); } ?>
null
null
0
CWE-89
263167-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 = $_GET; $tainted = $tainted["t"]; $sanitized = ($tainted + 0.0); $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE pin =" . $dataflow) . ";"); ...
null
null
0
CWE-79
357009-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"]; if(settype($tainted, "int")) { $sanitized = $tainted; $dataflow = $sanitized; $context = ("Hello" . $dataflow); vprintf("This%d", $context); } ?>
null
null
0
CWE-79
297137-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(ctype_xdigit($tainted)) { $sanitized = $tainted; $dataflow = $sanitized; $context = (("<img src=\"" . $dataflow) . "\"/>"); vprintf("This%s", $context); } ?>
null
null
0
CWE-89
333002-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 = $_COOKIE; $tainted = $tainted["t"]; $sanitized = gzcompress($tainted); $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE...
null
null
0
CWE-89
307581-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_FULL_SPECIAL_CHARS); if(settype($tainted, "string")) { $sanitized = $tainted; $datafl...
null
null
0
CWE-79
308896-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 = ($tainted + 0); $dataflow = $sanitized; $context = (("Hello to '" . $dataflow) . "'"); vprintf("This%s", $context); ?>
null
null
0
CWE-89
387470-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 = (string)($tainted); $dataflow = $sa...
null
null
1
CWE-191
84779-v1.0.0/src/testcases/CWE191_Integer_Underflow/s01/CWE191_Integer_Underflow__char_fscanf_sub_51a.c
c
CWE: 191 Integer Underflow BadSource: fscanf Read data from the console using fscanf() GoodSource: Set data to a small, non-zero number (negative two) Sinks: sub GoodSink: Ensure there will not be an underflow before subtracting 1 from data BadSink : Subtract 1 from data, which can cause an Underflow Flow Variant...
#include "std_testcase.h" #ifndef OMITBAD void CWE191_Integer_Underflow__char_fscanf_sub_51b_badSink(char data); void CWE191_Integer_Underflow__char_fscanf_sub_51_bad() { char data; data = ' '; fscanf (stdin, "%c", &data); CWE191_Integer_Underflow__char_fscanf_sub_51b_badSink(data); } #endif ...
[ { "hashes": { "sha-256": "5a8a340698a416bc80a3b60a7e75c9f1b4802db855ac5e6fe1e72cc1d5ac261e" }, "length": 2774, "location": { "uri": "84779-v1.0.0/src/testcases/CWE191_Integer_Underflow/s01/CWE191_Integer_Underflow__char_fscanf_sub_51a.c" }, "sourceLanguage": "c" }, { "has...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE191_Integer_Underflow__char_fscanf_sub_51a.c Label Definition File: CWE191_Integer_Underflow.label.xml Template File: sources-sinks-51a.tmpl.c */ /* * @description * CWE: 191 Integer Underflow * BadSource: fscanf Read data from the console using fscanf() * GoodSource...
0
CWE-89
409543-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 = getallheaders(); $tainted = $tainted["t"]; $sanitized = hexdec($tainted); $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE password ='" . $da...
null
null
0
CWE-79
372581-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 = filter_var($tainted, FILTER_UNSAFE_RAW); $dataflow = $sanitized; $context = ("Hello" . $dataflow); vprintf("This%d", $context); ?>
null
null
0
CWE-79
372422-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_UNSAFE_RAW]); $tainted = $tainted["t"]; $sanitized = password_hash($tainted, PASSWORD_DEFAULT); $dataflow = $sanitized; $context = (("Hello to \"" . $dataflow) . "\""); print($context); ?>
null
null
0
CWE-89
310201-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_EMAIL]); $tainted = $tainted["t"]; $sanitized = hash_hmac("md5", $tainted, "salt"); $dataflow = $sanitized; $context = (("SELECT * ...
null
null
0
CWE-79
389031-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 = (double)($tainted); $dataflow = $sanitized; $context = (("<a href=\"" . $dataflow) . "\">link</a>"); user_error($context); ?>
null
null
0
CWE-79
371482-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 = filter_var($tainted, FILTER_SANITIZE_EMAIL); $dataflow = $sanitized; $context = (("<a href=\"" . $dataflow) . "\">link</a>"); printf("Print this: %s", $context); ?>
null
null
0
CWE-89
273286-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_FLOAT); $sanitized = strpos($tainted, "needle"); $dataflow = $sanitized; $context ...
null
null
0
CWE-79
312111-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(ctype_cntrl($tainted)) { $sanitized = $tainted; $dataflow = $sanitized; $pre = "<script>alert(\"Hello"; $post = "\");</script>"; $context = ($pre . ($dataflow . $post)); trigger_erro...
null
null
0
CWE-89
462282-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 = $_COOKIE; $tainted = $tainted["t"]; if(preg_match("/^[A-Za-z]*$/", $tainted)) { $sanitized = $tainted; $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE pin =" . $dataflow) . ";"); $results = $db->query($context); w...
null
null
0
CWE-79
398136-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_NUMBER_FLOAT); $dataflow = $sanitized; $context = ("Hello" . $dataflow); exit($context); ?>
null
null
0
CWE-79
394755-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 = $tainted+= 0; $dataflow = $sanitized; $context = (("<a href=\"" . $dataflow) . "\">link</a>"); printf("Print this: %s", $context); ?>
null
null
0
CWE-79
419183-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_numeric($tainted)) { $sanitized = $tainted; $dataflow = $sanitized; $context = (("Hello to '" . $dataflow) . "'"); print($context); } ?>
null
null
0
CWE-79
278700-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(INPUT_GET, "t", FILTER_SANITIZE_SPECIAL_CHARS); if(in_array($tainted, $legal, true)) { $sanitized = $tainted; $dataflow = $sanitized; $pre = "<script>alert(\"Hello"; $post = "\");</script>"; $context = ($pre . ($dataflow . $post)); ...
null
null
0
CWE-79
370796-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_word_count($tainted, 0); $dataflow = $sanitized; $context = (("Hello to \"" . $dataflow) . "\""); user_error($context); ?>
null
null
0
CWE-79
442931-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 = password_hash($tainted, PASSWORD_DEFAULT); $dataflow = $sanitized; $context = (("Hello to \"" . $dataflow) . "\""); print($context); ?>
null
null
1
CWE-79
262264-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 = filter_var($tainted, FILTER_SANITIZE_URL); $dataflow = $sanitized; $context = (("<a href=\"" . $dataflow) . "\">link</a>"); user_error($context); ?>
null
null
1
CWE-126
75647-v1.0.0/src/testcases/CWE126_Buffer_Overread/s01/CWE126_Buffer_Overread__CWE129_fgets_02.c
c
CWE: 126 Buffer Overread BadSource: fgets Read data from the console using fgets() GoodSource: Larger than zero but less than 10 Sinks: GoodSink: Ensure the array index is valid BadSink : Improperly check the array index by not checking the upper bound Flow Variant: 02 Control flow: if(1) and if(0)
#include "std_testcase.h" #define CHAR_ARRAY_SIZE (3 * sizeof(data) + 2) #ifndef OMITBAD void CWE126_Buffer_Overread__CWE129_fgets_02_bad() { int data; data = -1; if(1) { { char inputBuffer[CHAR_ARRAY_SIZE] = ""; if (fgets(inputBuffer, CHAR_ARRAY_SIZE...
[ { "hashes": { "sha-256": "a4ef926620cda22fd1977227428bc3392bdeaed3e94ca173731c669320c8ad96" }, "length": 6747, "location": { "uri": "75647-v1.0.0/src/testcases/CWE126_Buffer_Overread/s01/CWE126_Buffer_Overread__CWE129_fgets_02.c" }, "sourceLanguage": "c" }, { "hashes": { ...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE126_Buffer_Overread__CWE129_fgets_02.c Label Definition File: CWE126_Buffer_Overread__CWE129.label.xml Template File: sources-sinks-02.tmpl.c */ /* * @description * CWE: 126 Buffer Overread * BadSource: fgets Read data from the console using fgets() * GoodSource: Lar...
0
CWE-89
275380-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); if(is_real($tainted)) { $sanitized = $tainted; $dataflow = $sanitized; $con...
null
null
0
CWE-79
330288-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 = password_hash($tainted, PASSWORD_DEFAULT); $dataflow = $sanitized; $context = (("<img src=\"" . $dataflow) . "\"/>"); printf("Print this: %d", $context); ?>
null
null
0
CWE-79
499322-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 = (($tainted == "DESC") ? "DESC" : "ASC"); $dataflow = $sanitized; $context = (("Hello to '" . $dataflow) . "'"); print($context); ?>
null
null
0
CWE-79
264198-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_FULL_SPECIAL_CHARS); if(settype($tainted, "bool")) { $sanitized = $tainted; $dataflow = $sanitized; $context = (("Hello to \"" . $dataflow) . "\""); exit($context); } ?>
null
null
0
CWE-79
414134-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"]; if(settype($tainted, "float")) { $sanitized = $tainted; $dataflow = $sanitized; $pre = "<script>alert(Hello"; $post = ");</script>"; $context = ($pre . ($dataflow . $post)); vprintf("This%s", $context); } ?>
null
null
1
CWE-127
77405-v1.0.0/src/testcases/CWE127_Buffer_Underread/s01/CWE127_Buffer_Underread__char_alloca_ncpy_04.c
c
CWE: 127 Buffer Under-read BadSource: Set data pointer to before the allocated memory buffer GoodSource: Set data pointer to the allocated memory buffer Sink: ncpy BadSink : Copy data to string using strncpy Flow Variant: 04 Control flow: if(STATIC_CONST_TRUE) and if(STATIC_CONST_FALSE)
#include "std_testcase.h" #include <wchar.h> static const int STATIC_CONST_TRUE = 1; static const int STATIC_CONST_FALSE = 0; #ifndef OMITBAD void CWE127_Buffer_Underread__char_alloca_ncpy_04_bad() { char * data; char * dataBuffer = (char *)ALLOCA(100*sizeof(char)); memset(dataBuffer, 'A', 100-1); ...
[ { "hashes": { "sha-256": "12c3e8b67440cd833375a72b0dfb0ced3dfb03dfea1d4b1055e4bf1b2f64756e" }, "length": 4327, "location": { "uri": "77405-v1.0.0/src/testcases/CWE127_Buffer_Underread/s01/CWE127_Buffer_Underread__char_alloca_ncpy_04.c" }, "sourceLanguage": "c" }, { "hashe...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE127_Buffer_Underread__char_alloca_ncpy_04.c Label Definition File: CWE127_Buffer_Underread.stack.label.xml Template File: sources-sink-04.tmpl.c */ /* * @description * CWE: 127 Buffer Under-read * BadSource: Set data pointer to before the allocated memory buffer * G...
1
CWE-23
91465-v1.0.0/src/testcases/CWE23_Relative_Path_Traversal/s04/CWE23_Relative_Path_Traversal__wchar_t_environment_w32CreateFile_14.cpp
cplusplus
CWE: 23 Relative Path Traversal BadSource: environment Read input from an environment variable GoodSource: Use a fixed file name Sink: w32CreateFile BadSink : Open the file named in data using CreateFile() Flow Variant: 14 Control flow: if(globalFive==5) and if(globalFive!=5)
#include "std_testcase.h" #ifdef _WIN32 #define BASEPATH L"c:\\temp\\" #else #include <wchar.h> #define BASEPATH L"/tmp/" #endif #define ENV_VARIABLE L"ADD" #ifdef _WIN32 #define GETENV _wgetenv #else #define GETENV getenv #endif #include <windows.h> namespace CWE23_Relative_Path_Traversal__wchar_t_environment_w32...
[ { "hashes": { "sha-256": "431f37171c212d1c037f94889ec55b18d5fe8f1b4e3dc9393cb2756473b3679f" }, "length": 4976, "location": { "uri": "91465-v1.0.0/src/testcases/CWE23_Relative_Path_Traversal/s04/CWE23_Relative_Path_Traversal__wchar_t_environment_w32CreateFile_14.cpp" }, "sourceLan...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE23_Relative_Path_Traversal__wchar_t_environment_w32CreateFile_14.cpp Label Definition File: CWE23_Relative_Path_Traversal.label.xml Template File: sources-sink-14.tmpl.cpp */ /* * @description * CWE: 23 Relative Path Traversal * BadSource: environment Read input from ...
0
CWE-79
473616-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 = crypt($tainted); $dataflow = $sanitized; $context = (("Hello to \"" . $dataflow) . "\""); print($context); ?>
null
null
0
CWE-89
324552-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_FLOAT); $sanitized = strtr($tainted, "'", " "); $dataflow = $sanitized; $context =...
null
null
0
CWE-79
255714-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 = htmlspecialchars($tainted, ENT_QUOTES); $dataflow = $sanitized; $context = (("<img src=\"" . $dataflow) . "\"/>"); exit($context); ?>
null
null
0
CWE-79
259922-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 = bin2hex($tainted); $dataflow = $sanitized; $context = (("<a href=\"" . $dataflow) . "\">link</a>"); printf("Print this: %s", $context); ?>
null
null
0
CWE-89
378484-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 = $_REQUEST; $tainted = $tainted["t"]; if(is_bool($tainted)) { $sanitized = $tainted; $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE pi...
null
null
0
CWE-79
287674-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 = str_replace(["\"", "'", "<", ">"], "", $tainted); $dataflow = $sanitized; $pre = "<script>alert(\"Hello"; $post = "\");</script>"; $context = ($pre . ($dataflow . $post)); printf("Print this: %s", $context); ?>
null
null
1
CWE-79
429693-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 = filter_var($tainted, FILTER_SANITIZE_URL); $dataflow = $sanitized; $context = (("<img src=\"" . $dataflow) . "\"/>"); print($context); ?>
null
null
0
CWE-79
411245-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 = doubleval($tainted); $dataflow = $sanitized; $context = (("Hello to '" . $dataflow) . "'"); vprintf("This%d", $context); ?>
null
null
0
CWE-89
339091-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]); $tainted = $tainted["t"]; if(settype($tainted,...
null
null
0
CWE-89
413746-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_SPECIAL_CHARS); $sanitized = (($tainted == "DESC") ? "DESC" : "ASC"); $dataflow = $saniti...
null
null
1
CWE-79
362989-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_UNSAFE_RAW]); $tainted = $tainted["t"]; if(settype($tainted, "string")) { $sanitized = $tainted; $dataflow = $sanitized; $context = (("<a href=\"" . $dataflow) . "\">link</a>"); print($context); } ?>
null
null
0
CWE-79
374852-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"]; if(is_bool($tainted)) { $sanitized = $tainted; $dataflow = $sanitized; $context = (("Hello to \"" . $dataflow) . "\""); trigger_error($context, E_USER_ERROR); } ?>
null
null
1
CWE-126
77023-v1.0.0/src/testcases/CWE126_Buffer_Overread/s03/CWE126_Buffer_Overread__wchar_t_declare_memmove_14.c
c
CWE: 126 Buffer Over-read BadSource: Set data pointer to a small buffer GoodSource: Set data pointer to a large buffer Sink: memmove BadSink : Copy data to string using memmove Flow Variant: 14 Control flow: if(globalFive==5) and if(globalFive!=5)
#include "std_testcase.h" #include <wchar.h> #ifndef OMITBAD void CWE126_Buffer_Overread__wchar_t_declare_memmove_14_bad() { wchar_t * data; wchar_t dataBadBuffer[50]; wchar_t dataGoodBuffer[100]; wmemset(dataBadBuffer, L'A', 50-1); dataBadBuffer[50-1] = L'\0'; wmemset(dataGoodBuffer, L'A',...
[ { "hashes": { "sha-256": "21ea5786c8c8dd3c64cc887517cb2d3ec46a2d81f5d28b3289c4390777fbd167" }, "length": 4552, "location": { "uri": "77023-v1.0.0/src/testcases/CWE126_Buffer_Overread/s03/CWE126_Buffer_Overread__wchar_t_declare_memmove_14.c" }, "sourceLanguage": "c" }, { "...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE126_Buffer_Overread__wchar_t_declare_memmove_14.c Label Definition File: CWE126_Buffer_Overread.stack.label.xml Template File: sources-sink-14.tmpl.c */ /* * @description * CWE: 126 Buffer Over-read * BadSource: Set data pointer to a small buffer * GoodSource: Set d...
0
CWE-79
269581-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"]; if(preg_match("/^[A-Za-z]*$/", $tainted)) { $sanitized = $tainted; $dataflow = $sanitized; $context = (("Hello to \"" . $dataflow) . "\""); printf("Print this: %d", $context); } ?>
null
null
0
CWE-79
316593-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"]; if(is_numeric($tainted)) { $sanitized = $tainted; $dataflow = $sanitized; $context = (("Hello to '" . $dataflow) . "'"); exit($context); } ?>
null
null
0
CWE-89
458059-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_FULL_SPECIAL_CHARS]); $tainted = $tainted["t"]; if(preg_match("/^[A-Za-z]*$/", $tainted)) { $sanitiz...
null
null
0
CWE-89
289459-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 = $_COOKIE; $tainted = $tainted["t"]; $sanitized = strspn($tainted, "needle)"); $dataflow = $sanitized; $context = (...
null
null
0
CWE-89
274553-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 = $_REQUEST; $tainted = $tainted["t"]; if(is_integer($tainted)) { $sanitized = $tainted; $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE pin =" . $dataflow) . ";"); $stmt = $pdo->pr...
null
null
1
CWE-191
86047-v1.0.0/src/testcases/CWE191_Integer_Underflow/s03/CWE191_Integer_Underflow__short_rand_multiply_02.c
c
CWE: 191 Integer Underflow BadSource: rand Set data to result of rand() GoodSource: Set data to a small, non-zero number (negative two) Sinks: multiply GoodSink: Ensure there will not be an underflow before multiplying data by 2 BadSink : If data is negative, multiply by 2, which can cause an underflow Flow Varia...
#include "std_testcase.h" #ifndef OMITBAD void CWE191_Integer_Underflow__short_rand_multiply_02_bad() { short data; data = 0; if(1) { data = (short)RAND32(); } if(1) { if(data < 0) { short result = data * 2; printIntLin...
[ { "hashes": { "sha-256": "c6929db7b4fd129cb54072e8ffbb145670b01932a042421bf5074b126acf4d9d" }, "length": 4952, "location": { "uri": "86047-v1.0.0/src/testcases/CWE191_Integer_Underflow/s03/CWE191_Integer_Underflow__short_rand_multiply_02.c" }, "sourceLanguage": "c" }, { "...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE191_Integer_Underflow__short_rand_multiply_02.c Label Definition File: CWE191_Integer_Underflow.label.xml Template File: sources-sinks-02.tmpl.c */ /* * @description * CWE: 191 Integer Underflow * BadSource: rand Set data to result of rand() * GoodSource: Set data to...
0
CWE-79
372636-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(preg_match_all("/^[A-Za-z0-9]*$/", $tainted)) { $sanitized = $tainted; $dataflow = $sanitized; $context = (("Hello to \"" . $dataflow) . "\""); vprintf("This%s", $context); } ?>
null
null
0
CWE-79
418968-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 = htmlentities($tainted); $dataflow = $sanitized; $context = (("<img src=\"" . $dataflow) . "\"/>"); print($context); ?>
null
null
1
CWE-36
96893-v1.0.0/src/testcases/CWE36_Absolute_Path_Traversal/s03/CWE36_Absolute_Path_Traversal__wchar_t_connect_socket_open_12.cpp
cplusplus
CWE: 36 Absolute Path Traversal BadSource: connect_socket Read data using a connect socket (client side) GoodSource: Full path and file name Sink: open BadSink : Open the file named in data using open() Flow Variant: 12 Control flow: if(globalReturnsTrueOrFalse())
#include "std_testcase.h" #ifndef _WIN32 #include <wchar.h> #endif #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...
[ { "hashes": { "sha-256": "7280f52ca36dd3dcde0ddc3a46795957c6aaee2aa42ec606e97058b309e481cb" }, "length": 6469, "location": { "uri": "96893-v1.0.0/src/testcases/CWE36_Absolute_Path_Traversal/s03/CWE36_Absolute_Path_Traversal__wchar_t_connect_socket_open_12.cpp" }, "sourceLanguage"...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE36_Absolute_Path_Traversal__wchar_t_connect_socket_open_12.cpp Label Definition File: CWE36_Absolute_Path_Traversal.label.xml Template File: sources-sink-12.tmpl.cpp */ /* * @description * CWE: 36 Absolute Path Traversal * BadSource: connect_socket Read data using a c...
0
CWE-79
292368-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 = rawurlencode($tainted); $dataflow = $sanitized; $context = (("Hello to '" . $dataflow) . "'"); vprintf("This%s", $context); ?>
null
null
1
CWE-89
342507-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_EMAIL); $sanitized = htmlspecialchars($tainted, ENT_NOQUOTES); $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE pin =" . $dataflow) . ";"); $results = $db->query($context); while(...
null
null
0
CWE-79
370951-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 = htmlentities($tainted); $dataflow = $sanitized; $context = (("<img src=\"" . $dataflow) . "\"/>"); vprintf("This%d", $context); ?>
null
null
0
CWE-79
349097-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 = crypt($tainted); $dataflow = $sanitized; $context = (("<img src=\"" . $dataflow) . "\"/>"); vprintf("This%d", $context); ?>
null
null
1
CWE-122
69617-v1.0.0/src/testcases/CWE122_Heap_Based_Buffer_Overflow/s04/CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_wchar_t_loop_61a.cpp
cplusplus
CWE: 122 Heap Based Buffer Overflow BadSource: Initialize data as a large string GoodSource: Initialize data as a small string Sinks: loop BadSink : Copy data to string using a loop Flow Variant: 61 Data flow: data returned from one function to another in different source files
#include "std_testcase.h" #include <wchar.h> namespace CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_wchar_t_loop_61 { #ifndef OMITBAD wchar_t * badSource(wchar_t * data); void bad() { wchar_t * data; data = new wchar_t[100]; data = badSource(data); { wchar_t dest[50] = L""; size_t...
[ { "hashes": { "sha-256": "7dbf759332860916ffeac22ef3cde7e303b426337678167ed8c85f14d88c9e66" }, "length": 2908, "location": { "uri": "69617-v1.0.0/src/testcases/CWE122_Heap_Based_Buffer_Overflow/s04/CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_wchar_t_loop_61a.cpp" }, "sourceLang...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_wchar_t_loop_61a.cpp Label Definition File: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806.label.xml Template File: sources-sink-61a.tmpl.cpp */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Initialize ...
0
CWE-79
488267-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 = (("<a href=\"" . $dataflow) . "\">link</a>"); vprintf("This%d", $context); ?>
null
null
1
CWE-121
64624-v1.0.0/src/testcases/CWE121_Stack_Based_Buffer_Overflow/s04/CWE121_Stack_Based_Buffer_Overflow__CWE805_int_alloca_memcpy_66a.c
c
CWE: 121 Stack Based Buffer Overflow BadSource: Set data pointer to the bad buffer GoodSource: Set data pointer to the good buffer Sinks: memcpy BadSink : Copy int array to data using memcpy Flow Variant: 66 Data flow: data passed in an array from one function to another in different source files
#include "std_testcase.h" #ifndef OMITBAD void CWE121_Stack_Based_Buffer_Overflow__CWE805_int_alloca_memcpy_66b_badSink(int * dataArray[]); void CWE121_Stack_Based_Buffer_Overflow__CWE805_int_alloca_memcpy_66_bad() { int * data; int * dataArray[5]; int * dataBadBuffer = (int *)ALLOCA(50*sizeof(int)); ...
[ { "hashes": { "sha-256": "62a7118142d8ec792d98394bebd5c7abeab2dd05002a4e786b091451b0a45d51" }, "length": 2967, "location": { "uri": "64624-v1.0.0/src/testcases/CWE121_Stack_Based_Buffer_Overflow/s04/CWE121_Stack_Based_Buffer_Overflow__CWE805_int_alloca_memcpy_66a.c" }, "sourceLan...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE121_Stack_Based_Buffer_Overflow__CWE805_int_alloca_memcpy_66a.c Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE805.label.xml Template File: sources-sink-66a.tmpl.c */ /* * @description * CWE: 121 Stack Based Buffer Overflow * BadSource: Set data pointe...
1
CWE-190
237024-v1.0.0/src/testcases/CWE190_Integer_Overflow/s07/CWE190_Integer_Overflow__int_rand_preinc_08.c
c
CWE: 190 Integer Overflow BadSource: rand Set data to result of rand(), which may be zero GoodSource: Set data to a small, non-zero number (two) Sinks: increment GoodSink: Ensure there will not be an overflow before incrementing data BadSink : Increment data, which can cause an overflow Flow Variant: 08 Control f...
#include "std_testcase.h" static int staticReturnsTrue() { return 1; } static int staticReturnsFalse() { return 0; } #ifndef OMITBAD void CWE190_Integer_Overflow__int_rand_preinc_08_bad() { int data; data = 0; if(staticReturnsTrue()) { data = RAND32(); } if(sta...
[ { "hashes": { "sha-256": "e03f7d4cabe64c7047dfdfb0af964e65e743fb14abc51bdd4ba5679f27e0efbf" }, "length": 5249, "location": { "uri": "237024-v1.0.0/src/testcases/CWE190_Integer_Overflow/s07/CWE190_Integer_Overflow__int_rand_preinc_08.c" }, "sourceLanguage": "c" }, { "hashe...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE190_Integer_Overflow__int_rand_preinc_08.c Label Definition File: CWE190_Integer_Overflow__int.label.xml Template File: sources-sinks-08.tmpl.c */ /* * @description * CWE: 190 Integer Overflow * BadSource: rand Set data to result of rand(), which may be zero * GoodSo...
0
CWE-79
449439-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 = zlib_encode($tainted, ZLIB_ENCODING_DEFLATE); $dataflow = $sanitized; $pre = "<script>alert(\"Hello"; $post = "\");</script>"; $context = ($pre . ($dataflow . $post)); exit($context); ?>
null
null
0
CWE-89
260255-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_FLOAT); $sanitized = hexdec($tainted); $dataflow = $sanitized; $context = (("SELEC...
null
null
0
CWE-79
313231-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 = strtr($tainted, "'", " "); $dataflow = $sanitized; $context = (("Hello to \"" . $dataflow) . "\""); vprintf("This%d", $context); ?>
null
null
1
CWE-122
69556-v1.0.0/src/testcases/CWE122_Heap_Based_Buffer_Overflow/s04/CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_snprintf_31.cpp
cplusplus
CWE: 122 Heap Based Buffer Overflow BadSource: Initialize data as a large string GoodSource: Initialize data as a small string Sinks: snprintf BadSink : Copy data to string using snprintf Flow Variant: 31 Data flow using a copy of data within the same function
#include "std_testcase.h" #include <wchar.h> #ifdef _WIN32 #define SNPRINTF _snprintf #else #define SNPRINTF snprintf #endif namespace CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_snprintf_31 { #ifndef OMITBAD void bad() { char * data; data = new char[100]; memset(data, 'A', 100-1); dat...
[ { "hashes": { "sha-256": "17fb8c1c2126583a58cd4e6a535a3f6a53a776a9c514985a1aec9c89f81797ac" }, "length": 3033, "location": { "uri": "69556-v1.0.0/src/testcases/CWE122_Heap_Based_Buffer_Overflow/s04/CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_snprintf_31.cpp" }, "sourceLang...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806_char_snprintf_31.cpp Label Definition File: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE806.label.xml Template File: sources-sink-31.tmpl.cpp */ /* * @description * CWE: 122 Heap Based Buffer Overflow * BadSource: Initialize d...
0
CWE-79
254978-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_UNSAFE_RAW]); $tainted = $tainted["t"]; $sanitized = filter_var($tainted, FILTER_SANITIZE_EMAIL); $dataflow = $sanitized; $pre = "<script>alert(Hello"; $post = ");</script>"; $context = ($pre . ($dataflow . $post)); vprintf("This%d", $contex...
null
null
0
CWE-89
367376-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 = $_COOKIE; $tainted = $tainted["t"]; $sanitized = str_replace("'", "", $tainted); $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE password ='...
null
null
0
CWE-79
284361-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 = strspn($tainted, "needle)"); $dataflow = $sanitized; $context = (("Hello to \"" . $dataflow) . "\""); exit($context); ?>
null
null
0
CWE-89
429634-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(INPUT_GET, "t", FILTER_SANITIZE_SPECIAL_CHARS); $sanitized = strrpos($tainted, "needle"); $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE password ='" . $da...
null
null
1
CWE-23
91318-v1.0.0/src/testcases/CWE23_Relative_Path_Traversal/s04/CWE23_Relative_Path_Traversal__wchar_t_environment_ifstream_11.cpp
cplusplus
CWE: 23 Relative Path Traversal BadSource: environment Read input from an environment variable GoodSource: Use a fixed file name Sink: ifstream BadSink : Open the file named in data using ifstream::open() 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 #define ENV_VARIABLE L"ADD" #ifdef _WIN32 #define GETENV _wgetenv #else #define GETENV getenv #endif #include <fstream> using namespace std; namespace CWE23_Relative_Path_Traversal__wcha...
[ { "hashes": { "sha-256": "83a40a606afcfc8fd25c320d0e7783ca8623c18ca7dcfca1fb3778def946ee8e" }, "length": 4035, "location": { "uri": "91318-v1.0.0/src/testcases/CWE23_Relative_Path_Traversal/s04/CWE23_Relative_Path_Traversal__wchar_t_environment_ifstream_11.cpp" }, "sourceLanguage...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE23_Relative_Path_Traversal__wchar_t_environment_ifstream_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: environment Read input from an en...
0
CWE-79
297731-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 = filter_var($tainted, FILTER_SANITIZE_SPECIAL_CHARS); $dataflow = $sanitized; $context = (("Hello to \"" . $dataflow) . "\""); vprintf("This%d", $context); ?>
null
null
1
CWE-89
337706-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_UNSAFE_RAW); $sanitized = filter_var($tainted, FILTER_SANITIZE_URL); $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE password ='" . $dataflow) . "';");...
null
null
1
CWE-89
318789-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 = getallheaders(); $tainted = $tainted["t"]; $sanitized = str_shuffle($tainted); $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE password =\"" . $dataflow) . "\";"); $results = $pdo->query(...
null
null
0
CWE-89
340755-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 = floatval($tainted); $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE pas...
null
null
0
CWE-89
270302-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_ADD_SLASHES]); $tainted = $tainted["t"]; $sanitized = filter_var($tainted, FILTE...
null
null
0
CWE-79
451688-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 = (string)($tainted); $dataflow = $sanitized; $context = (("Hello to '" . $dataflow) . "'"); vprintf("This%d", $context); ?>
null
null
0
CWE-89
424245-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 = strpos($tainted, "needle"); $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE password ='...
null
null
0
CWE-79
452975-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_FULL_SPECIAL_CHARS); $sanitized = (string)($tainted); $dataflow = $sanitized; $context = (("<img src=\"" . $dataflow) . "\"/>"); echo($context); ?>
null
null
0
CWE-79
441118-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 = password_hash($tainted, PASSWORD_DEFAULT); $dataflow = $sanitized; $pre = "<script>alert(Hello"; $post = ");</script>"; $context = ($pre . ($dataflow . $post)); printf("Print th...
null
null
0
CWE-89
289815-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_array(INPUT_GET, ["t" => FILTER_SANITIZE_NUMBER_INT]); $tainted = $tainted["t"]; $sanitized = intval($tainted); $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE pin =" . $dataflow) . ";"); $results = $db->query(...
null
null
0
CWE-89
422701-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_UNSAFE_RAW); $sanitized = base64_encode($tainted); $dataflow = $sanitized; $context = (("SELECT * FROM users WHERE pin =...
null
null
1
CWE-190
237236-v1.0.0/src/testcases/CWE190_Integer_Overflow/s07/CWE190_Integer_Overflow__unsigned_int_max_preinc_53a.c
c
CWE: 190 Integer Overflow BadSource: max Set data to the max value for unsigned int GoodSource: Set data to a small, non-zero number (two) Sinks: increment GoodSink: Ensure there will not be an overflow before incrementing data BadSink : Increment data, which can cause an overflow Flow Variant: 53 Data flow: data...
#include "std_testcase.h" #ifndef OMITBAD void CWE190_Integer_Overflow__unsigned_int_max_preinc_53b_badSink(unsigned int data); void CWE190_Integer_Overflow__unsigned_int_max_preinc_53_bad() { unsigned int data; data = 0; data = UINT_MAX; CWE190_Integer_Overflow__unsigned_int_max_preinc_53b_bad...
[ { "hashes": { "sha-256": "d3553340da31701e985f53c5dd096debc61b728204ab9680f8df7515a838cb0e" }, "length": 2896, "location": { "uri": "237236-v1.0.0/src/testcases/CWE190_Integer_Overflow/s07/CWE190_Integer_Overflow__unsigned_int_max_preinc_53a.c" }, "sourceLanguage": "c" }, { ...
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE190_Integer_Overflow__unsigned_int_max_preinc_53a.c Label Definition File: CWE190_Integer_Overflow.label.xml Template File: sources-sinks-53a.tmpl.c */ /* * @description * CWE: 190 Integer Overflow * BadSource: max Set data to the max value for unsigned int * GoodSou...
0
CWE-79
432322-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(fnmatch("whitelisting", $tainted, 0)) { $sanitized = $tainted; $dataflow = $sanitized; $context = (("<a href=\"" . $dataflow) . "\">link</a>"); printf("Print this: %s", $context)...
null
null
0
CWE-79
429042-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 = md5($tainted, false); $dataflow = $sanitized; $context = (("<a href=\"" . $dataflow) . "\">link</a>"); vprintf("This%d", $context); ?>
null
null