Skip to content

Missing TaintStep for String.format() #2786

@pwntester

Description

@pwntester

Hi,

I found a False Negative caused by missing taintflow through String.format(). The following taint step made the issue to be reported but should probably be improved (maybe check n1 reaching type is a string?):

class StringFormaTaintStep extends TaintTracking::AdditionalTaintStep {
    override predicate step(DataFlow::Node n1, DataFlow::Node n2) {
        exists(MethodAccess ma, Method m |
            ma.getMethod() = m and
            m.getDeclaringType().hasQualifiedName("java.lang", "String") and
            m.getName() = "format" and
            n1.asExpr() = ma.getAnArgument() and
            n2.asExpr() = ma
        ) 
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions