SHARE
TWEET

Untitled

a guest Aug 22nd, 2019 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package testcases.CWE315_Plaintext_Storage_in_Cookie;
  2.  
  3. import testcasesupport.*;
  4.  
  5. import javax.servlet.http.*;
  6.  
  7. import java.security.MessageDigest;
  8.  
  9. import java.net.PasswordAuthentication;
  10.  
  11. public class CWE315_Plaintext_Storage_in_Cookie__Servlet_01 extends AbstractTestCaseServlet
  12. {
  13.     public void func(HttpServletRequest request, HttpServletResponse response) throws Throwable
  14.     {
  15.         String data;
  16.  
  17.         PasswordAuthentication credentials = new PasswordAuthentication("user", "BP@ssw0rd".toCharArray());
  18.  
  19.         data = credentials.getUserName() + ":" + (new String(credentials.getPassword()));
  20.  
  21.         response.addCookie(new Cookie("auth", data));
  22.  
  23.     }
  24.  
  25.     public static void main(String[] args) throws ClassNotFoundException,
  26.            InstantiationException, IllegalAccessException
  27.     {
  28.         mainFromParent(args);
  29.     }
  30. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top