Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marking an object as tainted after calling a method with an tainted argument (TestCase Aliasing5) #4

Open
rbonifacio opened this issue Apr 28, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@rbonifacio
Copy link
Owner

rbonifacio commented Apr 28, 2020

After calling a method of an object "a" with a tainted object "b" as argument, object "a" (or at least one of its attributes" might also have to become tainted. Consider the following example:

protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
  StringBuffer buf = new StringBuffer("abc"); 
  foo(buf, buf, resp, req);
}

void foo(StringBuffer buf, StringBuffer buf2, ServletResponse resp, ServletRequest req) throws IOException {
   String name = req.getParameter(FIELD_NAME);
   buf.append(name);
   PrintWriter writer = resp.getWriter();
   writer.println(buf2.toString());                              /* BAD */
}

After calling buf.append(name), where name is tainted, buf must be marked as tainted; or at least one of its attributes. Since buf2 might alias buf, we should report a possible vulnerability in the call to writer.println(buf2.toString())

@rbonifacio rbonifacio added the bug Something isn't working label Apr 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant