|
| 1 | +/** |
| 2 | + * @name Taint sinks |
| 3 | + * @description Sinks from TaintTracking queries. |
| 4 | + * @kind problem |
| 5 | + * @problem.severity recommendation |
| 6 | + * @id py/meta/alerts/taint-sinks |
| 7 | + * @tags meta |
| 8 | + * @precision very-low |
| 9 | + */ |
| 10 | + |
| 11 | +private import python |
| 12 | +private import semmle.python.dataflow.new.DataFlow |
| 13 | +private import meta.MetaMetrics |
| 14 | +import semmle.python.security.dataflow.CleartextLoggingCustomizations |
| 15 | +import semmle.python.security.dataflow.CleartextStorageCustomizations |
| 16 | +import semmle.python.security.dataflow.CodeInjectionCustomizations |
| 17 | +import semmle.python.security.dataflow.CommandInjectionCustomizations |
| 18 | +import semmle.python.security.dataflow.LdapInjectionCustomizations |
| 19 | +import semmle.python.security.dataflow.LogInjectionCustomizations |
| 20 | +import semmle.python.security.dataflow.PathInjectionCustomizations |
| 21 | +import semmle.python.security.dataflow.PolynomialReDoSCustomizations |
| 22 | +import semmle.python.security.dataflow.ReflectedXSSCustomizations |
| 23 | +import semmle.python.security.dataflow.RegexInjectionCustomizations |
| 24 | +import semmle.python.security.dataflow.ServerSideRequestForgeryCustomizations |
| 25 | +import semmle.python.security.dataflow.SqlInjectionCustomizations |
| 26 | +import semmle.python.security.dataflow.StackTraceExposureCustomizations |
| 27 | +import semmle.python.security.dataflow.TarSlipCustomizations |
| 28 | +import semmle.python.security.dataflow.UnsafeDeserializationCustomizations |
| 29 | +import semmle.python.security.dataflow.UrlRedirectCustomizations |
| 30 | +import semmle.python.security.dataflow.WeakSensitiveDataHashingCustomizations |
| 31 | +import semmle.python.security.dataflow.XmlBombCustomizations |
| 32 | +import semmle.python.security.dataflow.XpathInjectionCustomizations |
| 33 | +import semmle.python.security.dataflow.XxeCustomizations |
| 34 | + |
| 35 | +DataFlow::Node relevantTaintSink(string kind) { |
| 36 | + not result.getLocation().getFile() instanceof IgnoredFile and |
| 37 | + ( |
| 38 | + kind = "CleartextLogging" and result instanceof CleartextLogging::Sink |
| 39 | + or |
| 40 | + kind = "CleartextStorage" and result instanceof CleartextStorage::Sink |
| 41 | + or |
| 42 | + kind = "CodeInjection" and result instanceof CodeInjection::Sink |
| 43 | + or |
| 44 | + kind = "CommandInjection" and result instanceof CommandInjection::Sink |
| 45 | + or |
| 46 | + kind = "LdapInjection (DN)" and result instanceof LdapInjection::DnSink |
| 47 | + or |
| 48 | + kind = "LdapInjection (Filter)" and result instanceof LdapInjection::FilterSink |
| 49 | + or |
| 50 | + kind = "LogInjection" and result instanceof LogInjection::Sink |
| 51 | + or |
| 52 | + kind = "PathInjection" and result instanceof PathInjection::Sink |
| 53 | + or |
| 54 | + kind = "PolynomialReDoS" and result instanceof PolynomialReDoS::Sink |
| 55 | + or |
| 56 | + kind = "ReflectedXss" and result instanceof ReflectedXss::Sink |
| 57 | + or |
| 58 | + kind = "RegexInjection" and result instanceof RegexInjection::Sink |
| 59 | + or |
| 60 | + kind = "ServerSideRequestForgery" and result instanceof ServerSideRequestForgery::Sink |
| 61 | + or |
| 62 | + kind = "SqlInjection" and result instanceof SqlInjection::Sink |
| 63 | + or |
| 64 | + kind = "StackTraceExposure" and result instanceof StackTraceExposure::Sink |
| 65 | + or |
| 66 | + kind = "TarSlip" and result instanceof TarSlip::Sink |
| 67 | + or |
| 68 | + kind = "UnsafeDeserialization" and result instanceof UnsafeDeserialization::Sink |
| 69 | + or |
| 70 | + kind = "UrlRedirect" and result instanceof UrlRedirect::Sink |
| 71 | + or |
| 72 | + kind = "WeakSensitiveDataHashing (NormalHashFunction)" and |
| 73 | + result instanceof NormalHashFunction::Sink |
| 74 | + or |
| 75 | + kind = "WeakSensitiveDataHashing (ComputationallyExpensiveHashFunction)" and |
| 76 | + result instanceof ComputationallyExpensiveHashFunction::Sink |
| 77 | + or |
| 78 | + kind = "XmlBomb" and result instanceof XmlBomb::Sink |
| 79 | + or |
| 80 | + kind = "XpathInjection" and result instanceof XpathInjection::Sink |
| 81 | + or |
| 82 | + kind = "Xxe" and result instanceof Xxe::Sink |
| 83 | + ) |
| 84 | +} |
| 85 | + |
| 86 | +from string kind |
| 87 | +select relevantTaintSink(kind), kind + " sink" |
0 commit comments