SonarQube规则之漏洞类型
漏洞类型:
1、"@RequestMapping" methods should be "public"
漏洞阻断
标注了RequestMapping是controller是处理web请求。既使⽅法修饰为private,同样也能被外部调⽤,因为spring通过反射调⽤⽅法,没有检查⽅法可视度,
2、"enum" fields should not be publicly mutable
漏洞次要
枚举类域不应该是public,也不应该进⾏set
3、"ateTempFile" should not be used to create a directory
漏洞严重
4、"RequestedSessionId()" should not be used
漏洞严重
5、"pto.NullCipher" should not be used for anything other than testing
漏洞阻断
NullCipher类提供了⼀种“⾝份密码”,不会以任何⽅式转换或加密明⽂。因此,密⽂与明⽂相同。所以这个类应该⽤于测试,从不在⽣产代码中。
6、"public static" fields should be constant
漏洞次要
public static 域应该 final
7、Class variable fields should not have public accessibility
漏洞次要
类变量域应该是private,通过set,get进⾏操作
8、Classes should not be loaded dynamically
漏洞严重
不应该动态加载类,动态加载的类可能包含由静态类初始化程序执⾏的恶意代码.
Class clazz = Class.forName(className); // Noncompliant
9、Cookies should be "secure"
漏洞次要
Cookie c = new Cookie(SECRET, secret); // Noncompliant; cookie is not secure
response.addCookie(c);
正:
Cookie c = new Cookie(SECRET, secret);
c.setSecure(true);
response.addCookie(c);
spring framework rce漏洞复现10、Credentials should not be hard-coded
漏洞阻断
凭证不应该硬编码
11、Cryptographic RSA algorithms should always incorporate OAEP (Optimal Asymmetric Encryption Padding)
漏洞严重
加密RSA算法应始终包含OAEP(最优⾮对称加密填充)
12、Default EJB interceptors should be declared in "l"
漏洞阻断
默认EJB应在“l”中声明
13、Defined filters should be used
漏洞严重
14、Exceptions should not be thrown from servlet methods
漏洞次要
不应该从servlet⽅法抛出异常
15、HTTP referers should not be relied on
漏洞严重
不应依赖于http,将这些参数值中⽌后可能是安全的,但绝不应根据其内容作出决定。
如:
String referer = Header("referer"); // Noncompliant
if(isTrustedReferer(referer)){
//..
}
16、IP addresses should not be hardcoded
漏洞次要
ip 地址不应该硬编码
17、Member variable visibility should be specified
漏洞次要
应指定成员变量的可见性
18、Members of Spring components should be injected
漏洞严重
spring组件的成员应注⼊,单例注⼊⾮静态成员共享会产⽣风险
19、Mutable fields should not be "public static"
漏洞次要
多变在域不应为 public static
20、Neither DES (Data Encryption Standard) nor DESede (3DES) should be used
漏洞阻断
不应使⽤DES(数据加密标准)和DESEDE(3DES)
21、Only standard cryptographic algorithms should be used
漏洞严重
标准的加密算法如 SHA-256, SHA-384, SHA-512等,⾮标准算法是危险的,可能被功能者攻破算法
22、Pseudorandom number generators (PRNGs) should not be used in secure contexts
漏洞严重
伪随机数⽣成器(PRNG)不应在安全上下⽂中使⽤
23、Return values should not be ignored when they contain the operation status code
漏洞次要
当函数调⽤的返回值包含操作状态代码时,应该测试此值以确保操作成功完成。
24、Security constraints should be definedin
漏洞阻断
应定义安全约束,当l⽂件没有<security-constraint>元素时,此规则引发了⼀个问题
25、SHA-1 and Message-Digest hash algorithms should not be used
漏洞严重
不应该使⽤SHA-1和消息摘要散列算法,已证实不再安全
26、SQL binding mechanisms should be used
漏洞阻断
应该使⽤SQL绑定机制
27、Struts validation forms should have unique names
漏洞阻断
struts验证表单应有唯⼀名称
28、Throwable.printStackTrace(...) should not be called
漏洞次要
Throwable.printStackTrace(...)会打印异常信息,但会暴露敏感信息
29、Untrusted data should not be stored in sessions
漏洞主要
不受信任的数据不应存储在会话中。
Web会话中的数据被认为在“信任边界”内。也就是说,它被认为是值得信赖的。但存储未经⾝份验证的⽤户未经验证的数据违反信任边界,并可能导致该数据被不当使⽤。
30、Values passed to LDAP queries should be sanitized
漏洞严重
传递到LDAP查询的值应该被清理
31、Values passed to OS commands should be sanitized
漏洞严重
传递给OS命令的值应该被清理
32、Web applications should not have a "main" method
漏洞严重
web 应⽤中不应有⼀个main⽅法

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。