├── Android_Static_code_review ├── Basics.md ├── CORS-POC ├── 1.html ├── 2.html ├── 3.html └── Exploit-with-xss.md ├── Clickjacking.html ├── Clickjacking2.html ├── DOM_XSS_eventlistner ├── Oauth.md ├── README.md ├── XSS_payloads.md ├── XSSpotter.py ├── amsi.md ├── json_CSRF.html └── test.js /Android_Static_code_review: -------------------------------------------------------------------------------- 1 | apkx 2 | dex2jar-d2j 3 | export source code 4 | 5 | 6 | grep -ir password 7 | grep -ir sql 8 | grep -ir passwd 9 | grep -ir pwd 10 | grep -ir 'http://' 11 | grep -ir 'https://' 12 | grep -ir 'api_key' 13 | grep -ir 'api-key' 14 | grep -ir apikey 15 | grep -ir username 16 | grep -Eori 'https?://[^[:space:]]+' 17 | 18 | 19 | Save the below in a file and run *grep -ir -f a.txt* 20 | 21 | 22 | credentials 23 | firebase 24 | database 25 | constants 26 | global 27 | token 28 | secure 29 | prod 30 | 31 | .mlab.com password 32 | access_key 33 | access_token 34 | amazonaws 35 | api.googlemaps AIza 36 | api_key 37 | api_secret 38 | apidocs 39 | apikey 40 | apiSecret 41 | app_key 42 | app_secret 43 | appkey 44 | appkeysecret 45 | application_key 46 | appsecret 47 | appspot 48 | auth_token 49 | authorizationToken 50 | aws_access 51 | aws_access_key_id 52 | aws_key 53 | aws_secret 54 | aws_token 55 | AWSSecretKey 56 | bashrc password 57 | bucket_password 58 | client_secret 59 | cloudfront 60 | codecov_token 61 | conn.login 62 | connectionstring 63 | consumer_key 64 | database_password 65 | db_password 66 | db_username 67 | dbpasswd 68 | dbpassword 69 | dbuser 70 | dot-files 71 | dotfiles 72 | encryption_key 73 | fabricApiSecret 74 | fb_secret 75 | ftp 76 | gh_token 77 | github_key 78 | github_token 79 | gitlab 80 | gmail_password 81 | gmail_username 82 | herokuapp 83 | irc_pass 84 | JEKYLL_GITHUB_TOKEN 85 | keyPassword 86 | ldap_password 87 | ldap_username 88 | mailchimp 89 | mailgun 90 | master_key 91 | mydotfiles 92 | mysql 93 | node_env 94 | npmrc _auth 95 | oauth_token 96 | passwd 97 | password 98 | passwords 99 | pem private 100 | preprod 101 | private_key 102 | pwd 103 | pwds 104 | rds.amazonaws.com password 105 | redis_password 106 | root_password 107 | secret 108 | secret.password 109 | secret_access_key 110 | secret_key 111 | secret_token 112 | secrets 113 | security_credentials 114 | send.keys 115 | send_keys 116 | sendkeys 117 | SF_USERNAME salesforce 118 | sf_username 119 | FIREBASE_API_JSON= 120 | slack_api 121 | slack_token 122 | sql_password 123 | ssh 124 | ssh2_auth_password 125 | sshpass 126 | staging 127 | storePassword 128 | stripe 129 | swagger 130 | testuser 131 | x-api-key 132 | xoxb 133 | xoxp 134 | [WFClient] Password= 135 | access_key 136 | bucket_password 137 | dbpassword 138 | dbuser 139 | .bash_history 140 | .bash_history DOMAIN-NAME 141 | .bash_profile aws 142 | .bashrc mailchimp 143 | .bashrc password 144 | .cshrc 145 | .dockercfg auth 146 | .env DB_USERNAME NOT homestead 147 | .env MAIL_HOST=smtp.gmail.com 148 | .esmtprc password 149 | .ftpconfig 150 | .git-credentials 151 | .history 152 | .htpasswd 153 | .netrc password 154 | .npmrc _auth 155 | .pgpass 156 | .remote-sync.json 157 | .s3cfg 158 | .sh_history 159 | .tugboat NOT _tugboat 160 | _netrc password 161 | apikey 162 | bash 163 | bash_history 164 | bash_profile 165 | bashrc 166 | beanstalkd.yml 167 | CCCam.cfg 168 | composer.json 169 | config irc_pass 170 | config.json auths 171 | config.php dbpasswd 172 | configuration.php JConfig password 173 | connections 174 | connections.xml 175 | credentials aws_access_key_id 176 | cshrc 177 | dbeaver-data-sources.xml 178 | deployment-config.json 179 | dhcpd.conf 180 | dockercfg 181 | environment 182 | express.conf 183 | express.conf path:.openshift 184 | filezilla.xml 185 | filezilla.xml 186 | git-credentials 187 | gitconfig 188 | htpasswd 189 | hub oauth_token 190 | id_dsa 191 | id_rsa 192 | id_rsa or filename:id_dsa 193 | idea14.key 194 | known_hosts 195 | logins.json 196 | makefile 197 | master.key 198 | netrc 199 | npmrc 200 | pgpass 201 | proftpdpasswd 202 | robomongo.json 203 | s3cfg 204 | SECRET_KEY 205 | sftp-config.json 206 | sftp-config.json 207 | sftp.json 208 | sshd_config 209 | tugboat 210 | ventrilo_srv.ini 211 | WebServers.xml 212 | wp-config 213 | wp-config.php 214 | zhrc 215 | HEROKU_API_KEY 216 | HEROKU_API_KEY 217 | HOMEBREW_GITHUB_API_TOKEN 218 | msg nickserv identify 219 | AWS_ACCESS_KEY_ID 220 | list_aws_accounts 221 | aws_access_key 222 | aws_secret_key 223 | bucket_name 224 | S3_ACCESS_KEY_ID 225 | S3_BUCKET 226 | S3_ENDPOINT 227 | S3_SECRET_ACCESS_KEY 228 | databases password 229 | PT_TOKEN 230 | redis_password 231 | root_password 232 | secret_access_key 233 | SECRET_KEY_BASE= 234 | shodan_api_key 235 | WORDPRESS_DB_PASSWORD= 236 | AWS_SECRET_ACCESS_KEY 237 | API KEY 238 | API SECRET 239 | API TOKEN 240 | ROOT PASSWORD 241 | ADMIN PASSWORD 242 | GCP SECRET 243 | AWS SECRET 244 | -------------------------------------------------------------------------------- /Basics.md: -------------------------------------------------------------------------------- 1 | ----------------- 2 | Crypto 3 | 4 | bit - 0 or 1 5 | 1 byte - 8bit 6 | 7 | Steam cipher - symmetric - take one bit/byte at a time and do XORing 8 | Block cipher - symmetric - take one block (64bit,128bit etc) at a time - blowfish, aed, des 9 | 10 | Confusion - try to make the Relation between plaintext and cipher texT AS complex as possible, if we change 1 bit of plaintext then half or more bit of cipher text should also change. 11 | Defusion - try to make the Relation between key and cipher texT AS complex as possible, if we change 1 bit of key then almost all bits of cipher text should change. 12 | 13 | 14 | Symmetric - AES 256 - 15 | Asymmetrric - RSA - 16 | 17 | Since RSA cannot encrypt long messages, we can use AES to encrypt and encrypt the AES key using RSA to securely share it to someone. 18 | 19 | ------------------- 20 | 21 | SSL Handshake - 22 | 23 | Client Hello 24 | Server Hello with Certificate which contains Public Key 25 | Client Verifies the Certificate from CA provider (expiration, validity etc) and check the Cipers which both supports to use 26 | Client generates a key which he encodes using server public key and send it to server (key is symmectric encr) (To enusure if server is who he say he is) 27 | Server decrypt the key using asymeetric encr (private key) and estabilish a secure encrypted communication. 28 | 29 | 30 | Mutual TLS 31 | 32 | Client Hello. 33 | Server Hello with Certificate (public key) to the client. 34 | Client then confirm the CAs whether it’s a valid certificate issued by them or not. This step to make sure server is who its claming to be. 35 | Client share his cert and then server verifeis if client is allowed/whitelisted and in the Trust store or not. 36 | And then use a aggreed upon secret in symmetric encrpytion. 37 | 38 | -------------------- 39 | 40 | 41 | PIA data is stored how? - Encryption - Symmetric or Assymetric depening of the need. 42 | password hasing how? - best practice hash - Argon2 or Bcrypt with SALT 43 | To verify file signatures and certificates, SHA-256 44 | Hashing Rounding - taking a hash -> changing 1 bit and rehashing it. 45 | 46 | 47 | ------------- 48 | Devsecops 49 | 50 | STRIDE - Security threat model framework used to identify potential threats to applications. Each letter in the STRIDE acronym represents a different type of threat: 51 | 52 | Spoofing 53 | Tampering 54 | 55 | Information Disclosure 56 | Denial of Service (DoS) 57 | Elevation of Privilege 58 | 59 | 60 | THREAD MODDELING - Structured process of identifying, assessing, and mitigating security risks in software applications by analyzing the interactions and behaviors of threads, which are concurrent execution units, within the application's architecture and design. 61 | 62 | Continues Integration/CD -> Dependency Check SCA (Checkmarx)- SAST (checkmarx) - pull DOCKER and SCAN -> PUSH CODE in docker -> OS Hardeding (scanning the final docker in which application is running) 63 | 64 | SHIFT LEFT Approach - implementing securtiy as early in SDLC as possible. 65 | 66 | how the after encryption key is stored? 0in valut 67 | hashicorp vault 68 | 69 | ---------- 70 | 71 | 72 | MOBILE 73 | 74 | Certificate Pinning Bypass - 2 methods: By making changes in Source code OR Android SSL-Trust-Killer application or similar modules in xposed 75 | 76 | Approach - shared pref, folder permissions, MODE_WORLD_READBALE writable files and folders, allow_backup should be false,allow_debug should be false,READ_LOGS flag, static analysis, dex2jar, jd-gui, hardcoded, aws urls, internalIPs, drozer, 77 | 78 | LOGS - 79 | Copy/Paste - other malicious application can access clipboard and steal data 80 | 81 | Exported Content Provider - Could contain keys, creds, secrets 82 | Exported Activities and Permissions - Open after auth activity using (drozer) 83 | Attacking Services- Any exported service(for ex: location) can be executed without any auth through malicious application (drozer) (this will enalbed location of the andriod device) 84 | 85 | 86 | code obfuscation with the help of Proguard to avoid jd-gui - dont stop completly but slow down the RE 87 | 88 | how jwt should be stored in android. or any other auth token - 89 | - encrypt using 3rd party or EncryptedSharedPreferences lib and store In shared pref 90 | - Store tokens in memory while app runs, for short term sessions. 91 | - In Android Keystore 92 | - Biometric Authentication 2fa for Android Keystore 93 | 94 | 95 | rootdetectuion - rootbear 96 | sslpinning bypass xposed - frida 97 | MOBSF 98 | 99 | 100 | webview - load webpage within application 101 | deeplink - customeschemma://call/profiledelete 102 | 103 | CSRF - deleteprofile deeplink, any 3rd party applicaiton can call the deeplink and deleteprofile_- (autoverify = true) should be set in AndriodManifest to remidiate this. 104 | openredirect- find deeplink with intent-filter and schema. and execute 105 | 106 | Intent can be used for 107 | 108 | To start an Activity, typically opening a user interface for an app 109 | As broadcasts to inform the system and apps of changes 110 | To start, stop, and communicate with a background service 111 | 112 | 113 | 114 | 115 | ---------- 116 | Web 117 | 118 | 119 | HTTP DYSYNC 120 | Deserialization 121 | 122 | DOM - 123 | sources: 124 | document.URL 125 | document.documentURI 126 | document.URLUnencoded 127 | document.baseURI 128 | location.search 129 | document.cookie 130 | document.referrer 131 | 132 | sinks: 133 | eval 134 | element.innerHTML 135 | element.outerHTML 136 | element.insertAdjacentHTML 137 | element.onevent 138 | document.write() 139 | document.writeln() 140 | document.domain 141 | 142 | 143 | 144 | * Oauth flows - 145 | Authorization Code Flow - Authorization token is reviced and then back-end server-server communication for accesstoken and userdetails 146 | Implicit Grant Type - Used for single page application since, there is no backend. they directly recive the acecss token through the interceptanle request and then send a post request to save it in the dataabsed if needed for furute for user login 147 | 148 | State 149 | redirect_uri + open redirect chain 150 | 151 | 152 | OPENID - layer on top of oauth for authentication 153 | - scope openid - must 154 | - id_token - jwt token recevied with access token as identify identifer of user 155 | 156 | attack - self client register with redirect_uri ,logo uri , which is getting trigged causeing an ssrf 157 | 158 | 159 | 160 | 161 | ------ 162 | Network 163 | 164 | OSI - Common Attacks 165 | 166 | 167 | Physical - Cables, wire, Bluethooth, USB, LAN - DOS attacks, MITM physical device 168 | DataLink - ARP, WAN - ArpSpoofing, Mac Flooding 169 | Network - IMCP, IPv4, IPv6, IPsec - IP Spoofing 170 | Transport - TCP/UDP - DDOS- SYN Flood 171 | sessions - NetBios - Session Hijacking 172 | Presentation - SSL - SSL Hijacking MITM 173 | Application Layer - ALL the web related attacks - SQLi, xss, parameter tampering 174 | 175 | All people should try new dominos pizza 176 | 177 | 178 | evildropping 179 | DNS posinoing - 180 | arp SPoofing - Mac:IP 181 | ----------- 182 | 183 | Hardik - 184 | 185 | Bufferover flow basic 186 | 187 | Application take username input of 8 char, we give more chars and application should give error if we give more and should not process the input, buffer overflow occurs when ex. we give 10 char input and application processes that last of char input. that is executed in the memorty, attacker could run malicious shell script, rev shell etc. 188 | 189 | 190 | Network 191 | 192 | How does Nmap work? 193 | Ping work? 194 | 195 | --------- 196 | Config Review. CIS BenchMark/ TrendMicro 197 | Azure Benchmark foundation 198 | GCP Benchmark 199 | AWS Benchmark 200 | 201 | palo alto 202 | 203 | Components/services - iam , lambda, eks, 204 | ------ 205 | 206 | 207 | Owasp cheatsheet - 208 | 209 | Database 210 | Crypto 211 | TLS 212 | CSRF 213 | DOM BASED XSS 214 | Mobile Applicatino 215 | Cloud Architecture Security 216 | Arcitechture review 217 | Secret Management 218 | 219 | 220 | 221 | 222 | **Firewalls** control and filter network traffic to protect against unauthorized access and cyber threats. Control What goes out of internal network and what req comes in. 223 | 224 | **Intrusion Detection Systems (IDS)** monitor network traffic for signs of potential attacks and generate alerts. 225 | 226 | **Intrusion Prevention Systems (IPS)** go a step further by not only detecting threats but actively blocking or mitigating them to protect your network in real-time. 227 | 228 | 229 | 230 | 231 | 232 | ------ 233 | 234 | 235 | **Secure Shell (SSH)** - A network protocol that provides secure access to remote systems and encrypted data communication. 236 | 237 | **Secure Sockets Layer (SSL)** - A security protocol that ensures encrypted and secure communication over the internet, commonly used in web browser and a web server. 238 | 239 | **Transport Layer Security (TLS)** - A cryptographic protocol that ensures secure communication over internet. It is an updated and more secure version of SSL (Secure Sockets Layer) and is commonly used to encrypt data transmitted between a client (e.g., web browser) and a server, providing confidentiality and integrity of the information exchanged. 240 | 241 | **Internet Protocol Security (IPsec)** - set of protocols used to secure Internet Protocol (IP) communications (IPs, router, server, http-https,ftp,ssh,packets etc ). It provides authentication, encryption, and data integrity for data transmitted over IP networks, ensuring the confidentiality and security of network traffic. IPsec is often used to establish virtual private networks (VPNs) and secure communication between networked devices. 242 | 243 | IP communications enable devices worldwide to exchange data over the internet. It's the language that devices use to talk to each other, and it forms the backbone of our digital connectivity. 244 | 245 | **Domain Name System Security Extensions (DNSSEC)** - Set of protocols and security measures designed to enhance the security of the DNS. DNS is responsible for translating human-friendly domain names (like www.example.com) into IP addresses that computers and servers use to locate each other on the internet. 246 | 247 | DNSSEC adds a layer of security to this translation process by digitally signing (asymmetric cryptograpy) DNS data. 248 | 249 | 250 | 251 | 252 | --------- 253 | 254 | 255 | 256 | ### Applied cryptography: 257 | 258 | **Symmetric encryption** - One Key Shared with All - AES 259 | 260 | **Asymmetric encryption** - Public And Private Key - RSA 261 | 262 | **Hashing** - Integrity of data (Password should be hashed with random salt) 263 | 264 | 265 | 266 | # Hashing vs. Encryption vs. Encoding 267 | 268 | ## Hashing 269 | 270 | - **Purpose:** Hashing is primarily used to transform data into a fixed-size string of characters, known as a hash value or digest. It is commonly used for data integrity verification and data retrieval. 271 | 272 | - **Operation:** It is a one-way process, meaning it cannot be reversed to obtain the original data. 273 | 274 | - **Security:** Hashing is not designed for data security or confidentiality; its primary purpose is data integrity verification. 275 | 276 | - **Use Cases:** Hashing is used in password storage (with salting), digital signatures, verifying file integrity, and in data structures like hash tables for efficient data retrieval. 277 | 278 | ## Encryption 279 | 280 | - **Purpose:** Encryption is used to protect data confidentiality by converting plain text (original data) into a ciphertext (encrypted data) that can only be read by authorized parties with the decryption key. 281 | 282 | - **Operation:** Two way - Public Private Key. 283 | 284 | - **Security:** Encryption is focused on protecting data from unauthorized access. It ensures that even if someone gains access to the encrypted data, they cannot decipher it without the decryption key. 285 | 286 | - **Use Cases:** Encryption is widely used in securing communications (e.g., SSL/TLS for secure web browsing), protecting sensitive data at rest (e.g., full-disk encryption), and ensuring data privacy. 287 | 288 | ## Encoding 289 | 290 | - **Purpose:** Encoding is used to represent data in a specific format for data transmission . It doesn't provide security or data transformation like hashing or encryption. 291 | 292 | - **Operation:** Encoding translates data from one format to another, typically using a well-defined scheme. It's a reversible process, meaning the original data can be obtained by decoding it. 293 | 294 | - **Security:** Encoding is not a security measure. It's used to ensure that data is in a format that can be correctly processed by various systems and protocols. 295 | 296 | - **Use Cases:** Encoding is used in various scenarios, such as URL encoding for web addresses, Base64 encoding for binary-to-text conversion, and character encoding (e.g., UTF-8) for international character representation. 297 | 298 | 299 | 300 | 301 | 302 | # Digital Signatures vs. Hashing 303 | 304 | Digital signatures and hashing are both cryptographic techniques used to ensure the integrity and authenticity of data, but they serve different purposes and have distinct characteristics: 305 | 306 | ## Purpose 307 | 308 | - **Digital Signatures:** Digital signatures are primarily used to verify the authenticity of a document or message and ensure that it has not been tampered with during transmission. They provide a means to prove the identity of the sender and guarantee that the sender has endorsed the content. 309 | 310 | - **Hashing:** Hashing is used to create a fixed-length string of characters (the hash value or digest) from any input data, regardless of its size. Hashing is primarily used for data integrity verification. It ensures that data has not changed by comparing the hash of the original data with the hash of the received data. 311 | 312 | ## Operation 313 | 314 | - **Digital Signatures:** Digital signatures involve the use of asymmetric cryptography. A private key is used to create the signature, and a corresponding public key is used to verify it. 315 | 316 | - **Hashing:** Hashing uses a one-way hash function to transform data into a fixed-size string of characters. It is a one-way process, meaning it cannot be reversed to obtain the original data. 317 | 318 | ## Verification 319 | 320 | - **Digital Signatures:** Verification of a digital signature requires the sender's public key and the signature itself. The recipient can confirm the authenticity of the message and the sender's identity. 321 | 322 | - **Hashing:** Hash verification only requires the hash value of the original data and the recalculated hash of the received data. If the two hash values match, the data is considered intact. 323 | 324 | ## Use Cases 325 | 326 | - **Digital Signatures:** Used in scenarios where both data integrity and sender authentication are important, such as secure email communication, digital contracts, and software updates. 327 | 328 | - **Hashing:** Used for data integrity checks, password storage (by hashing and salting), and in various data structures like hash tables for efficient data retrieval. 329 | 330 | In summary, digital signatures are more focused on data integrity and sender authentication, while hashing is primarily used for data integrity verification. These techniques are often used in combination to ensure the security of digital communications and data storage. 331 | -------------------------------------------------------------------------------- /CORS-POC/1.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /CORS-POC/2.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /CORS-POC/3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 |