@@ -83,20 +83,16 @@ static int cweLookup(String checkerKey) {
8383 switch (checkerKey ) {
8484 case "ESCMP.EMPTYSTR" : // Inefficient empty string comparison
8585 case "JD.CAST.DOWNCAST" : // Possible ClassCastException for subtypes
86- case "NPE.RET" : // Null Pointer Returned from Method
87- case "NPE.RET.UTIL" : // Null Pointer Returned from Map or Collection
86+ case "JD.METHOD.CBS" : // Method can be declared static
8887 case "REDUN.FINAL" : // Redundant Final Modifier
89- case "REDUN.NULL" : // Use of Variable instead of Null Constant
90- case "REDUN.OP" : // Suspicious operation w/ same expression on both sides
91- case "RLK.IN" : // Input stream not closed on exit
92- case "RLK.OUT" : // Output stream not closed on exit
93- case "SV.DATA.DB" : // Data Injection - Untrusted data inserted into a Database
88+ case "SV.IL.FILE" : // File Name Leaking
9489 case "SV.IL.SESSION" : // Logging of Session ID
90+ case "SV.IL.SESSION.CLIENT" : // HttpServletRequest.getRequestedSessionId() should not be
91+ // used
92+ case "SV.EXPOSE.IFIELD" : // Non-final public field could be changed by malicious code or
93+ // accident
9594 case "SV.LOADLIB.INJ" : // Untrusted call to loadLibrary method
9695 case "SV.SERIAL.NON" : // Class implements Serializable
97- case "SV.SERIAL.NOREAD" : // Method readObject() should be defined for serializable class
98- case "SV.SERIAL.NOWRITE" : // Method writeObject() should be defined for serializable
99- // class
10096 case "SV.SHARED.VAR" : // Unsynchronized access to static variable from servlet
10197 case "SV.UMD.MAIN" : // Unnecessary Main() method
10298 return CweNumber .DONTCARE ;
@@ -108,9 +104,6 @@ static int cweLookup(String checkerKey) {
108104 case "SV.EXEC.LOCAL" : // Process Injection. Local Arguments
109105 case "SV.EXEC.PATH" : // Untrusted Search Path
110106 return CweNumber .COMMAND_INJECTION ;
111- case "SV.HASH.NO_SALT" : // Use of a one-way cryptographic hash without a salt
112- return 759 ; // CWE-759: Use of a One-Way Hash without a Salt
113- // Not the same as: CweNumber.WEAK_HASH_ALGO; - CWE: 328 Weak Hashing
114107 case "SV.LDAP" : // Unvalidated user input is used as LDAP filter
115108 return CweNumber .LDAP_INJECTION ;
116109 case "SV.PATH" : // Path and file name injection
@@ -121,13 +114,16 @@ static int cweLookup(String checkerKey) {
121114 case "SV.SSRF.URI" :
122115 return CweNumber .SSRF ;
123116 case "SV.SQL" : // SQL Injection
117+ case "SV.SQL.DBSOURCE" : // Unchecked info from DB used in SQL Statement
124118 return CweNumber .SQL_INJECTION ;
125119 case "SV.WEAK.CRYPT" : // Use of a Broken or Risky Cryptographic Algorithm
126120 return CweNumber .WEAK_CRYPTO_ALGO ;
127121 case "SV.XPATH" : // Unvalidated user input is used as an XPath expression
128122 return CweNumber .XPATH_INJECTION ;
129123 case "SV.XSS.COOKIE" : // Sensitive cookie without setHttpOnly flag
130124 return CweNumber .COOKIE_WITHOUT_HTTPONLY ;
125+ case "SV.XSS.COOKIE.SECURE" :
126+ return CweNumber .INSECURE_COOKIE ;
131127 case "SV.XSS.DB" : // Cross Site Scripting (Stored XSS)
132128 case "SV.XSS.REF" : // Cross Site Scripting (Reflected XSS)
133129 return CweNumber .XSS ;
@@ -141,25 +137,35 @@ static int cweLookup(String checkerKey) {
141137
142138 case "SV.TAINT_NATIVE" :
143139 return 111 ; // Direct Use of Unsafe JNI
140+ case "SV.HTTP_SPLIT" :
141+ return 113 ; // HTTP Response Splitting
144142 case "SV.LOG_FORGING" :
145143 return 117 ; // Log Forging
146144 case "SV.DOS.ARRINDEX" :
147145 return 129 ; // Improper Validation of Array Index
148146 case "SV.INT_OVF" :
149147 return 190 ; // Integer Overflow
148+ // case "SV.IL.DEV": // App reveals design info in param back to web interface
149+ // return 209; // Generation of Error Message Containing Sensitive Info
150+ case "SV.STRBUF.CLEAN" : // Sensitive buffer not cleaned before garage collection
151+ return 226 ; // Sensitive Info in Resource Not Removed Before Reuse
150152 case "SV.SOCKETS" :
151153 return 246 ; // J2EE: Direct Use of Sockets
152154 case "JD.UNCAUGHT" :
153155 return 248 ; // Uncaught Exception
154156 case "RR.IGNORED" :
155157 return 252 ; // Unchecked Return Value
158+ case "SV.PASSWD.PLAIN" : // Plain-text Password
159+ return 256 ; // Plaintext Storage of a Password
156160 case "SV.PASSWD.HC" :
157161 case "SV.PASSWD.HC.MINLEN" : // Minimum 15 char length Hardcoded pwd
158162 case "SV.PASSWD.PLAIN.HC" :
159163 return 259 ; // Hardcoded Password
160- case "SV.PASSWD.PLAIN" : // Plain-text Password
161164 case "SV.SENSITIVE.DATA" : // Unencrypted sensitive data is written
162165 return 312 ; // Cleartext Storage of Sensitive Info
166+ case "SV.UMC.EXIT" :
167+ case "UMC.EXIT" :
168+ return 382 ; // J2EE: Use of System.exit()
163169 case "SV.UMC.THREADS" :
164170 return 383 ; // J2EE: Direct Use of Threads
165171 case "ECC.EMPTY" : // Empty Exception Block
@@ -170,20 +176,29 @@ static int cweLookup(String checkerKey) {
170176 case "EXC.BROADTHROWS" :
171177 return 397 ; // Decl of Throws for Generic Exception
172178 case "REDUN.DEF" : // Assignment of variable to itself
179+ case "REDUN.OP" : // Suspicious operation w/ same expression on both sides
173180 return 398 ; // Code quality
174181 case "SV.DOS.TMPFILEDEL" :
175182 case "SV.DOS.TMPFILEEXIT" :
176183 return 459 ; // Incomplete Cleanup
184+ case "SV.TAINT" : // Unvalidated user input passed to security sensitive method
185+ return 470 ; // Unsafe Reflection
186+ case "NPE.COND" :
177187 case "NPE.CONST" :
188+ case "NPE.RET.UTIL" : // Null Pointer Returned from Map or Collection
178189 case "NPE.STAT" :
190+ case "REDUN.NULL" : // Use of Variable instead of Null Constant
179191 return 476 ; // Null Pointer Dereference
180192 case "JD.BITR" :
181193 return 481 ; // Assigning Instead of Comparing
182194 case "JD.IFBAD" : // Redundant 'if' statement
183195 return 483 ; // Incorrect Block Delimitation
196+ case "SV.EXPOSE.FIELD" : // Non-final public static field could be changed
197+ return 500 ; // Public Static Field Not Marked Final
184198 case "SV.PASSWD.HC.EMPTY" : // Empty Password
185199 return 521 ; // Weak Password
186200 case "JD.RC.EXPR.DEAD" :
201+ case "JD.UN.MET" : // Method is never called
187202 case "JD.UN.PMET" : // Unused Private Method
188203 return 561 ; // Dead Code
189204 case "JD.VNU" :
@@ -196,9 +211,15 @@ static int cweLookup(String checkerKey) {
196211 return 571 ; // Expression always true
197212 case "JD.THREAD.RUN" :
198213 return 572 ; // Call to Thread run() instead of start()
214+ case "SV.SERIAL.NOREAD" : // Method readObject() should be defined for serializable class
215+ case "SV.SERIAL.NOWRITE" : // Method writeObject() should be defined for serializable
216+ // class
217+ return 573 ; // Improper Following of Spec by Caller
199218 case "EHC.EQ" :
200219 case "EHC.HASH" :
201220 return 581 ; // Just One of Equals and Hashcode Defined
221+ case "SV.EXPOSE.MUTABLEFIELD" : // Public field references mutable object
222+ return 582 ; // Array Declared Public, Final, Static
202223 case "JD.FINRET" :
203224 return 584 ; // Return in Finally Block
204225 case "JD.UMC.FINALIZE" :
@@ -207,15 +228,32 @@ static int cweLookup(String checkerKey) {
207228 return 597 ; // Use of Wrong Operator in String Comparison
208229 case "JD.SYNC.DCL" :
209230 return 609 ; // Double-Checked Locking
231+ case "JD.LOCK" : // Lock acquired but not released
232+ return 667 ; // Improper Locking
210233 case "JD.INF.AREC" :
211234 return 674 ; // Uncontrolled Recursion
235+ case "NPE.RET" : // Null Pointer Returned from Method
236+ return 690 ; // Unchecked Return Value to Null Pointer Dereference
212237 case "JD.BITCMP" : // Questionable use of Bit compare operation
213238 return 754 ; // Improper Check for Unusual or Exceptional Conditions
239+ case "SV.HASH.NO_SALT" : // Use of a one-way cryptographic hash without a salt
240+ return 759 ; // CWE-759: Use of a One-Way Hash without a Salt
241+ // Not the same as: CweNumber.WEAK_HASH_ALGO; - CWE: 328 Weak Hashing
242+ case "RLK.SQLCON" : // SQL Connection not closed on exit
243+ case "RLK.SQLOBJ" : // SQL Object not closed on exit
244+ return 772 ; // Missing Release of Resource after Effective Lifetime
245+ case "RLK.IN" : // Input stream not closed on exit
246+ case "RLK.OUT" : // Output stream not closed on exit
247+ case "RLK.ZIP" :
248+ return 775 ; // Missing Release of File Descriptor
249+ case "JD.INF.ALLOC" : // Memory alloc in infinite loop can lead to OutOfMemoryError
214250 case "SV.DOS.ARRSIZE" : // Unvalidated user input used for array size
215251 return 789 ; // Memory alloc w/ Excessive Size Value
216252 case "JD.SYNC.IN" :
217253 case "JD.LOCK.SLEEP" :
218254 return 833 ; // Deadlock
255+ case "SV.DATA.DB" : // Data Injection - Untrusted data inserted into a Database
256+ return 1287 ; // Improper Validation of Specified Type of Input
219257
220258 default :
221259 System .out .println (
0 commit comments