问题标签 [exploit]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
2081 浏览

assembly - 需要利用缓冲区溢出。在执行漏洞利用代码后无法弄清楚如何破坏堆栈?

基本上我正在利用的功能是这样的:

当我运行主程序时,该函数执行 5 次,每次 buf 的位置发生变化,%ebp 的位置也发生变化。我应该做的是将一个特定的十六进制值,比如说 0xFFFFFFFF,放入一个变量中,并且主程序每次都会检查该变量是否存在。如果是,它会再次执行,直到所有 5 次都完成并且程序安静地退出。

我遇到的问题是,在检查十六进制值之前,检查另一个恒定值,比如说 0x12345678。如果我损坏了 0x12345678 并且它不存在,程序就会在我身上爆炸。

我发现 0x12345678 存储在 -0x10(%ebp) 中,所以我知道它是基于 %ebp 的,而且我每次都知道 %ebp 的地址,但我只能让漏洞利用第一次工作。我通过基本上 nopsled-ing 496 字节和字节格式的机器代码来做到这一点:

最终是 5 个字和一个用于返回 long 的字节,我用 0x313131 填充以使其长 6 个字。在这一点上,我的漏洞利用字符串是 520 字节长,这正是缓冲区低于 %ebp 的长度,所以我添加了旧 ebp 的地址和我的 nopsled 内某处的地址,覆盖了 %ebp 的当前值以及返回getbufn 的地址。

问题是当程序第二次执行时,%ebp 位于比其先前地址低 0x10 的地址中,因此我的不破坏 %ebp 的方法不起作用,并且 main 检测到 0x12345678 不在 -0x10(%ebp) 处。如何清除 %ebp?

0 投票
2 回答
4601 浏览

c - 编写return-to-libc攻击,但libc在内存中加载到0x00

我正在为我的系统安全类编写返回 libc 攻击。一、易受攻击的代码:

我想用一个返回libc的攻击。编译和调试程序:

为了执行攻击,我想将缓冲区溢出到loadconfig的返回地址(又名$esp+4),用返回地址替换它system,然后是返回地址exit(因为system需要一个真实的返回地址),然后是命令名称(的地址SHELL=/bin/bash加 6,修剪SHELL=零件)。这应该可以通过制作一个$HOME包含 1024 个废话字符的环境变量,然后是 、 和 的 little-endian 地址systemexit实现/bin/bash

但是,对于我尝试过的每台计算机,system都会在以 0x00 开头的地址加载,这将终止sprintf正在读取的字符串并停止攻击。有什么方法可以强制libc加载内存中的其他地方,还是我误解了攻击?

作为参考,我在 VirtualBox(Windows 主机)中运行 Ubuntu Server 11.10 虚拟机,gcc版本为 4.6.1 和gdb版本 7.3-2011.08。编辑:ASLR 被禁用,我用它编译-fno-stack-protector以删除金丝雀。因为我没有从堆栈中执行任何东西,所以我不需要execstack它。

0 投票
3 回答
2696 浏览

c - access() 安全漏洞

我一直在做一些 shell 编写,并遇到了access()检查文件是否存在、是否可以读取等的建议。似乎超级容易实现并且比stat(). 当我开始查看它的手册页时,我注意到不建议使用它,因为它可能导致安全漏洞。手册页是这样说的:

使用 access() 来检查用户是否被授权例如在使用 open(2) 实际打开文件之前打开文件会产生安全漏洞,因为用户可能会利用检查和打开文件之间的短时间间隔来操作它。

有谁知道如何利用它,或者它是否仅适用于open()检查文件后使用?我知道很多人说要stat()改用,但access()它很容易实现,尤其是对于我使用它的 shell。

0 投票
2 回答
8006 浏览

security - 具有多负载的 Metasploit 通用/自定义负载

我一直在玩新的 MSF4(框架:4.1.0-release.13988,控制台:4.1.0-release.13581)使用 msfvenom 和自定义/通用有效负载的多有效负载支持,但似乎有有关有效负载在编码和兼容性方面支持的信息。

基本上,我正在研究如何关闭服务器端服务,然后让meterpreter 监听它不再绑定的端口。(漏洞利用会进入另一个端口)

本质上,我使用 msfvenom 创建了一个 multipayload,msgbox 和 Meterpreter 背靠背,作为 exe、raw 和 .rb。我试过单独留下编码设置,并将其设置为无。(请注意,自定义/通用有效负载 .rb 源说明只允许无编码)

我还尝试将 EXITFUNC 设置为“无”:

然后我需要将原始多有效负载写入通用/自定义有效负载可以使用的东西:(注意我尝试写入原始、exe、.rb 格式)

最后是时候尝试使用通用/自定义的多有效负载了:(请注意,在尝试设置和利用之前,我每次都重新加载了漏洞利用)

所以我找到了一个解释“没有编码器编码......”错误应该是什么意思。(http://en.wikibooks.org/wiki/Metasploit/Frequently_Asked_Questions) 我想这就是 stager 有效载荷的来源。

错误的原因是 windows/msgbox 有效负载,因为它没有上演?或者是多重有效载荷没有上演?如果是后者,那么我看不到多重有效载荷将如何工作,除非它们被分阶段。组合 2 个有效载荷可能比单个有效载荷大。

有人可以至少解释一下应该与通用/有效负载兼容的编码和格式,以便我可以排除吗?我只找到了几个对多负载支持的参考。

提前致谢!我保证一旦我这样做了,我会回答我是如何做到这一点的。

0 投票
1 回答
3804 浏览

php - .gif 漏洞利用中的 PHP 代码

我需要知道如何生成一个带有 php 代码的 GIF,或者如何修改一个 gif 来添加它,以便我可以在 wordpress 中对我们的头像上传插件进行测试——我只是想确保它是安全的。或者如果有人已经有测试图像,我可以打开它来查看代码或修改?

0 投票
1 回答
491 浏览

javascript - How to deal with evil? Validating user input before System.Shell.execute();

I'm using a API from Windows gadgets to launch URLs, but I know the destructive power about things like eval() and worst and more dangerous, the System.Shell.execute();

But after some research, I think theres no better way to launch URL on the default browser without execute(). Since URLs come from user input, how to prevent users to execute evil-code? My code is SAFE or it can be exploitable? prevent things like this cmd.exe /c REG QUERY HKCU etc launching cmd.exe with administrator privileges.

edit:

allowing this 2 protocols is unsafe file:/// and javascript: exemples that can be done:

file:///c:/windows/system32/ping.exe

javascript:void( window.open('http://file:///c:/windows/system32/ping.exe','','_blank') );

0 投票
2 回答
16511 浏览

c - 这段 C 代码有什么漏洞?

按照我的理解,上面的代码允许执行任意代码(或程序)——是什么让这个漏洞变得脆弱,人们如何利用这一点?

0 投票
1 回答
487 浏览

java - Java - 如何利用动态 jar 加载?

我正在开发一个分析 JAR 文件的闭源 Java 应用程序。由于 java 可以很容易地反编译,而且混淆确实不是什么大问题,我想提供一个在线服务,它将在我的服务器上执行应用程序并返回它的结果,就像这里的 fernflower:www.reversed-java.com/fernflower /。

问题是,我担心这会导致我的应用程序在服务器上加载任何可能有害的 jars,即使我从未运行过这些 jars。我所做的就是使用URLClassLoaderJarInputStream加载它们。

我可以在我的原始应用程序中加载一个 jar 覆盖类以执行恶意代码或弄乱我的程序吗?

动态加载jar有什么风险?

0 投票
0 回答
103 浏览

security - 安全性:为什么我们仍然听说许多堆栈执行安全漏洞?

安全性: NX bit DEPASLR等机制存在这么多年,为什么我们仍然听到许多堆栈执行安全漏洞?黑客有没有找到规避这些的方法?

在查看 MS 和 Adob​​e 中相对较新的已修复安全漏洞时,您仍然可以找到使攻击者能够控制您的系统的漏洞 - 这是否意味着通过缓冲区溢出在堆栈上运行代码(这不能使用 DEP/NX/ ASLR)?

0 投票
1 回答
5125 浏览

security - buffer overflow example from Art of Exploitation book

I was reading this book Art of Exploitation, which is kinda good book and I run across that example from exploit_notesearch.c file.

Briefly author tries to overflow program from notesearch.c

The argument of the main function is copied to the searchstring array and if the argument is bigger than 100 bytes it will overflow the return address from the main function.

The author prepares the shellcode in exploit_notesearch.c and calls vulnerable notesearch.c

You can see that shellcode is combined with NOP sled and return address which should point to that NOP sled. The author uses address of a local variable i as a point of reference and substracts 270 bytes thus trying figure out approximate location of NOP sled.

As I understand author assumes that stackframe of the main function from vulnerable notesearch.c will be in the same stack segment as stackframe of main function from exploit_notesearch.c. I assume this because only this way this manipulation with address of the local variable i can work.

But, the author calls vulnerable notesearch.c with the help of the system() like this system(command). My point is that this function system() somewhere inside uses fork() to spawn child process and after that uses exec() function to change image of the process. But if the image is changed it means that stack segment will be fresh and all those manipulations with address of local variable i in main function in exploit_notesearch.c will be useless, but somehow this exploit works which is completely confusing for me.