1 2 Ambtion.com 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 Ambtion.com 279 280 281 Advertise Free on Auto-pilot!
Watch the latest videos on YouTube.com
newgoldenjewels: Linux Stack Protection By Default

Thursday, January 25, 2024

Linux Stack Protection By Default

Modern gcc compiler (v9.2.0) protects the stack by default and you will notice it because instead of SIGSEGV on stack overflow you will get a SIGABRT, but it also generates coredumps.




In this case the compiler adds the variable local_10. This variable helds a canary value that is checked at the end of the function.
The memset overflows the four bytes stack variable and modifies the canary value.



The 64bits canary 0x5429851ebaf95800 can't be predicted, but in specific situations is not re-generated and can be bruteforced or in other situations can be leaked from memory for example using a format string vulnerability or an arbitrary read wihout overflowing the stack.

If the canary doesn't match, the libc function __stack_chck_fail is called and terminates the prorgam with a SIGABORT which generates a coredump, in the case of archlinux managed by systemd and are stored on "/var/lib/systemd/coredump/"


❯❯❯ ./test 
*** stack smashing detected ***: terminated
fish: './test' terminated by signal SIGABRT (Abort)

❯❯❯ sudo lz4 -d core.test.1000.c611b7caa58a4fa3bcf403e6eac95bb0.1121.1574354610000000.lz4
[sudo] password for xxxx: 
Decoding file core.test.1000.c611b7caa58a4fa3bcf403e6eac95bb0.1121.1574354610000000 
core.test.1000.c611b : decoded 249856 bytes 

 ❯❯❯ sudo gdb /home/xxxx/test core.test.1000.c611b7caa58a4fa3bcf403e6eac95bb0.1121.1574354610000000 -q 


We specify the binary and the core file as a gdb parameters. We can see only one LWP (light weight process) or linux thread, so in this case is quicker to check. First of all lets see the back trace, because in this case the execution don't terminate in the segfaulted return.




We can see on frame 5 the address were it would had returned to main if it wouldn't aborted.



Happy Idea: we can use this stack canary aborts to detect stack overflows. In Debian with prevous versions it will be exploitable depending on the compilation flags used.
And note that the canary is located as the last variable in the stack so the previous variables can be overwritten without problems.




More info


  1. What Is Hacking Tools
  2. Black Hat Hacker Tools
  3. Pentest Tools For Mac
  4. Pentest Tools For Windows
  5. Pentest Tools Kali Linux
  6. What Is Hacking Tools
  7. Pentest Tools Free
  8. Computer Hacker
  9. Tools Used For Hacking
  10. Bluetooth Hacking Tools Kali
  11. Pentest Tools Apk
  12. Hacking Tools Github
  13. How To Make Hacking Tools
  14. Hack Tool Apk
  15. Pentest Reporting Tools
  16. Pentest Automation Tools
  17. Hacking App
  18. Hack App
  19. Hacking Tools Pc
  20. New Hack Tools
  21. Hacking Tools Name
  22. Pentest Tools Framework
  23. Hack Tools For Pc
  24. Hack Tools For Ubuntu
  25. Hackrf Tools
  26. Hack Tools 2019
  27. Pentest Tools Subdomain
  28. Hack Rom Tools
  29. Hacker Tools 2019
  30. Top Pentest Tools
  31. Hack Tools
  32. Hacking Tools Windows
  33. Hacker Tools For Ios
  34. Hacking Tools For Windows
  35. How To Hack
  36. Hacker Tools Windows
  37. Hacking Tools Github
  38. Hack App
  39. Tools Used For Hacking
  40. Pentest Tools Free
  41. Pentest Tools Website Vulnerability
  42. Pentest Tools For Android
  43. Hack App
  44. Pentest Tools Framework
  45. Hacker Techniques Tools And Incident Handling
  46. Github Hacking Tools
  47. Hacker Tools 2020
  48. Hacker Tools For Pc
  49. Nsa Hack Tools
  50. Pentest Tools Open Source
  51. Hacker Tools Mac
  52. Ethical Hacker Tools
  53. Pentest Tools Github
  54. Hacking Tools For Beginners
  55. Pentest Reporting Tools
  56. Pentest Tools Linux
  57. Hacker Hardware Tools
  58. Hacking Tools Software
  59. Hacking Tools For Beginners
  60. Best Pentesting Tools 2018
  61. Hacker Tools Hardware
  62. Hacker Tools For Pc
  63. How To Hack
  64. Install Pentest Tools Ubuntu
  65. Blackhat Hacker Tools
  66. Computer Hacker
  67. Kik Hack Tools
  68. Hack Tools 2019
  69. Github Hacking Tools
  70. Hacker Tools Windows
  71. World No 1 Hacker Software
  72. Pentest Tools Port Scanner
  73. Github Hacking Tools
  74. Pentest Tools Apk
  75. Game Hacking
  76. Hack Tools Download
  77. Pentest Tools Find Subdomains
  78. Hacking Tools For Beginners
  79. Hacking Tools
  80. Hacker Tools Free
  81. Pentest Tools For Ubuntu
  82. How To Install Pentest Tools In Ubuntu
  83. Hacking Tools For Windows
  84. Hacker Tools For Windows
  85. Install Pentest Tools Ubuntu
  86. Pentest Tools Website Vulnerability
  87. Hacking Tools 2020
  88. Hack Tools
  89. Pentest Tools Port Scanner
  90. Hack Tools
  91. Hacker Tools List
  92. Pentest Tools For Android
  93. Hackrf Tools
  94. Hack Tools For Mac
  95. Pentest Tools Download
  96. Pentest Tools List
  97. Hack Tools
  98. Github Hacking Tools
  99. Hacking Tools For Games
  100. Hacker Tools 2019
  101. Hack Tools
  102. Github Hacking Tools
  103. Hacking App
  104. Hacking Tools 2019
  105. Kik Hack Tools
  106. Hack And Tools
  107. Hacking Tools Hardware
  108. What Are Hacking Tools
  109. Hacker Techniques Tools And Incident Handling
  110. Hacking Tools Mac
  111. Hacking App
  112. Bluetooth Hacking Tools Kali
  113. What Are Hacking Tools
  114. Hacking Tools Hardware
  115. Hack Tools For Games
  116. Hack Tools Github
  117. Hack App
  118. Beginner Hacker Tools
  119. Hacking Tools Online
  120. Hack App
  121. What Is Hacking Tools
  122. Hack Tools For Pc
  123. Pentest Reporting Tools
  124. Pentest Tools Framework
  125. Pentest Tools Android
  126. Hacking Tools Software
  127. Pentest Tools Nmap
  128. Tools For Hacker
  129. Pentest Tools Download
  130. Hacker Tools For Windows
  131. Hack Tools Mac
  132. Hacker Tools Windows

No comments: