one_gadget 1.7.4 → 1.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (120) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -1
  3. data/lib/one_gadget/abi.rb +2 -2
  4. data/lib/one_gadget/builds/libc-2.19-df559a150829d9f3cdd0b5ce1e5b4d512d20f55f.rb +1 -1
  5. data/lib/one_gadget/builds/libc-2.20-398115bd423958b1769317a6f7e4928df141eb57.rb +1 -1
  6. data/lib/one_gadget/builds/libc-2.20-f3063b7115d5a383189937852ce356f4c60fd190.rb +1 -1
  7. data/lib/one_gadget/builds/libc-2.21-9ac81172d5ff96f40d984fe7c10073a98f1a6b2e.rb +1 -1
  8. data/lib/one_gadget/builds/libc-2.21-f0c24219cbba0605e39e02123398437c5dbbb104.rb +1 -1
  9. data/lib/one_gadget/builds/libc-2.22-b916e3c1d80069d0209f6376b33e42b75ec49eda.rb +1 -1
  10. data/lib/one_gadget/builds/libc-2.23-18f761287ed46e213bec29c2e440e73fd72373be.rb +46 -0
  11. data/lib/one_gadget/builds/libc-2.23-30773be8cf5bfed9d910c8473dd44eaab2e705ab.rb +46 -0
  12. data/lib/one_gadget/builds/libc-2.23-635101aec7213fdc442419bf65a92047a862ff32.rb +46 -0
  13. data/lib/one_gadget/builds/libc-2.23-f2f2f2af4f3e8597cca1fdff1008a834c78de42b.rb +43 -0
  14. data/lib/one_gadget/builds/libc-2.24-349119af9e223829ea24f6b7226bdff0182e73f2.rb +49 -0
  15. data/lib/one_gadget/builds/libc-2.24-3fce81d490804af9759c70bf197380bc05a584c2.rb +46 -0
  16. data/lib/one_gadget/builds/libc-2.24-a51ace667ccae6a8887837efb18259a906704bed.rb +46 -0
  17. data/lib/one_gadget/builds/libc-2.24-deefae132c5a39ba892bc189edd91f73c1ea1f14.rb +37 -0
  18. data/lib/one_gadget/builds/libc-2.25-58c735bc7b19b0aeb395cce70cf63bd62ac75e4a.rb +9 -0
  19. data/lib/one_gadget/builds/libc-2.26-1c39b3b3faa2a2cbb0fa0b6845b29332562262d3.rb +9 -0
  20. data/lib/one_gadget/builds/libc-2.26-6d2b609f0c8e7b338f767b08c5ac712fac809d31.rb +9 -0
  21. data/lib/one_gadget/builds/libc-2.26-ddcc13122ddbfe5e5ef77d4ebe66d124ae5762c2.rb +9 -0
  22. data/lib/one_gadget/builds/libc-2.26-fb587bc4429e7d1b0de31a3b9ee8ae78ee797eb0.rb +9 -0
  23. data/lib/one_gadget/builds/libc-2.27-14cd15d2eb0bc25c89045873cf807f7533e4788d.rb +47 -0
  24. data/lib/one_gadget/builds/libc-2.27-71f0f3074a929e519e85f6a5c03a7d1fd976bfe4.rb +44 -0
  25. data/lib/one_gadget/builds/libc-2.27-73cd526a553b3b47c6dd0d6dc62175263cdc646e.rb +35 -0
  26. data/lib/one_gadget/builds/libc-2.27-9dd0bb57f81671704475d1e5163405f7b4d4b454.rb +3 -0
  27. data/lib/one_gadget/builds/libc-2.27-a5e88eb34369fb48113b9eda7a92e07b372f3cb7.rb +35 -0
  28. data/lib/one_gadget/builds/libc-2.27-ba63c4a5f5c2b51e6e7e5df94017dc98b20e397a.rb +47 -0
  29. data/lib/one_gadget/builds/libc-2.27-ce450eb01a5e5acc7ce7b8c2633b02cc1093339e.rb +44 -0
  30. data/lib/one_gadget/builds/libc-2.27-d1237c55f6778f53b369cf22ff81979b2fe340bb.rb +3 -0
  31. data/lib/one_gadget/builds/libc-2.27-d831493b564a8632d1da5cc0fe44af45713cfeb6.rb +47 -0
  32. data/lib/one_gadget/builds/libc-2.27-f4929d2a8af4629477103af6f1cfb3bebce80883.rb +47 -0
  33. data/lib/one_gadget/builds/libc-2.28-5b157f49586a3ca84d55837f97ff466767dd3445.rb +12 -0
  34. data/lib/one_gadget/builds/libc-2.28-65ed813688b116fdce9e866ad2fef2e734167337.rb +44 -0
  35. data/lib/one_gadget/builds/libc-2.28-6ee9454b96efa9e343f9e8105f2fa4529265ea05.rb +6 -0
  36. data/lib/one_gadget/builds/libc-2.29-5b7203920d3d786ac40af8e0d5104683335f11be.rb +50 -0
  37. data/lib/one_gadget/builds/libc-2.29-85d5020664b11fd2708859275de41d5ab9d104cf.rb +18 -0
  38. data/lib/one_gadget/builds/libc-2.29-a8af6c81cb28a37bf3a546970bf64224402f8bd4.rb +50 -0
  39. data/lib/one_gadget/builds/libc-2.29-c19c88c33b60742ca906e0f9f96fe31b8b79ea9c.rb +50 -0
  40. data/lib/one_gadget/builds/libc-2.29-d561ec515222887a1e004555981169199d841024.rb +27 -0
  41. data/lib/one_gadget/builds/libc-2.30-2155f455ad56bd871c8225bcca85ee25c1c197c4.rb +36 -0
  42. data/lib/one_gadget/builds/libc-2.30-33d1f350f13728651d74dd2a56bad1e4e4648f5e.rb +50 -0
  43. data/lib/one_gadget/builds/libc-2.30-7a1e2ae26cef50584af2c60a5ad3a7ae3e9b1446.rb +50 -0
  44. data/lib/one_gadget/builds/libc-2.30-cbe9cff3c43b979739af1681b61a3d585725577b.rb +36 -0
  45. data/lib/one_gadget/builds/libc-2.30-f07144cc3d0ac50415f3a2e061be6da672c914ba.rb +18 -0
  46. data/lib/one_gadget/builds/libc-2.30-f44469d65b4efd2e5951513ed7cbf773657f1283.rb +18 -0
  47. data/lib/one_gadget/builds/libc-2.31-012f3f1e614cb9c829b8d1590d228cc6a9506a03.rb +26 -0
  48. data/lib/one_gadget/builds/libc-2.31-099b9225bcb0d019d9d60884be583eb31bb5f44e.rb +80 -0
  49. data/lib/one_gadget/builds/libc-2.31-0d1b3211736c4ca528a32ea0d565d41a2ede3b58.rb +56 -0
  50. data/lib/one_gadget/builds/libc-2.31-12e412d1938ec3ff79751f0e85f31bc52f7e3722.rb +56 -0
  51. data/lib/one_gadget/builds/libc-2.31-2886817dc06a87bdeef50544c0d6c12de13a8148.rb +56 -0
  52. data/lib/one_gadget/builds/libc-2.31-4d4d0853eb075b8b0cfaee0aee7cdf4254a3e877.rb +56 -0
  53. data/lib/one_gadget/builds/libc-2.31-58a58f2fcdafddacb4a08439ea2ee163ff645d1d.rb +26 -0
  54. data/lib/one_gadget/builds/libc-2.31-634252e0c5f8b03957a2e529719d4101699a894a.rb +48 -0
  55. data/lib/one_gadget/builds/libc-2.31-6b143503744b9d6c22e479941488d6a9e6e3f1c5.rb +26 -0
  56. data/lib/one_gadget/builds/libc-2.31-6dbad1709854c527793f6401666e45a791b7c793.rb +56 -0
  57. data/lib/one_gadget/builds/libc-2.31-85d7bb2dad0f8172d1c02c0311a00c4695933beb.rb +26 -0
  58. data/lib/one_gadget/builds/libc-2.31-8629fa2eea681f639a0c18305d4548850dde3450.rb +26 -0
  59. data/lib/one_gadget/builds/libc-2.31-94761ae31db09ce9140ca55cb6986a5ea9110abc.rb +56 -0
  60. data/lib/one_gadget/builds/libc-2.31-9fdb74e7b217d06c93172a8243f8547f947ee6d1.rb +80 -0
  61. data/lib/one_gadget/builds/libc-2.31-c9d56de82ddd00d822d6100034f3075ef1709cd2.rb +80 -0
  62. data/lib/one_gadget/builds/libc-2.31-e67e80e70619717709e3180e552a11a285036a54.rb +56 -0
  63. data/lib/one_gadget/builds/libc-2.31-eb3c5cf73a0a6b7f2b3895a56dbc443806700971.rb +30 -0
  64. data/lib/one_gadget/builds/libc-2.31-fb7626dd8b8a50f7685920487e992528834f6775.rb +26 -0
  65. data/lib/one_gadget/builds/libc-2.32-1e3fb06b8c86b5e282e3e11bd207d399fb4952e2.rb +83 -0
  66. data/lib/one_gadget/builds/libc-2.32-7ec3e74da842ca3c6a9ba20b21303ce1bc7a45af.rb +51 -0
  67. data/lib/one_gadget/builds/libc-2.32-7fba7abef941659c229c2636aa0905c28652ee3f.rb +56 -0
  68. data/lib/one_gadget/builds/libc-2.32-82f6b69e698bb579baefb35a3fb0346632fa2c4d.rb +83 -0
  69. data/lib/one_gadget/builds/libc-2.32-87f011a7e4cc3fc60a54d0d3dd690e7438decc8d.rb +56 -0
  70. data/lib/one_gadget/builds/libc-2.32-92199dd358616182fb49c992330fb05e42eaa423.rb +26 -0
  71. data/lib/one_gadget/builds/libc-2.32-9d60d4bd625a7fe2439db781a5fc91bb69684903.rb +26 -0
  72. data/lib/one_gadget/builds/libc-2.32-ac287babd169c70013b752da2713dfb96d9a503f.rb +83 -0
  73. data/lib/one_gadget/builds/libc-2.32-aebd80372a00285a5c486ef72917f935eb8f91be.rb +26 -0
  74. data/lib/one_gadget/builds/libc-2.32-bd0e9dc4e27475b5ab7dc59141daaa2626b8a760.rb +26 -0
  75. data/lib/one_gadget/builds/libc-2.32-bddeb6374fc99723cef3b3baafe48ac78fce13b4.rb +26 -0
  76. data/lib/one_gadget/builds/libc-2.32-cb91dd613d38b806a16bed1b364c084ad63d1a1f.rb +56 -0
  77. data/lib/one_gadget/builds/libc-2.32-d3f1cf7f55b985fd6d989880ec3599724fe40a26.rb +26 -0
  78. data/lib/one_gadget/builds/libc-2.32-e13b24f94b260dd6394bdb2433d2a78e37078d5c.rb +30 -0
  79. data/lib/one_gadget/builds/libc-2.32-e1596c76d0d93d8a36378ba976f034f140618d59.rb +56 -0
  80. data/lib/one_gadget/builds/libc-2.32-f45b67ab28af1581cba8e4713e0fd3b2bc004b2e.rb +56 -0
  81. data/lib/one_gadget/builds/libc-2.33-18edf6b683a2f9768cc0ee9cc64ae6fbb545deb2.rb +83 -0
  82. data/lib/one_gadget/builds/libc-2.33-1c943bf313b5b4546e47b830e70de6bbd6a0ba57.rb +26 -0
  83. data/lib/one_gadget/builds/libc-2.33-2b48299781548c9bc452eac6df39902547c884ed.rb +83 -0
  84. data/lib/one_gadget/builds/libc-2.33-37169e68b33cad12e272bb4896d71fd0d4fd98bb.rb +56 -0
  85. data/lib/one_gadget/builds/libc-2.33-54a6e404e7dc1de7c1434a00b7b1ad325b81f22a.rb +56 -0
  86. data/lib/one_gadget/builds/libc-2.33-7983d313db4a441a3762c8861ca405aa0331c0c8.rb +56 -0
  87. data/lib/one_gadget/builds/libc-2.33-8fdc2b2c65f3d782e52c01b546399eee8aa466dc.rb +26 -0
  88. data/lib/one_gadget/builds/libc-2.33-9143da129b44b931a1c180e2b103e993dd2474fd.rb +26 -0
  89. data/lib/one_gadget/builds/libc-2.33-97c8d90bd86bc698d156630e8803de433a640090.rb +83 -0
  90. data/lib/one_gadget/builds/libc-2.33-9bf4c513db255ab7248cef9f0f96b4403df29852.rb +56 -0
  91. data/lib/one_gadget/builds/libc-2.33-9e592d3efa165bc2bab8b40426370bd50cb0b027.rb +56 -0
  92. data/lib/one_gadget/builds/libc-2.33-abf3b2a9815c0cd6e4280cd99474d34102804eb2.rb +56 -0
  93. data/lib/one_gadget/builds/libc-2.33-b046eecd056a0c30995703f6cfca7a8e3a9ef5fa.rb +56 -0
  94. data/lib/one_gadget/builds/libc-2.33-b2262bfa6f1bffd1e9ddc845276dfaebb7c8f0b9.rb +26 -0
  95. data/lib/one_gadget/builds/libc-2.33-f462ab2b79c7f29fb866da6e087e45261570a09c.rb +26 -0
  96. data/lib/one_gadget/builds/libc-2.33-f4af69206091c7f14a941f2dd77a79a7682a1184.rb +26 -0
  97. data/lib/one_gadget/builds/libc-2.34-140609514178a4bb96a3cd44ffdfede398a77610.rb +26 -0
  98. data/lib/one_gadget/builds/libc-2.34-25594d4b6cbecda86ec968fa940c6c09937db70f.rb +50 -0
  99. data/lib/one_gadget/builds/libc-2.34-387920279e1c7892042ff27d76315d55e4651db9.rb +26 -0
  100. data/lib/one_gadget/builds/libc-2.34-7e46fbc4d85f5df8b6f18630787ad281786a3512.rb +26 -0
  101. data/lib/one_gadget/builds/libc-2.34-8d631c824a37b236d1dc9686b224a573fd6048b4.rb +26 -0
  102. data/lib/one_gadget/builds/libc-2.34-b8037b6260865346802321dd2256b8ad1d857e63.rb +68 -0
  103. data/lib/one_gadget/builds/libc-2.34-ba4777827fe1fb729ca35acd99c8013936172a0d.rb +50 -0
  104. data/lib/one_gadget/builds/libc-2.34-f0fc29165cbe6088c0e1adf03b0048fbecbc003a.rb +68 -0
  105. data/lib/one_gadget/builds/libc-2.35-89c3cb85f9e55046776471fed05ec441581d1969.rb +62 -0
  106. data/lib/one_gadget/builds/libc-2.35-ab265082cac9486923c709d48ee5dde080e243ff.rb +41 -0
  107. data/lib/one_gadget/builds/libc-2.35-c376d41cff4473142a97ac1ff1eab433859dc3d4.rb +26 -0
  108. data/lib/one_gadget/builds/libc-2.35-dfca8b65dd2d2ca67f70dc7a556a6cfa8ba96ed8.rb +26 -0
  109. data/lib/one_gadget/cli.rb +1 -1
  110. data/lib/one_gadget/emulators/aarch64.rb +7 -8
  111. data/lib/one_gadget/emulators/amd64.rb +3 -0
  112. data/lib/one_gadget/emulators/lambda.rb +12 -4
  113. data/lib/one_gadget/emulators/processor.rb +9 -1
  114. data/lib/one_gadget/emulators/x86.rb +42 -19
  115. data/lib/one_gadget/fetchers/amd64.rb +2 -1
  116. data/lib/one_gadget/fetchers/base.rb +65 -34
  117. data/lib/one_gadget/gadget.rb +9 -5
  118. data/lib/one_gadget/update.rb +2 -2
  119. data/lib/one_gadget/version.rb +1 -1
  120. metadata +91 -5
@@ -0,0 +1,68 @@
1
+ require 'one_gadget/gadget'
2
+ # https://gitlab.com/david942j/libcdb/blob/master/libc/libc6_2.34-0ubuntu3_amd64/lib/x86_64-linux-gnu/libc.so.6
3
+ #
4
+ # Advanced Micro Devices X86-64
5
+ #
6
+ # GNU C Library (Ubuntu GLIBC 2.34-0ubuntu3) stable release version 2.34.
7
+ # Copyright (C) 2021 Free Software Foundation, Inc.
8
+ # This is free software; see the source for copying conditions.
9
+ # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
10
+ # PARTICULAR PURPOSE.
11
+ # Compiled by GNU CC version 10.3.0.
12
+ # libc ABIs: UNIQUE IFUNC ABSOLUTE
13
+ # For bug reporting instructions, please see:
14
+ # <https://bugs.launchpad.net/ubuntu/+source/glibc/+bugs>.
15
+
16
+ build_id = File.basename(__FILE__, '.rb').split('-').last
17
+ OneGadget::Gadget.add(build_id, 346000,
18
+ constraints: ["rsp & 0xf == 0", "rcx == NULL", "rbp == NULL || (u16)[rbp] == NULL"],
19
+ effect: "posix_spawn(rsp+0xc, \"/bin/sh\", 0, rbp, rsp+0x50, environ)")
20
+ OneGadget::Gadget.add(build_id, 346012,
21
+ constraints: ["rsp & 0xf == 0", "(u64)xmm0 == NULL", "rdx == NULL || (s32)[rdx+0x4] <= 0", "rbp == NULL || (u16)[rbp] == NULL"],
22
+ effect: "posix_spawn(rsp+0xc, \"/bin/sh\", rdx, rbp, rsp+0x50, environ)")
23
+ OneGadget::Gadget.add(build_id, 346033,
24
+ constraints: ["rsp & 0xf == 0", "[r8] == NULL", "[[rax]] == NULL || [rax] == NULL", "rdi == NULL || writable: rdi", "rdx == NULL || (s32)[rdx+0x4] <= 0", "rbp == NULL || (u16)[rbp] == NULL"],
25
+ effect: "posix_spawn(rdi, \"/bin/sh\", rdx, rbp, r8, [rax])")
26
+ OneGadget::Gadget.add(build_id, 346041,
27
+ constraints: ["rsp & 0xf == 0", "[r8] == NULL", "[[rax]] == NULL || [rax] == NULL", "rdi == NULL || writable: rdi", "rdx == NULL || (s32)[rdx+0x4] <= 0", "rcx == NULL || (u16)[rcx] == NULL"],
28
+ effect: "posix_spawn(rdi, \"/bin/sh\", rdx, rcx, r8, [rax])")
29
+ OneGadget::Gadget.add(build_id, 543811,
30
+ constraints: ["rsp & 0xf == 0", "rcx == NULL", "rbx+0xe0 == NULL || writable: rbx+0xe0", "r12 == NULL || (s32)[r12+0x4] <= 0"],
31
+ effect: "posix_spawn(rbx+0xe0, \"/bin/sh\", r12, 0, rsp+0x60, environ)")
32
+ OneGadget::Gadget.add(build_id, 543824,
33
+ constraints: ["rsp & 0xf == 0", "rcx == NULL", "rbx+0xe0 == NULL || writable: rbx+0xe0", "rdx == NULL || (s32)[rdx+0x4] <= 0"],
34
+ effect: "posix_spawn(rbx+0xe0, \"/bin/sh\", rdx, 0, rsp+0x60, environ)")
35
+ OneGadget::Gadget.add(build_id, 543829,
36
+ constraints: ["rsp & 0xf == 0", "(u64)xmm0 == NULL", "rbx+0xe0 == NULL || writable: rbx+0xe0", "rdx == NULL || (s32)[rdx+0x4] <= 0"],
37
+ effect: "posix_spawn(rbx+0xe0, \"/bin/sh\", rdx, 0, rsp+0x60, environ)")
38
+ OneGadget::Gadget.add(build_id, 543834,
39
+ constraints: ["rsp & 0xf == 0", "[r8] == NULL", "rbx+0xe0 == NULL || writable: rbx+0xe0", "rdx == NULL || (s32)[rdx+0x4] <= 0"],
40
+ effect: "posix_spawn(rbx+0xe0, \"/bin/sh\", rdx, 0, r8, environ)")
41
+ OneGadget::Gadget.add(build_id, 978124,
42
+ constraints: ["[r15] == NULL || r15 == NULL", "[r12] == NULL || r12 == NULL"],
43
+ effect: "execve(\"/bin/sh\", r15, r12)")
44
+ OneGadget::Gadget.add(build_id, 978127,
45
+ constraints: ["[r15] == NULL || r15 == NULL", "[rdx] == NULL || rdx == NULL"],
46
+ effect: "execve(\"/bin/sh\", r15, rdx)")
47
+ OneGadget::Gadget.add(build_id, 978130,
48
+ constraints: ["[rsi] == NULL || rsi == NULL", "[rdx] == NULL || rdx == NULL"],
49
+ effect: "execve(\"/bin/sh\", rsi, rdx)")
50
+ OneGadget::Gadget.add(build_id, 978613,
51
+ constraints: ["writable: rbp-0x78", "[r10] == NULL || r10 == NULL", "[[rbp-0x70]] == NULL || [rbp-0x70] == NULL"],
52
+ effect: "execve(\"/bin/sh\", r10, [rbp-0x70])")
53
+ OneGadget::Gadget.add(build_id, 978617,
54
+ constraints: ["writable: rbp-0x78", "[r10] == NULL || r10 == NULL", "[rdx] == NULL || rdx == NULL"],
55
+ effect: "execve(\"/bin/sh\", r10, rdx)")
56
+ OneGadget::Gadget.add(build_id, 1117482,
57
+ constraints: ["[rsp+0x70] == NULL", "[[rsp+0xf0]] == NULL || [rsp+0xf0] == NULL", "[rsp+0x38] == NULL || (s32)[[rsp+0x38]+0x4] <= 0"],
58
+ effect: "posix_spawn(rsp+0x64, \"/bin/sh\", [rsp+0x38], 0, rsp+0x70, [rsp+0xf0])")
59
+ OneGadget::Gadget.add(build_id, 1117490,
60
+ constraints: ["[rsp+0x70] == NULL", "[r9] == NULL || r9 == NULL", "[rsp+0x38] == NULL || (s32)[[rsp+0x38]+0x4] <= 0"],
61
+ effect: "posix_spawn(rsp+0x64, \"/bin/sh\", [rsp+0x38], 0, rsp+0x70, r9)")
62
+ OneGadget::Gadget.add(build_id, 1117495,
63
+ constraints: ["[rsp+0x70] == NULL", "[r9] == NULL || r9 == NULL", "rdx == NULL || (s32)[rdx+0x4] <= 0"],
64
+ effect: "posix_spawn(rsp+0x64, \"/bin/sh\", rdx, 0, rsp+0x70, r9)")
65
+ OneGadget::Gadget.add(build_id, 1117505,
66
+ constraints: ["[r8] == NULL", "[r9] == NULL || r9 == NULL", "rdi == NULL || writable: rdi", "rdx == NULL || (s32)[rdx+0x4] <= 0"],
67
+ effect: "posix_spawn(rdi, \"/bin/sh\", rdx, 0, r8, r9)")
68
+
@@ -0,0 +1,50 @@
1
+ require 'one_gadget/gadget'
2
+ # https://gitlab.com/david942j/libcdb/blob/master/libc/libc6-amd64_2.34-0ubuntu3_i386/lib64/libc.so.6
3
+ #
4
+ # Advanced Micro Devices X86-64
5
+ #
6
+ # GNU C Library (Ubuntu GLIBC 2.34-0ubuntu3) stable release version 2.34.
7
+ # Copyright (C) 2021 Free Software Foundation, Inc.
8
+ # This is free software; see the source for copying conditions.
9
+ # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
10
+ # PARTICULAR PURPOSE.
11
+ # Compiled by GNU CC version 10.3.0.
12
+ # libc ABIs: UNIQUE IFUNC ABSOLUTE
13
+ # For bug reporting instructions, please see:
14
+ # <https://bugs.launchpad.net/ubuntu/+source/glibc/+bugs>.
15
+
16
+ build_id = File.basename(__FILE__, '.rb').split('-').last
17
+ OneGadget::Gadget.add(build_id, 324314,
18
+ constraints: ["rax == NULL", "rdi == NULL || writable: rdi", "rdx == NULL || (s32)[rdx+0x4] <= 0", "rcx == NULL || (u16)[rcx] == NULL"],
19
+ effect: "posix_spawn(rdi, \"/bin/sh\", rdx, rcx, rsp+0x50, environ)")
20
+ OneGadget::Gadget.add(build_id, 324336,
21
+ constraints: ["[r8] == NULL", "rdi == NULL || writable: rdi", "rdx == NULL || (s32)[rdx+0x4] <= 0", "rcx == NULL || (u16)[rcx] == NULL"],
22
+ effect: "posix_spawn(rdi, \"/bin/sh\", rdx, rcx, r8, environ)")
23
+ OneGadget::Gadget.add(build_id, 506716,
24
+ constraints: ["[r8] == NULL", "rbx+0xe0 == NULL || writable: rbx+0xe0", "r12 == NULL || (s32)[r12+0x4] <= 0", "rcx == NULL || (u16)[rcx] == NULL"],
25
+ effect: "posix_spawn(rbx+0xe0, \"/bin/sh\", r12, rcx, r8, environ)")
26
+ OneGadget::Gadget.add(build_id, 506731,
27
+ constraints: ["[r8] == NULL", "rbx+0xe0 == NULL || writable: rbx+0xe0", "rdx == NULL || (s32)[rdx+0x4] <= 0", "rcx == NULL || (u16)[rcx] == NULL"],
28
+ effect: "posix_spawn(rbx+0xe0, \"/bin/sh\", rdx, rcx, r8, environ)")
29
+ OneGadget::Gadget.add(build_id, 909902,
30
+ constraints: ["[r13] == NULL || r13 == NULL", "[r12] == NULL || r12 == NULL"],
31
+ effect: "execve(\"/bin/sh\", r13, r12)")
32
+ OneGadget::Gadget.add(build_id, 909905,
33
+ constraints: ["[r13] == NULL || r13 == NULL", "[rdx] == NULL || rdx == NULL"],
34
+ effect: "execve(\"/bin/sh\", r13, rdx)")
35
+ OneGadget::Gadget.add(build_id, 909908,
36
+ constraints: ["[rsi] == NULL || rsi == NULL", "[rdx] == NULL || rdx == NULL"],
37
+ effect: "execve(\"/bin/sh\", rsi, rdx)")
38
+ OneGadget::Gadget.add(build_id, 1031210,
39
+ constraints: ["[rsp+0x70] == NULL", "[[rsp+0xf0]] == NULL || [rsp+0xf0] == NULL", "[rsp+0x40] == NULL || (s32)[[rsp+0x40]+0x4] <= 0"],
40
+ effect: "posix_spawn(rsp+0x64, \"/bin/sh\", [rsp+0x40], 0, rsp+0x70, [rsp+0xf0])")
41
+ OneGadget::Gadget.add(build_id, 1031218,
42
+ constraints: ["[rsp+0x70] == NULL", "[r9] == NULL || r9 == NULL", "[rsp+0x40] == NULL || (s32)[[rsp+0x40]+0x4] <= 0"],
43
+ effect: "posix_spawn(rsp+0x64, \"/bin/sh\", [rsp+0x40], 0, rsp+0x70, r9)")
44
+ OneGadget::Gadget.add(build_id, 1031223,
45
+ constraints: ["[rsp+0x70] == NULL", "[r9] == NULL || r9 == NULL", "rdx == NULL || (s32)[rdx+0x4] <= 0"],
46
+ effect: "posix_spawn(rsp+0x64, \"/bin/sh\", rdx, 0, rsp+0x70, r9)")
47
+ OneGadget::Gadget.add(build_id, 1031233,
48
+ constraints: ["[r8] == NULL", "[r9] == NULL || r9 == NULL", "rdi == NULL || writable: rdi", "rdx == NULL || (s32)[rdx+0x4] <= 0"],
49
+ effect: "posix_spawn(rdi, \"/bin/sh\", rdx, 0, r8, r9)")
50
+
@@ -0,0 +1,68 @@
1
+ require 'one_gadget/gadget'
2
+ # https://gitlab.com/david942j/libcdb/blob/master/libc/libc6_2.34-0ubuntu3.2_amd64/lib/x86_64-linux-gnu/libc.so.6
3
+ #
4
+ # Advanced Micro Devices X86-64
5
+ #
6
+ # GNU C Library (Ubuntu GLIBC 2.34-0ubuntu3.2) stable release version 2.34.
7
+ # Copyright (C) 2021 Free Software Foundation, Inc.
8
+ # This is free software; see the source for copying conditions.
9
+ # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
10
+ # PARTICULAR PURPOSE.
11
+ # Compiled by GNU CC version 10.3.0.
12
+ # libc ABIs: UNIQUE IFUNC ABSOLUTE
13
+ # For bug reporting instructions, please see:
14
+ # <https://bugs.launchpad.net/ubuntu/+source/glibc/+bugs>.
15
+
16
+ build_id = File.basename(__FILE__, '.rb').split('-').last
17
+ OneGadget::Gadget.add(build_id, 329616,
18
+ constraints: ["rsp & 0xf == 0", "rcx == NULL", "rbp == NULL || (u16)[rbp] == NULL"],
19
+ effect: "posix_spawn(rsp+0xc, \"/bin/sh\", 0, rbp, rsp+0x50, environ)")
20
+ OneGadget::Gadget.add(build_id, 329628,
21
+ constraints: ["rsp & 0xf == 0", "(u64)xmm0 == NULL", "rdx == NULL || (s32)[rdx+0x4] <= 0", "rbp == NULL || (u16)[rbp] == NULL"],
22
+ effect: "posix_spawn(rsp+0xc, \"/bin/sh\", rdx, rbp, rsp+0x50, environ)")
23
+ OneGadget::Gadget.add(build_id, 329649,
24
+ constraints: ["rsp & 0xf == 0", "[r8] == NULL", "[[rax]] == NULL || [rax] == NULL", "rdi == NULL || writable: rdi", "rdx == NULL || (s32)[rdx+0x4] <= 0", "rbp == NULL || (u16)[rbp] == NULL"],
25
+ effect: "posix_spawn(rdi, \"/bin/sh\", rdx, rbp, r8, [rax])")
26
+ OneGadget::Gadget.add(build_id, 329657,
27
+ constraints: ["rsp & 0xf == 0", "[r8] == NULL", "[[rax]] == NULL || [rax] == NULL", "rdi == NULL || writable: rdi", "rdx == NULL || (s32)[rdx+0x4] <= 0", "rcx == NULL || (u16)[rcx] == NULL"],
28
+ effect: "posix_spawn(rdi, \"/bin/sh\", rdx, rcx, r8, [rax])")
29
+ OneGadget::Gadget.add(build_id, 527459,
30
+ constraints: ["rsp & 0xf == 0", "rcx == NULL", "rbx+0xe0 == NULL || writable: rbx+0xe0", "r12 == NULL || (s32)[r12+0x4] <= 0"],
31
+ effect: "posix_spawn(rbx+0xe0, \"/bin/sh\", r12, 0, rsp+0x60, environ)")
32
+ OneGadget::Gadget.add(build_id, 527472,
33
+ constraints: ["rsp & 0xf == 0", "rcx == NULL", "rbx+0xe0 == NULL || writable: rbx+0xe0", "rdx == NULL || (s32)[rdx+0x4] <= 0"],
34
+ effect: "posix_spawn(rbx+0xe0, \"/bin/sh\", rdx, 0, rsp+0x60, environ)")
35
+ OneGadget::Gadget.add(build_id, 527477,
36
+ constraints: ["rsp & 0xf == 0", "(u64)xmm0 == NULL", "rbx+0xe0 == NULL || writable: rbx+0xe0", "rdx == NULL || (s32)[rdx+0x4] <= 0"],
37
+ effect: "posix_spawn(rbx+0xe0, \"/bin/sh\", rdx, 0, rsp+0x60, environ)")
38
+ OneGadget::Gadget.add(build_id, 527482,
39
+ constraints: ["rsp & 0xf == 0", "[r8] == NULL", "rbx+0xe0 == NULL || writable: rbx+0xe0", "rdx == NULL || (s32)[rdx+0x4] <= 0"],
40
+ effect: "posix_spawn(rbx+0xe0, \"/bin/sh\", rdx, 0, r8, environ)")
41
+ OneGadget::Gadget.add(build_id, 961772,
42
+ constraints: ["[r15] == NULL || r15 == NULL", "[r12] == NULL || r12 == NULL"],
43
+ effect: "execve(\"/bin/sh\", r15, r12)")
44
+ OneGadget::Gadget.add(build_id, 961775,
45
+ constraints: ["[r15] == NULL || r15 == NULL", "[rdx] == NULL || rdx == NULL"],
46
+ effect: "execve(\"/bin/sh\", r15, rdx)")
47
+ OneGadget::Gadget.add(build_id, 961778,
48
+ constraints: ["[rsi] == NULL || rsi == NULL", "[rdx] == NULL || rdx == NULL"],
49
+ effect: "execve(\"/bin/sh\", rsi, rdx)")
50
+ OneGadget::Gadget.add(build_id, 962261,
51
+ constraints: ["writable: rbp-0x78", "[r10] == NULL || r10 == NULL", "[[rbp-0x70]] == NULL || [rbp-0x70] == NULL"],
52
+ effect: "execve(\"/bin/sh\", r10, [rbp-0x70])")
53
+ OneGadget::Gadget.add(build_id, 962265,
54
+ constraints: ["writable: rbp-0x78", "[r10] == NULL || r10 == NULL", "[rdx] == NULL || rdx == NULL"],
55
+ effect: "execve(\"/bin/sh\", r10, rdx)")
56
+ OneGadget::Gadget.add(build_id, 1101130,
57
+ constraints: ["[rsp+0x70] == NULL", "[[rsp+0xf0]] == NULL || [rsp+0xf0] == NULL", "[rsp+0x38] == NULL || (s32)[[rsp+0x38]+0x4] <= 0"],
58
+ effect: "posix_spawn(rsp+0x64, \"/bin/sh\", [rsp+0x38], 0, rsp+0x70, [rsp+0xf0])")
59
+ OneGadget::Gadget.add(build_id, 1101138,
60
+ constraints: ["[rsp+0x70] == NULL", "[r9] == NULL || r9 == NULL", "[rsp+0x38] == NULL || (s32)[[rsp+0x38]+0x4] <= 0"],
61
+ effect: "posix_spawn(rsp+0x64, \"/bin/sh\", [rsp+0x38], 0, rsp+0x70, r9)")
62
+ OneGadget::Gadget.add(build_id, 1101143,
63
+ constraints: ["[rsp+0x70] == NULL", "[r9] == NULL || r9 == NULL", "rdx == NULL || (s32)[rdx+0x4] <= 0"],
64
+ effect: "posix_spawn(rsp+0x64, \"/bin/sh\", rdx, 0, rsp+0x70, r9)")
65
+ OneGadget::Gadget.add(build_id, 1101153,
66
+ constraints: ["[r8] == NULL", "[r9] == NULL || r9 == NULL", "rdi == NULL || writable: rdi", "rdx == NULL || (s32)[rdx+0x4] <= 0"],
67
+ effect: "posix_spawn(rdi, \"/bin/sh\", rdx, 0, r8, r9)")
68
+
@@ -0,0 +1,62 @@
1
+ require 'one_gadget/gadget'
2
+ # https://gitlab.com/david942j/libcdb/blob/master/libc/libc6_2.35-0ubuntu3_amd64/lib/x86_64-linux-gnu/libc.so.6
3
+ #
4
+ # Advanced Micro Devices X86-64
5
+ #
6
+ # GNU C Library (Ubuntu GLIBC 2.35-0ubuntu3) stable release version 2.35.
7
+ # Copyright (C) 2022 Free Software Foundation, Inc.
8
+ # This is free software; see the source for copying conditions.
9
+ # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
10
+ # PARTICULAR PURPOSE.
11
+ # Compiled by GNU CC version 11.2.0.
12
+ # libc ABIs: UNIQUE IFUNC ABSOLUTE
13
+ # For bug reporting instructions, please see:
14
+ # <https://bugs.launchpad.net/ubuntu/+source/glibc/+bugs>.
15
+
16
+ build_id = File.basename(__FILE__, '.rb').split('-').last
17
+ OneGadget::Gadget.add(build_id, 330295,
18
+ constraints: ["rsp & 0xf == 0", "rcx == NULL", "rbp == NULL || (u16)[rbp] == NULL"],
19
+ effect: "posix_spawn(rsp+0x1c, \"/bin/sh\", 0, rbp, rsp+0x60, environ)")
20
+ OneGadget::Gadget.add(build_id, 330307,
21
+ constraints: ["rsp & 0xf == 0", "(u64)xmm0 == NULL", "rdx == NULL || (s32)[rdx+0x4] <= 0", "rbp == NULL || (u16)[rbp] == NULL"],
22
+ effect: "posix_spawn(rsp+0x1c, \"/bin/sh\", rdx, rbp, rsp+0x60, environ)")
23
+ OneGadget::Gadget.add(build_id, 330328,
24
+ constraints: ["rsp & 0xf == 0", "[r8] == NULL", "[[rax]] == NULL || [rax] == NULL", "rdi == NULL || writable: rdi", "rdx == NULL || (s32)[rdx+0x4] <= 0", "rbp == NULL || (u16)[rbp] == NULL"],
25
+ effect: "posix_spawn(rdi, \"/bin/sh\", rdx, rbp, r8, [rax])")
26
+ OneGadget::Gadget.add(build_id, 330336,
27
+ constraints: ["rsp & 0xf == 0", "[r8] == NULL", "[[rax]] == NULL || [rax] == NULL", "rdi == NULL || writable: rdi", "rdx == NULL || (s32)[rdx+0x4] <= 0", "rcx == NULL || (u16)[rcx] == NULL"],
28
+ effect: "posix_spawn(rdi, \"/bin/sh\", rdx, rcx, r8, [rax])")
29
+ OneGadget::Gadget.add(build_id, 527427,
30
+ constraints: ["rsp & 0xf == 0", "rcx == NULL", "rbx+0xe0 == NULL || writable: rbx+0xe0", "r12 == NULL || (s32)[r12+0x4] <= 0"],
31
+ effect: "posix_spawn(rbx+0xe0, \"/bin/sh\", r12, 0, rsp+0x60, environ)")
32
+ OneGadget::Gadget.add(build_id, 527440,
33
+ constraints: ["rsp & 0xf == 0", "rcx == NULL", "rbx+0xe0 == NULL || writable: rbx+0xe0", "rdx == NULL || (s32)[rdx+0x4] <= 0"],
34
+ effect: "posix_spawn(rbx+0xe0, \"/bin/sh\", rdx, 0, rsp+0x60, environ)")
35
+ OneGadget::Gadget.add(build_id, 527445,
36
+ constraints: ["rsp & 0xf == 0", "(u64)xmm0 == NULL", "rbx+0xe0 == NULL || writable: rbx+0xe0", "rdx == NULL || (s32)[rdx+0x4] <= 0"],
37
+ effect: "posix_spawn(rbx+0xe0, \"/bin/sh\", rdx, 0, rsp+0x60, environ)")
38
+ OneGadget::Gadget.add(build_id, 527450,
39
+ constraints: ["rsp & 0xf == 0", "[r8] == NULL", "rbx+0xe0 == NULL || writable: rbx+0xe0", "rdx == NULL || (s32)[rdx+0x4] <= 0"],
40
+ effect: "posix_spawn(rbx+0xe0, \"/bin/sh\", rdx, 0, r8, environ)")
41
+ OneGadget::Gadget.add(build_id, 965873,
42
+ constraints: ["writable: rbp-0x78", "[r10] == NULL || r10 == NULL", "[[rbp-0x70]] == NULL || [rbp-0x70] == NULL"],
43
+ effect: "execve(\"/bin/sh\", r10, [rbp-0x70])")
44
+ OneGadget::Gadget.add(build_id, 965877,
45
+ constraints: ["writable: rbp-0x78", "[r10] == NULL || r10 == NULL", "[rdx] == NULL || rdx == NULL"],
46
+ effect: "execve(\"/bin/sh\", r10, rdx)")
47
+ OneGadget::Gadget.add(build_id, 965880,
48
+ constraints: ["writable: rbp-0x78", "[rsi] == NULL || rsi == NULL", "[rdx] == NULL || rdx == NULL"],
49
+ effect: "execve(\"/bin/sh\", rsi, rdx)")
50
+ OneGadget::Gadget.add(build_id, 1104834,
51
+ constraints: ["[rsp+0x70] == NULL", "[[rsp+0xf0]] == NULL || [rsp+0xf0] == NULL", "[rsp+0x40] == NULL || (s32)[[rsp+0x40]+0x4] <= 0"],
52
+ effect: "posix_spawn(rsp+0x64, \"/bin/sh\", [rsp+0x40], 0, rsp+0x70, [rsp+0xf0])")
53
+ OneGadget::Gadget.add(build_id, 1104842,
54
+ constraints: ["[rsp+0x70] == NULL", "[r9] == NULL || r9 == NULL", "[rsp+0x40] == NULL || (s32)[[rsp+0x40]+0x4] <= 0"],
55
+ effect: "posix_spawn(rsp+0x64, \"/bin/sh\", [rsp+0x40], 0, rsp+0x70, r9)")
56
+ OneGadget::Gadget.add(build_id, 1104847,
57
+ constraints: ["[rsp+0x70] == NULL", "[r9] == NULL || r9 == NULL", "rdx == NULL || (s32)[rdx+0x4] <= 0"],
58
+ effect: "posix_spawn(rsp+0x64, \"/bin/sh\", rdx, 0, rsp+0x70, r9)")
59
+ OneGadget::Gadget.add(build_id, 1104857,
60
+ constraints: ["[r8] == NULL", "[r9] == NULL || r9 == NULL", "rdi == NULL || writable: rdi", "rdx == NULL || (s32)[rdx+0x4] <= 0"],
61
+ effect: "posix_spawn(rdi, \"/bin/sh\", rdx, 0, r8, r9)")
62
+
@@ -0,0 +1,41 @@
1
+ require 'one_gadget/gadget'
2
+ # https://gitlab.com/david942j/libcdb/blob/master/libc/libc6-amd64_2.35-0ubuntu3_i386/lib64/libc.so.6
3
+ #
4
+ # Advanced Micro Devices X86-64
5
+ #
6
+ # GNU C Library (Ubuntu GLIBC 2.35-0ubuntu3) stable release version 2.35.
7
+ # Copyright (C) 2022 Free Software Foundation, Inc.
8
+ # This is free software; see the source for copying conditions.
9
+ # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
10
+ # PARTICULAR PURPOSE.
11
+ # Compiled by GNU CC version 11.2.0.
12
+ # libc ABIs: UNIQUE IFUNC ABSOLUTE
13
+ # For bug reporting instructions, please see:
14
+ # <https://bugs.launchpad.net/ubuntu/+source/glibc/+bugs>.
15
+
16
+ build_id = File.basename(__FILE__, '.rb').split('-').last
17
+ OneGadget::Gadget.add(build_id, 307427,
18
+ constraints: ["rax == NULL", "rdi == NULL || writable: rdi", "rdx == NULL || (s32)[rdx+0x4] <= 0", "rcx == NULL || (u16)[rcx] == NULL"],
19
+ effect: "posix_spawn(rdi, \"/bin/sh\", rdx, rcx, rsp+0x50, environ)")
20
+ OneGadget::Gadget.add(build_id, 307449,
21
+ constraints: ["[r8] == NULL", "rdi == NULL || writable: rdi", "rdx == NULL || (s32)[rdx+0x4] <= 0", "rcx == NULL || (u16)[rcx] == NULL"],
22
+ effect: "posix_spawn(rdi, \"/bin/sh\", rdx, rcx, r8, environ)")
23
+ OneGadget::Gadget.add(build_id, 489356,
24
+ constraints: ["[r8] == NULL", "rbx+0xe0 == NULL || writable: rbx+0xe0", "r12 == NULL || (s32)[r12+0x4] <= 0", "rcx == NULL || (u16)[rcx] == NULL"],
25
+ effect: "posix_spawn(rbx+0xe0, \"/bin/sh\", r12, rcx, r8, environ)")
26
+ OneGadget::Gadget.add(build_id, 489371,
27
+ constraints: ["[r8] == NULL", "rbx+0xe0 == NULL || writable: rbx+0xe0", "rdx == NULL || (s32)[rdx+0x4] <= 0", "rcx == NULL || (u16)[rcx] == NULL"],
28
+ effect: "posix_spawn(rbx+0xe0, \"/bin/sh\", rdx, rcx, r8, environ)")
29
+ OneGadget::Gadget.add(build_id, 1016778,
30
+ constraints: ["[rsp+0x70] == NULL", "[[rsp+0xf0]] == NULL || [rsp+0xf0] == NULL", "[rsp+0x38] == NULL || (s32)[[rsp+0x38]+0x4] <= 0"],
31
+ effect: "posix_spawn(rsp+0x64, \"/bin/sh\", [rsp+0x38], 0, rsp+0x70, [rsp+0xf0])")
32
+ OneGadget::Gadget.add(build_id, 1016786,
33
+ constraints: ["[rsp+0x70] == NULL", "[r9] == NULL || r9 == NULL", "[rsp+0x38] == NULL || (s32)[[rsp+0x38]+0x4] <= 0"],
34
+ effect: "posix_spawn(rsp+0x64, \"/bin/sh\", [rsp+0x38], 0, rsp+0x70, r9)")
35
+ OneGadget::Gadget.add(build_id, 1016791,
36
+ constraints: ["[rsp+0x70] == NULL", "[r9] == NULL || r9 == NULL", "rdx == NULL || (s32)[rdx+0x4] <= 0"],
37
+ effect: "posix_spawn(rsp+0x64, \"/bin/sh\", rdx, 0, rsp+0x70, r9)")
38
+ OneGadget::Gadget.add(build_id, 1016801,
39
+ constraints: ["[r8] == NULL", "[r9] == NULL || r9 == NULL", "rdi == NULL || writable: rdi", "rdx == NULL || (s32)[rdx+0x4] <= 0"],
40
+ effect: "posix_spawn(rdi, \"/bin/sh\", rdx, 0, r8, r9)")
41
+
@@ -0,0 +1,26 @@
1
+ require 'one_gadget/gadget'
2
+ # https://gitlab.com/david942j/libcdb/blob/master/libc/libc6_2.35-0ubuntu3_i386/lib/i386-linux-gnu/libc.so.6
3
+ #
4
+ # Intel 80386
5
+ #
6
+ # GNU C Library (Ubuntu GLIBC 2.35-0ubuntu3) stable release version 2.35.
7
+ # Copyright (C) 2022 Free Software Foundation, Inc.
8
+ # This is free software; see the source for copying conditions.
9
+ # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
10
+ # PARTICULAR PURPOSE.
11
+ # Compiled by GNU CC version 11.2.0.
12
+ # libc ABIs: UNIQUE IFUNC ABSOLUTE
13
+ # For bug reporting instructions, please see:
14
+ # <https://bugs.launchpad.net/ubuntu/+source/glibc/+bugs>.
15
+
16
+ build_id = File.basename(__FILE__, '.rb').split('-').last
17
+ OneGadget::Gadget.add(build_id, 912899,
18
+ constraints: ["ebx is the GOT address of libc", "writable: ebp-0x20", "[[ebp-0x30]] == NULL || [ebp-0x30] == NULL", "[[ebp-0x2c]] == NULL || [ebp-0x2c] == NULL"],
19
+ effect: "execve(\"/bin/sh\", [ebp-0x30], [ebp-0x2c])")
20
+ OneGadget::Gadget.add(build_id, 1517633,
21
+ constraints: ["esi is the GOT address of libc", "eax == NULL"],
22
+ effect: "execl(\"/bin/sh\", eax)")
23
+ OneGadget::Gadget.add(build_id, 1517634,
24
+ constraints: ["esi is the GOT address of libc", "[esp] == NULL"],
25
+ effect: "execl(\"/bin/sh\", [esp])")
26
+
@@ -0,0 +1,26 @@
1
+ require 'one_gadget/gadget'
2
+ # https://gitlab.com/david942j/libcdb/blob/master/libc/libc6-i386_2.35-0ubuntu3_amd64/lib32/libc.so.6
3
+ #
4
+ # Intel 80386
5
+ #
6
+ # GNU C Library (Ubuntu GLIBC 2.35-0ubuntu3) stable release version 2.35.
7
+ # Copyright (C) 2022 Free Software Foundation, Inc.
8
+ # This is free software; see the source for copying conditions.
9
+ # There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
10
+ # PARTICULAR PURPOSE.
11
+ # Compiled by GNU CC version 11.2.0.
12
+ # libc ABIs: UNIQUE IFUNC ABSOLUTE
13
+ # For bug reporting instructions, please see:
14
+ # <https://bugs.launchpad.net/ubuntu/+source/glibc/+bugs>.
15
+
16
+ build_id = File.basename(__FILE__, '.rb').split('-').last
17
+ OneGadget::Gadget.add(build_id, 907139,
18
+ constraints: ["ebx is the GOT address of libc", "writable: ebp-0x20", "[[ebp-0x30]] == NULL || [ebp-0x30] == NULL", "[[ebp-0x2c]] == NULL || [ebp-0x2c] == NULL"],
19
+ effect: "execve(\"/bin/sh\", [ebp-0x30], [ebp-0x2c])")
20
+ OneGadget::Gadget.add(build_id, 1502977,
21
+ constraints: ["esi is the GOT address of libc", "eax == NULL"],
22
+ effect: "execl(\"/bin/sh\", eax)")
23
+ OneGadget::Gadget.add(build_id, 1502978,
24
+ constraints: ["esi is the GOT address of libc", "[esp] == NULL"],
25
+ effect: "execl(\"/bin/sh\", [esp])")
26
+
@@ -120,7 +120,7 @@ module OneGadget
120
120
  end
121
121
 
122
122
  opts.on('-n', '--near FUNCTIONS/FILE', 'Order gadgets by their distance to the given functions'\
123
- ' or to the GOT functions of the given file.') do |n|
123
+ ' or to the GOT functions of the given file.') do |n|
124
124
  @options[:near] = n
125
125
  end
126
126
 
@@ -49,8 +49,8 @@ module OneGadget
49
49
  def inst_add(dst, src, op2, mode = 'sxtw')
50
50
  check_register!(dst)
51
51
 
52
- src = OneGadget::Emulators::Lambda.parse(src, predefined: registers)
53
- op2 = OneGadget::Emulators::Lambda.parse(op2, predefined: registers)
52
+ src = arg_to_lambda(src)
53
+ op2 = arg_to_lambda(op2)
54
54
  raise_unsupported('add', dst, src, op2) unless op2.is_a?(Integer) && mode == 'sxtw'
55
55
 
56
56
  registers[dst] = src + op2
@@ -84,7 +84,7 @@ module OneGadget
84
84
  def inst_ldr(dst, src, index = 0)
85
85
  check_register!(dst)
86
86
 
87
- src_l = OneGadget::Emulators::Lambda.parse(src, predefined: registers)
87
+ src_l = arg_to_lambda(src)
88
88
  registers[dst] = src_l
89
89
  raise_unsupported('ldr', dst, src, index) unless OneGadget::Helper.integer?(index)
90
90
 
@@ -101,28 +101,27 @@ module OneGadget
101
101
  def inst_mov(dst, src)
102
102
  check_register!(dst)
103
103
 
104
- src = OneGadget::Emulators::Lambda.parse(src, predefined: registers)
105
- registers[dst] = src
104
+ registers[dst] = arg_to_lambda(src)
106
105
  end
107
106
 
108
107
  def inst_stp(reg1, reg2, dst)
109
108
  raise_unsupported('stp', reg1, reg2, dst) unless reg64?(reg1) && reg64?(reg2)
110
109
 
111
- dst_l = OneGadget::Emulators::Lambda.parse(dst, predefined: registers).ref!
110
+ dst_l = arg_to_lambda(dst).ref!
112
111
  raise_unsupported('stp', reg1, reg2, dst) unless dst_l.obj == sp && dst_l.deref_count.zero?
113
112
 
114
113
  cur_top = dst_l.evaluate(eval_dict)
115
114
  stack[cur_top] = registers[reg1]
116
115
  stack[cur_top + size_t] = registers[reg2]
117
116
 
118
- registers[sp] += OneGadget::Emulators::Lambda.parse(dst).immi if dst.end_with?('!')
117
+ registers[sp] += arg_to_lambda(dst).immi if dst.end_with?('!')
119
118
  end
120
119
 
121
120
  def inst_str(src, dst, index = 0)
122
121
  check_register!(src)
123
122
  raise_unsupported('str', src, dst, index) unless OneGadget::Helper.integer?(index)
124
123
 
125
- dst_l = OneGadget::Emulators::Lambda.parse(dst, predefined: registers).ref!
124
+ dst_l = arg_to_lambda(dst).ref!
126
125
  # Only stores on stack.
127
126
  if dst_l.obj == sp && dst_l.deref_count.zero?
128
127
  cur_top = dst_l.evaluate(eval_dict)
@@ -27,6 +27,9 @@ module OneGadget
27
27
  when 0 then registers['rdi']
28
28
  when 1 then registers['rsi']
29
29
  when 2 then registers['rdx']
30
+ when 3 then registers['rcx']
31
+ when 4 then registers['r8']
32
+ when 5 then registers['r9']
30
33
  end
31
34
  end
32
35
  end
@@ -46,13 +46,13 @@ module OneGadget
46
46
  self.+(-other)
47
47
  end
48
48
 
49
- # Increase dereference count with 1.
49
+ # Increase dereference count by 1.
50
50
  # @return [void]
51
51
  def deref!
52
52
  @deref_count += 1
53
53
  end
54
54
 
55
- # Decrease dereference count with 1.
55
+ # Decrease dereference count by 1.
56
56
  # @return [self]
57
57
  # @raise [Error::InstrutionArgumentError] When this object cannot be referenced anymore.
58
58
  def ref!
@@ -105,7 +105,7 @@ module OneGadget
105
105
  # @param [Hash{String => Lambda}] predefined
106
106
  # Predefined values.
107
107
  # @return [OneGadget::Emulators::Lambda, Integer]
108
- # If +argument+ contains number only, returns the value.
108
+ # If +argument+ contains numbers only, returns the value.
109
109
  # Otherwise, returns a {Lambda} object.
110
110
  # @example
111
111
  # obj = Lambda.parse('[rsp+0x50]')
@@ -117,9 +117,17 @@ module OneGadget
117
117
  # #=> #<Lambda @obj='x0', @immi=-104, @deref_count=1>
118
118
  def parse(argument, predefined: {})
119
119
  arg = argument.dup
120
+ return 0 if arg.empty? || arg == '!'
120
121
  return Integer(arg) if OneGadget::Helper.integer?(arg)
122
+
121
123
  # nested []
122
- return parse(arg[1...arg.rindex(']')], predefined: predefined).deref if arg[0] == '['
124
+ if arg[0] == '['
125
+ ridx = arg.rindex(']')
126
+ immi = parse(arg[(ridx + 1)..-1])
127
+ lm = parse(arg[1...ridx], predefined: predefined).deref
128
+ lm += immi unless immi.zero?
129
+ return lm
130
+ end
123
131
 
124
132
  base, disp = mem_obj(arg)
125
133
  obj = predefined[base] || Lambda.new(base)
@@ -47,7 +47,7 @@ module OneGadget
47
47
  # @return [Boolean]
48
48
  def process(cmd)
49
49
  process!(cmd)
50
- # rescue OneGadget::Error::UnsupportedError # for debugging
50
+ # rescue OneGadget::Error::UnsupportedError => e; p e # for debugging
51
51
  rescue OneGadget::Error::Error
52
52
  false
53
53
  end
@@ -115,6 +115,14 @@ module OneGadget
115
115
  OneGadget::Emulators::Lambda.new(reg)
116
116
  end
117
117
 
118
+ # Fetch the corresponding lambda value of instruction arguments from the current register sets.
119
+ #
120
+ # @param [String] arg The instruction argument passed to inst_* functions.
121
+ # @return [Lambda]
122
+ def arg_to_lambda(arg)
123
+ OneGadget::Emulators::Lambda.parse(arg, predefined: registers)
124
+ end
125
+
118
126
  def raise_unsupported(inst, *args)
119
127
  raise OneGadget::Error::UnsupportedInstructionArgumentError, "#{inst} #{args.join(', ')}"
120
128
  end
@@ -45,14 +45,15 @@ module OneGadget
45
45
  Instruction.new('xor', 2),
46
46
  Instruction.new('movq', 2),
47
47
  Instruction.new('movaps', 2),
48
- Instruction.new('movhps', 2)
48
+ Instruction.new('movhps', 2),
49
+ Instruction.new('punpcklqdq', 2)
49
50
  ]
50
51
  end
51
52
 
52
53
  private
53
54
 
54
55
  def inst_mov(dst, src)
55
- src = OneGadget::Emulators::Lambda.parse(src, predefined: registers)
56
+ src = arg_to_lambda(src)
56
57
  if register?(dst)
57
58
  registers[dst] = src
58
59
  else
@@ -60,7 +61,7 @@ module OneGadget
60
61
  # TODO(david942j): #120
61
62
  return add_writable(dst) unless dst.include?(sp)
62
63
 
63
- dst = OneGadget::Emulators::Lambda.parse(dst, predefined: registers)
64
+ dst = arg_to_lambda(dst)
64
65
  return if dst.deref_count != 1 # should not happen
65
66
 
66
67
  dst.ref!
@@ -79,9 +80,17 @@ module OneGadget
79
80
  end
80
81
  end
81
82
 
82
- # Move *src to dst[:64]
83
+ # Move src to dst[:64]
84
+ # Supported forms:
85
+ # movq xmm*, [sp+*]
86
+ # movq xmm*, reg64
83
87
  def inst_movq(dst, src)
84
- # XXX: here we only support `movq xmm*, [sp+*]`
88
+ if self.class.bits == 64 && xmm_reg?(dst) && src.start_with?('r') && register?(src)
89
+ dst = arg_to_lambda(dst)
90
+ src = arg_to_lambda(src)
91
+ dst[0] = src
92
+ return
93
+ end
85
94
  dst, src = check_xmm_sp(dst, src) { raise_unsupported('movq', dst, src) }
86
95
  off = src.evaluate(eval_dict)
87
96
  (64 / self.class.bits).times do |i|
@@ -89,7 +98,7 @@ module OneGadget
89
98
  end
90
99
  end
91
100
 
92
- # Move *src to dst[64:128]
101
+ # Move src to dst[64:128]
93
102
  def inst_movhps(dst, src)
94
103
  # XXX: here we only support `movhps xmm*, [sp+*]`
95
104
  dst, src = check_xmm_sp(dst, src) { raise_unsupported('movhps', dst, src) }
@@ -99,28 +108,41 @@ module OneGadget
99
108
  end
100
109
  end
101
110
 
102
- # check if (dst, src) in form (xmm*, [sp+*])
111
+ # check whether (dst, src) is in form (xmm*, [sp+*])
103
112
  def check_xmm_sp(dst, src)
104
- return yield unless dst.start_with?('xmm') && register?(dst) && src.include?(sp)
113
+ return yield unless xmm_reg?(dst) && src.include?(sp)
105
114
 
106
- dst_lm = OneGadget::Emulators::Lambda.parse(dst, predefined: registers)
107
- src_lm = OneGadget::Emulators::Lambda.parse(src, predefined: registers)
115
+ dst_lm = arg_to_lambda(dst)
116
+ src_lm = arg_to_lambda(src)
108
117
  return yield if src_lm.deref_count != 1
109
118
 
110
119
  src_lm.ref!
111
120
  [dst_lm, src_lm]
112
121
  end
113
122
 
123
+ def xmm_reg?(reg)
124
+ reg.start_with?('xmm') && register?(reg)
125
+ end
126
+
127
+ # dst[64:128] = src[0:64]
128
+ def inst_punpcklqdq(dst, src)
129
+ raise_unsupported('punpcklqdq', dst, src) unless xmm_reg?(dst) && xmm_reg?(src)
130
+
131
+ dst = arg_to_lambda(dst)
132
+ src = arg_to_lambda(src)
133
+ (64 / self.class.bits).times do |i|
134
+ dst[i + 64 / self.class.bits] = src[i]
135
+ end
136
+ end
137
+
114
138
  def inst_lea(dst, src)
115
139
  check_register!(dst)
116
140
 
117
- src = OneGadget::Emulators::Lambda.parse(src, predefined: registers)
118
- src.ref!
119
- registers[dst] = src
141
+ registers[dst] = arg_to_lambda(src).ref!
120
142
  end
121
143
 
122
144
  def inst_push(val)
123
- val = OneGadget::Emulators::Lambda.parse(val, predefined: registers)
145
+ val = arg_to_lambda(val)
124
146
  registers[sp] -= size_t
125
147
  cur_top = registers[sp].evaluate(eval_dict)
126
148
  raise Error::InstructionArgumentError, "Corrupted stack pointer: #{cur_top}" unless cur_top.is_a?(Integer)
@@ -141,12 +163,12 @@ module OneGadget
141
163
  def inst_add(dst, src)
142
164
  check_register!(dst)
143
165
 
144
- src = OneGadget::Emulators::Lambda.parse(src, predefined: registers)
166
+ src = arg_to_lambda(src)
145
167
  registers[dst] += src
146
168
  end
147
169
 
148
170
  def inst_sub(dst, src)
149
- src = OneGadget::Emulators::Lambda.parse(src, predefined: registers)
171
+ src = arg_to_lambda(src)
150
172
  raise Error::UnsupportedInstructionArgumentError, "Unhandled -= of type #{src.class}" unless src.is_a?(Integer)
151
173
 
152
174
  registers[dst] -= src
@@ -160,7 +182,7 @@ module OneGadget
160
182
  # because it just invokes syscall.
161
183
  def inst_call(addr)
162
184
  # This is the last call
163
- return registers[pc] = addr if %w[execve execl].any? { |n| addr.include?(n) }
185
+ return registers[pc] = addr if %w[execve execl posix_spawn].any? { |n| addr.include?(n) }
164
186
 
165
187
  # TODO: handle some registers would be fucked after call
166
188
  checker = {
@@ -177,7 +199,7 @@ module OneGadget
177
199
  end
178
200
 
179
201
  def add_writable(dst)
180
- lmda = OneGadget::Emulators::Lambda.parse(dst, predefined: registers).ref!
202
+ lmda = arg_to_lambda(dst).ref!
181
203
  # pc-relative addresses should be writable
182
204
  return if lmda.obj == pc
183
205
 
@@ -188,7 +210,8 @@ module OneGadget
188
210
  return super unless reg =~ /^xmm\d+$/
189
211
 
190
212
  Array.new(128 / self.class.bits) do |i|
191
- OneGadget::Emulators::Lambda.new("#{reg}__#{i}")
213
+ cast = "(u#{self.class.bits})"
214
+ OneGadget::Emulators::Lambda.new(i.zero? ? "#{cast}#{reg}" : "#{cast}(#{reg} >> #{self.class.bits * i})")
192
215
  end
193
216
  end
194
217
  end