{"@ID": "1177", "@Name": "Use of Prohibited Code", "@Abstraction": "Class", "@Structure": "Simple", "@Status": "Incomplete", "Description": "The product uses a function, library, or third party component\n\t     that has been explicitly prohibited, whether by the developer or\n\t     the customer.", "Related_Weaknesses": {"Related_Weakness": {"@Nature": "ChildOf", "@CWE_ID": "710", "@View_ID": "1000", "@Ordinal": "Primary"}}, "Weakness_Ordinalities": {"Weakness_Ordinality": [{"Ordinality": "Indirect"}, {"Ordinality": "Primary"}]}, "Applicable_Platforms": {"Language": {"@Class": "Not Language-Specific", "@Prevalence": "Undetermined"}}, "Modes_Of_Introduction": {"Introduction": [{"Phase": "Requirements", "Note": "To reduce risk of vulnerabilities, the developer -\n\t      or customers - may wish to restrict or eliminate use of\n\t      a function, library, or third party component for any\n\t      number of reasons, including real or suspected\n\t      vulnerabilities; difficulty to use securely; export\n\t      controls or license requirements; obsolete or\n\t      poorly-maintained code; internal code being scheduled\n\t      for deprecation; etc. This might be achieved using a\n\t      list of \"banned\" functions that programmers must avoid\n\t      using, because the functions are difficult or impossible\n\t      to use securely."}, {"Phase": "Implementation"}]}, "Common_Consequences": {"Consequence": {"Scope": "Other", "Impact": "Reduce Maintainability", "Note": "This issue can also make the product more costly and difficult to maintain."}}, "Detection_Methods": {"Detection_Method": {"@Detection_Method_ID": "DM-14", "Method": "Automated Static Analysis", "Description": "Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect \"sources\" (origins of input) with \"sinks\" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)", "Effectiveness": "High"}}, "Potential_Mitigations": {"Mitigation": {"@Mitigation_ID": "MIT-58", "Phase": ["Build and Compilation", "Implementation"], "Description": "Identify a list of prohibited API functions and prohibit developers from using these functions, providing safer alternatives. In some cases, automatic code analysis tools or the compiler can be instructed to spot use of prohibited functions, such as the \"banned.h\" include file from Microsoft's SDL. [REF-554] [REF-1009] [REF-7]"}}, "Demonstrative_Examples": {"Demonstrative_Example": [{"@Demonstrative_Example_ID": "DX-5", "Intro_Text": "The code below calls the gets() function to read in data from the command line.", "Example_Code": {"@Nature": "Bad", "@Language": "C", "xhtml:div": {"xhtml:div": {"@style": "margin-left:1em;", "xhtml:br": [null, null, null], "#text": "char buf[24];printf(\"Please enter your name and press <Enter>\\n\");gets(buf);..."}, "#text": "}"}, "#text_blocks": ["char buf[24];", "printf(\"Please enter your name and press <Enter>\\n\");", "gets(buf);", "...", "}"]}, "Body_Text": "However, gets() is inherently unsafe, because it copies all input from STDIN to the buffer without checking size. This allows the user to provide a string that is larger than the buffer size, resulting in an overflow condition."}, {"@Demonstrative_Example_ID": "DX-6", "Intro_Text": "The following code attempts to create a local copy of a buffer to perform some manipulations to the data.", "Example_Code": {"@Nature": "Bad", "@Language": "C", "xhtml:div": {"xhtml:div": {"@style": "margin-left:1em;", "xhtml:br": [null, null], "#text": "char buf[24];strcpy(buf, string);..."}, "#text": "void manipulate_string(char * string){}"}, "#text_blocks": ["void manipulate_string(char * string){", "char buf[24];", "strcpy(buf, string);", "...", "}"]}, "Body_Text": "However, the programmer does not ensure that the size of the data pointed to by string will fit in the local buffer and copies the data with the potentially dangerous strcpy() function. This may result in a buffer overflow condition if an attacker can influence the contents of the string parameter."}]}, "Observed_Examples": {"Observed_Example": [{"Reference": "CVE-2007-1470", "Description": "Library has multiple buffer overflows using sprintf() and strcpy()", "Link": "https://www.cve.org/CVERecord?id=CVE-2007-1470"}, {"Reference": "CVE-2007-4004", "Description": "FTP client uses inherently insecure gets() function and is setuid root on some systems, allowing buffer overflow", "Link": "https://www.cve.org/CVERecord?id=CVE-2007-4004"}]}, "References": {"Reference": [{"@External_Reference_ID": "REF-554"}, {"@External_Reference_ID": "REF-1009"}, {"@External_Reference_ID": "REF-7"}]}, "Mapping_Notes": {"Usage": "Allowed-with-Review", "Rationale": "This CWE entry is a Class and might have Base-level children that would be more appropriate", "Comments": "Examine children of this entry to see if there is a better fit", "Reasons": {"Reason": {"@Type": "Abstraction"}}}, "Content_History": {"Submission": {"Submission_Name": "CWE Content Team", "Submission_Organization": "MITRE", "Submission_Date": "2019-01-03", "Submission_Version": "3.2", "Submission_ReleaseDate": "2019-01-03"}, "Modification": [{"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2020-02-24", "Modification_Version": "4.0", "Modification_ReleaseDate": "2020-02-24", "Modification_Comment": "updated References, Relationships"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-01-31", "Modification_Version": "4.10", "Modification_ReleaseDate": "2023-01-31", "Modification_Comment": "updated Description"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-04-27", "Modification_Version": "4.11", "Modification_ReleaseDate": "2023-04-27", "Modification_Comment": "updated References, Relationships, Time_of_Introduction"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2023-06-29", "Modification_Version": "4.12", "Modification_ReleaseDate": "2023-06-29", "Modification_Comment": "updated Mapping_Notes"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2024-02-29", "Modification_Version": "4.14", "Modification_ReleaseDate": "2024-02-29", "Modification_Comment": "updated Demonstrative_Examples, Observed_Examples"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2025-12-11", "Modification_Version": "4.19", "Modification_ReleaseDate": "2025-12-11", "Modification_Comment": "updated Applicable_Platforms, Detection_Factors"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2026-04-30", "Modification_Version": "4.20", "Modification_ReleaseDate": "2026-04-30", "Modification_Comment": "updated Potential_Mitigations, References"}, {"Modification_Name": "CWE Content Team", "Modification_Organization": "MITRE", "Modification_Date": "2026-10-28", "Modification_Version": "5.0", "Modification_ReleaseDate": "2026-10-28", "Modification_Comment": "updated Common_Consequences, Description, Modes_of_Introduction, Time_of_Introduction"}]}, "entry_type": "Weakness"}
