-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPWN题加载指定libc版本.html
More file actions
357 lines (248 loc) · 16 KB
/
PWN题加载指定libc版本.html
File metadata and controls
357 lines (248 loc) · 16 KB
1
2
3
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
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<meta name="theme-color" content="#222"><meta name="generator" content="Hexo 6.0.0">
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png">
<link rel="mask-icon" href="/images/logo.svg" color="#222">
<meta name="google-site-verification" content="c82yhVgzVDLijmq0y0DVHItZUbvVYZ-cs_ox4V6nYOQ">
<link rel="stylesheet" href="/css/main.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.0.0/css/all.min.css" integrity="sha256-jTIdiMuX/e3DGJUGwl3pKSxuc6YOuqtJYkM0bGQESA4=" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/animate.css@3.1.1/animate.min.css" integrity="sha256-PR7ttpcvz8qrF57fur/yAx1qXMFJeJFiA6pSzWi0OIE=" crossorigin="anonymous">
<script class="next-config" data-name="main" type="application/json">{"hostname":"www.whiter.fun","root":"/","images":"/images","scheme":"Muse","darkmode":false,"version":"8.10.1","exturl":false,"sidebar":{"position":"right","display":"post","padding":18,"offset":12},"copycode":false,"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":true,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果:${query}","hits_time":"找到 ${hits} 个搜索结果(用时 ${time} 毫秒)","hits":"找到 ${hits} 个搜索结果"}}</script><script src="/js/config.js"></script>
<meta property="og:type" content="article">
<meta property="og:title" content="PWN加载指定libc版本">
<meta property="og:url" content="http://www.whiter.fun/PWN%E9%A2%98%E5%8A%A0%E8%BD%BD%E6%8C%87%E5%AE%9Alibc%E7%89%88%E6%9C%AC.html">
<meta property="og:site_name" content="whiter's blog">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2022-03-11T02:43:32.000Z">
<meta property="article:modified_time" content="2022-03-11T03:21:42.496Z">
<meta property="article:author" content="whiter">
<meta property="article:tag" content="工具使用">
<meta name="twitter:card" content="summary">
<link rel="canonical" href="http://www.whiter.fun/PWN%E9%A2%98%E5%8A%A0%E8%BD%BD%E6%8C%87%E5%AE%9Alibc%E7%89%88%E6%9C%AC.html">
<script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"http://www.whiter.fun/PWN%E9%A2%98%E5%8A%A0%E8%BD%BD%E6%8C%87%E5%AE%9Alibc%E7%89%88%E6%9C%AC.html","path":"PWN题加载指定libc版本.html","title":"PWN加载指定libc版本"}</script>
<script class="next-config" data-name="calendar" type="application/json">""</script>
<title>PWN加载指定libc版本 | whiter's blog</title>
<noscript>
<link rel="stylesheet" href="/css/noscript.css">
</noscript>
</head>
<body itemscope itemtype="http://schema.org/WebPage" class="use-motion">
<div class="headband"></div>
<main class="main">
<header class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-container">
<div class="site-nav-toggle">
<div class="toggle" aria-label="切换导航栏" role="button">
<span class="toggle-line"></span>
<span class="toggle-line"></span>
<span class="toggle-line"></span>
</div>
</div>
<div class="site-meta">
<a href="/" class="brand" rel="start">
<i class="logo-line"></i>
<p class="site-title">whiter's blog</p>
<i class="logo-line"></i>
</a>
<p class="site-subtitle" itemprop="description">我们是天生一对,永远别相信其他的事</p>
</div>
<div class="site-nav-right">
<div class="toggle popup-trigger">
</div>
</div>
</div>
<nav class="site-nav">
<ul class="main-menu menu">
<li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li>
<li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签</a></li>
<li class="menu-item menu-item-sitemap"><a href="/sitemap.xml" rel="section"><i class="fa fa-sitemap fa-fw"></i>站点地图</a></li>
</ul>
</nav>
</div>
<div class="toggle sidebar-toggle" role="button">
<span class="toggle-line"></span>
<span class="toggle-line"></span>
<span class="toggle-line"></span>
</div>
<aside class="sidebar">
<div class="sidebar-inner sidebar-nav-active sidebar-toc-active">
<ul class="sidebar-nav">
<li class="sidebar-nav-toc">
文章目录
</li>
<li class="sidebar-nav-overview">
站点概览
</li>
</ul>
<div class="sidebar-panel-container">
<!--noindex-->
<div class="post-toc-wrap sidebar-panel">
<div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-3"><a class="nav-link" href="#%E6%89%80%E6%9C%89glibc%E5%8F%AF%E4%BB%A5%E5%9C%A8github%E4%BB%93%E5%BA%93%E8%8E%B7%E5%BE%97"><span class="nav-number">1.</span> <span class="nav-text">所有glibc可以在github仓库获得</span></a></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E6%96%B9%E6%B3%95%E4%B8%80%EF%BC%9Apwntools"><span class="nav-number"></span> <span class="nav-text">方法一:pwntools</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#%E6%96%B9%E6%B3%95%E4%BA%8C%EF%BC%9Apatchelf"><span class="nav-number"></span> <span class="nav-text">方法二:patchelf</span></a></div>
</div>
<!--/noindex-->
<div class="site-overview-wrap sidebar-panel">
<div class="site-author site-overview-item animated" itemprop="author" itemscope itemtype="http://schema.org/Person">
<p class="site-author-name" itemprop="name">whiter</p>
<div class="site-description" itemprop="description">A member of Arr3stY0u</div>
</div>
<div class="site-state-wrap site-overview-item animated">
<nav class="site-state">
<div class="site-state-item site-state-posts">
<a href="/archives/">
<span class="site-state-item-count">9</span>
<span class="site-state-item-name">日志</span>
</a>
</div>
<div class="site-state-item site-state-tags">
<a href="/tags/">
<span class="site-state-item-count">5</span>
<span class="site-state-item-name">标签</span></a>
</div>
</nav>
</div>
<div class="links-of-author site-overview-item animated">
<span class="links-of-author-item">
<a href="/whiter0709@163.com" title="E-Mail → whiter0709@163.com"><i class="fa fa-envelope fa-fw"></i>E-Mail</a>
</span>
</div>
<div class="links-of-blogroll site-overview-item animated">
<div class="links-of-blogroll-title"><i class="fa fa-globe fa-fw"></i>
Links
</div>
<ul class="links-of-blogroll-list">
<li class="links-of-blogroll-item">
<a href="https://www.shg-sec.com/" title="https://www.shg-sec.com/" rel="noopener" target="_blank">山海关安全团队</a>
</li>
<li class="links-of-blogroll-item">
<a href="https://www.roderickchan.cn/" title="https://www.roderickchan.cn/" rel="noopener" target="_blank">Roder师傅</a>
</li>
<li class="links-of-blogroll-item">
<a href="https://www.cnblogs.com/7resp4ss/" title="https://www.cnblogs.com/7resp4ss/" rel="noopener" target="_blank">7resp4ss师傅</a>
</li>
</ul>
</div>
</div>
</div>
</div>
</aside>
<div class="sidebar-dimmer"></div>
</header>
<div class="back-to-top" role="button" aria-label="返回顶部">
<i class="fa fa-arrow-up"></i>
<span>0%</span>
</div>
<noscript>
<div class="noscript-warning">Theme NexT works best with JavaScript enabled</div>
</noscript>
<div class="main-inner post posts-expand">
<div class="post-block">
<article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN">
<link itemprop="mainEntityOfPage" href="http://www.whiter.fun/PWN%E9%A2%98%E5%8A%A0%E8%BD%BD%E6%8C%87%E5%AE%9Alibc%E7%89%88%E6%9C%AC.html">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="image" content="/images/avatar.gif">
<meta itemprop="name" content="whiter">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="whiter's blog">
<meta itemprop="description" content="A member of Arr3stY0u">
</span>
<span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork">
<meta itemprop="name" content="PWN加载指定libc版本 | whiter's blog">
<meta itemprop="description" content="">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">
PWN加载指定libc版本
</h1>
<div class="post-meta-container">
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="far fa-calendar"></i>
</span>
<span class="post-meta-item-text">发表于</span>
<time title="创建时间:2022-03-11 10:43:32 / 修改时间:11:21:42" itemprop="dateCreated datePublished" datetime="2022-03-11T10:43:32+08:00">2022-03-11</time>
</span>
<span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv">
<span class="post-meta-item-icon">
<i class="far fa-eye"></i>
</span>
<span class="post-meta-item-text">阅读次数:</span>
<span id="busuanzi_value_page_pv"></span>
</span>
</div>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<!---more--->
<span id="more"></span>
<h3 id="所有glibc可以在github仓库获得"><a href="#所有glibc可以在github仓库获得" class="headerlink" title="所有glibc可以在github仓库获得"></a>所有glibc可以在github仓库获得</h3><figure class="highlight awk"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">git clone https:<span class="regexp">//gi</span>thub.com<span class="regexp">/matrix1001/g</span>libc-all-<span class="keyword">in</span>-one.git</span><br></pre></td></tr></table></figure>
<h1 id="方法一:pwntools"><a href="#方法一:pwntools" class="headerlink" title="方法一:pwntools"></a>方法一:pwntools</h1><figure class="highlight stylus"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="selector-tag">p</span> = <span class="built_in">process</span>(<span class="selector-attr">[ld,filename]</span>,env={<span class="string">'LD_PRELOAD'</span>:env})</span><br></pre></td></tr></table></figure>
<p>ld为动态ld文件目录,filename为elf文件目录,env为libc文件目录。<br>例子:</p>
<figure class="highlight apache"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">p</span> = process([‘./ld-<span class="number">2</span>.<span class="number">27</span>.so’,filename],env={‘LD_PRELOAD’:’./libc-<span class="number">2</span>.<span class="number">27</span>.so’})</span><br></pre></td></tr></table></figure>
<h1 id="方法二:patchelf"><a href="#方法二:patchelf" class="headerlink" title="方法二:patchelf"></a>方法二:patchelf</h1><p>第一种,改变链接器+改变搜索路径</p>
<figure class="highlight apache"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">patchelf</span> --set-interpreter ./glibc-<span class="literal">all</span>-in-one-master/libs/<span class="number">2</span>.<span class="number">31</span>-<span class="number">0</span>ubuntu9.<span class="number">2</span>_amd64/ld-<span class="number">2</span>.<span class="number">31</span>.so --set-rpath ./glibc-<span class="literal">all</span>-in-one-master/libs/<span class="number">2</span>.<span class="number">31</span>-<span class="number">0</span>ubuntu9.<span class="number">2</span>_amd64 target_file</span><br></pre></td></tr></table></figure>
<p>第二种,改变链接器+直接改变动态库的路径</p>
<figure class="highlight apache"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attribute">patchelf</span> --set-interpreter ./glibc-<span class="literal">all</span>-in-one-master/libs/<span class="number">2</span>.<span class="number">31</span>-<span class="number">0</span>ubuntu9.<span class="number">2</span>_amd64/ld-<span class="number">2</span>.<span class="number">31</span>.so --replace-needed libc.so.<span class="number">6</span> ./glibc-<span class="literal">all</span>-in-one-master/libs/<span class="number">2</span>.<span class="number">31</span>-<span class="number">0</span>ubuntu9.<span class="number">2</span>_amd64/libc.so.<span class="number">6</span> target_file</span><br></pre></td></tr></table></figure>
</div>
<footer class="post-footer">
<div class="post-tags">
<a href="/tags/%E5%B7%A5%E5%85%B7%E4%BD%BF%E7%94%A8/" rel="tag"># 工具使用</a>
</div>
<div class="post-nav">
<div class="post-nav-item">
</div>
<div class="post-nav-item">
<a href="/js%E9%80%86%E5%90%91%E7%AC%94%E8%AE%B0.html" rel="next" title="js逆向笔记">
js逆向笔记 <i class="fa fa-chevron-right"></i>
</a>
</div>
</div>
</footer>
</article>
</div>
</div>
</main>
<footer class="footer">
<div class="footer-inner">
<div class="copyright">
©
<span itemprop="copyrightYear">2023</span>
<span class="with-love">
<i class="fa fa-heart"></i>
</span>
<span class="author" itemprop="copyrightHolder">whiter</span>
</div>
<div class="busuanzi-count">
<span class="post-meta-item" id="busuanzi_container_site_uv">
<span class="post-meta-item-icon">
<i class="fa fa-user"></i>
</span>
<span class="site-uv" title="总访客量">
<span id="busuanzi_value_site_uv"></span>
</span>
</span>
<span class="post-meta-item" id="busuanzi_container_site_pv">
<span class="post-meta-item-icon">
<i class="fa fa-eye"></i>
</span>
<span class="site-pv" title="总访问量">
<span id="busuanzi_value_site_pv"></span>
</span>
</span>
</div>
<div class="powered-by">由 <a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/muse/" rel="noopener" target="_blank">NexT.Muse</a> 强力驱动
</div>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/animejs@3.2.1/lib/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/lozad@1.16.0/dist/lozad.min.js" integrity="sha256-mOFREFhqmHeQbXpK2lp4nA3qooVgACfh88fpJftLBbc=" crossorigin="anonymous"></script>
<script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/motion.js"></script><script src="/js/schemes/muse.js"></script><script src="/js/next-boot.js"></script>
<script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
</body>
</html>