Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space CSHARP and version Publish

...

Dont print
Code Block
languageql
titleQuery: StoredXSS.ql
collapsetrue
/**
 * @name Stored cross-site scripting
 * @description Writing input from the database directly to a web page indicates a cross-site
 *              scripting vulnerability if the data was originally user-provided.
 * @kind path-problem
 * @problem.severity error
 * @precision medium
 * @id cs/web/stored-xss
 * @tags security
 *       external/cwe/cwe-079
 *       external/cwe/cwe-116
 */

import csharp
import semmle.code.csharp.security.dataflow.flowsources.Stored
import semmle.code.csharp.security.dataflow.XSS::XSS
import semmle.code.csharp.dataflow.DataFlowDataFlow2
import DataFlow2::DataFlow::PathGraph

class StoredTaintTrackingConfiguration extends TaintTrackingConfiguration {
  override predicate isSource(DataFlowDataFlow2::Node source) { source instanceof StoredFlowSource }
}

from
  StoredTaintTrackingConfiguration c, DataFlowDataFlow2::PathNode source, DataFlowDataFlow2::PathNode sink,
  string explanation
where
  c.hasFlowPath(source, sink) and
  if exists(sink.getNode().(Sink).explanation())
  then explanation = ": " + sink.getNode().(Sink).explanation() + "."
  else explanation = "."
select sink.getNode(), source, sink,
  "$@ flows to here and is written to HTML or JavaScript" + explanation, source.getNode(),
  "Stored user-provided value"

...

Htmlcomment
hiddentrue
hashconfluence_uploader_hash:2304ad25d08ab5fc0b375063cc92b50640258fed57a5f4e7659977b588d24a97a159cf23883dfcf6