Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package testcases.CWE315_Plaintext_Storage_in_Cookie;
- import testcasesupport.*;
- import javax.servlet.http.*;
- import java.security.MessageDigest;
- import java.net.PasswordAuthentication;
- public class CWE315_Plaintext_Storage_in_Cookie__Servlet_01 extends AbstractTestCaseServlet
- {
- public void func(HttpServletRequest request, HttpServletResponse response) throws Throwable
- {
- String data;
- PasswordAuthentication credentials = new PasswordAuthentication("user", "BP@ssw0rd".toCharArray());
- data = credentials.getUserName() + ":" + (new String(credentials.getPassword()));
- response.addCookie(new Cookie("auth", data));
- }
- public static void main(String[] args) throws ClassNotFoundException,
- InstantiationException, IllegalAccessException
- {
- mainFromParent(args);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement