我最近遇到了这个问题:Debug a java application without starting the JVM with debug arguments
在 https://docs.oracle.com/javase/7/docs/technotes/guides/jpda/conninv.html 阅读有关 JVM 提供的各种连接器和传输的更多信息,我现在正试图找到以下问题的答案:
文档说对于 SADebugServerAttachingConnector 和 SAPIDAttachingConnector :
The process to be debugged need not have been started in debug mode(ie, with -agentlib:jdwp or -Xrunjdwp)
所以:
1) 为什么像 Xrunjdwp 这样的调试选项首先存在?
2) SADebugServerAttachingConnector 如何在参数中不带端口号的情况下工作?
3) 文档没有说明需要 root 权限。允许非特权用户任意调试未在 Debug模式下启动的 jvm 实例,这不是一个严重的权限提升漏洞吗?
最佳答案
我将重点关注 SADebugServerAttachingConnector 案例。
以下是来自 Java 11 version 的更多引述您链接到的文档的:
SA Debug Server Attaching Connector
This connector can be used by a debugger application to debug a process or core file on a machine other than the machine upon which the debugger is running.
This connector uses RMI to communicate with a 'debug server' running on the remote machine. Before the attach() method on this connector is called, the debug server must be started on the remote machine and told what process or corefile is to be debugged.
A process to be debugged need not have been started in debug mode(ie, with -agentlib:jdwp or -Xrunjdwp).
1) Why do debug options like Xrunjdwp exist in the first place then?
SA 调试服务器方法允许您在不想使用代理启动(例如出于安全原因)或没有先见之明的情况下调试 Java 进程。
相反,代理方法适用于您不想设置 SA 调试服务器来调试您的 Java 应用程序的麻烦。
正如他们所说,这是“类(class)用马”。
2) How does SADebugServerAttachingConnector work without taking a port number in the arguments?
您的调试器正在使用 RMI 默认端口与 SA 调试服务器通信。 SA 调试服务器使用服务器和目标已知的机制附加到目标 JVM。它很可能是一种特定于操作系统的机制。例如,在 Linux 上它可以使用 ptrace(2) API。不需要涉及网络套接字和端口。
3) Documentation does not say anything about requiring root privileges. Is it not a serious privilege escalation vulnerability to allow arbitrary debugging of jvm instances not started in debug mode, by unprivileged users?
文档指出您需要专门设置 SA 调试服务器和目标 VM 之间的链接。这是在您启动 SA 调试服务器时完成的。
操作系统级访问控制不允许非根 SA 调试服务器使用(例如)ptrace 系统调用访问属于另一个用户/用户 ID 的 Java 进程。操作系统不会让您启动根 SA 调试服务器,除非您已经拥有根权限。因此,无论是在 root 还是非 root 情况下,都不会提升权限。
(模数任何未公开或未修补的操作系统级根升级错误......当然。)
关于java - JVM 调试连接器内部结构和安全性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55695202/
我想将html转换为纯文本。不过,我不想只删除标签,我想智能地保留尽可能多的格式。为插入换行符标签,检测段落并格式化它们等。输入非常简单,通常是格式良好的html(不是整个文档,只是一堆内容,通常没有anchor或图像)。我可以将几个正则表达式放在一起,让我达到80%,但我认为可能有一些现有的解决方案更智能。 最佳答案 首先,不要尝试为此使用正则表达式。很有可能你会想出一个脆弱/脆弱的解决方案,它会随着HTML的变化而崩溃,或者很难管理和维护。您可以使用Nokogiri快速解析HTML并提取文本:require'nokogiri'h
我正在编写一个小脚本来定位aws存储桶中的特定文件,并创建一个临时验证的url以发送给同事。(理想情况下,这将创建类似于在控制台上右键单击存储桶中的文件并复制链接地址的结果)。我研究过回形针,它似乎不符合这个标准,但我可能只是不知道它的全部功能。我尝试了以下方法:defauthenticated_url(file_name,bucket)AWS::S3::S3Object.url_for(file_name,bucket,:secure=>true,:expires=>20*60)end产生这种类型的结果:...-1.amazonaws.com/file_path/file.zip.A
我真的很习惯使用Ruby编写以下代码:my_hash={}my_hash['test']=1Java中对应的数据结构是什么? 最佳答案 HashMapmap=newHashMap();map.put("test",1);我假设? 关于java-等价于Java中的RubyHash,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/22737685/
GivenIamadumbprogrammerandIamusingrspecandIamusingsporkandIwanttodebug...mmm...let'ssaaay,aspecforPhone.那么,我应该把“require'ruby-debug'”行放在哪里,以便在phone_spec.rb的特定点停止处理?(我所要求的只是一个大而粗的箭头,即使是一个有挑战性的程序员也能看到:-3)我已经尝试了很多位置,除非我没有正确测试它们,否则会发生一些奇怪的事情:在spec_helper.rb中的以下位置:require'rubygems'require'spork'
我正在尝试使用boilerpipe来自JRuby。我看过guide从JRuby调用Java,并成功地将它与另一个Java包一起使用,但无法弄清楚为什么同样的东西不能用于boilerpipe。我正在尝试基本上从JRuby中执行与此Java等效的操作:URLurl=newURL("http://www.example.com/some-location/index.html");Stringtext=ArticleExtractor.INSTANCE.getText(url);在JRuby中试过这个:require'java'url=java.net.URL.new("http://www
给定一个复杂的对象层次结构,幸运的是它不包含循环引用,我如何实现支持各种格式的序列化?我不是来讨论实际实现的。相反,我正在寻找可能会派上用场的设计模式提示。更准确地说:我正在使用Ruby,我想解析XML和JSON数据以构建复杂的对象层次结构。此外,应该可以将该层次结构序列化为JSON、XML和可能的HTML。我可以为此使用Builder模式吗?在任何提到的情况下,我都有某种结构化数据-无论是在内存中还是文本中-我想用它来构建其他东西。我认为将序列化逻辑与实际业务逻辑分开会很好,这样我以后就可以轻松支持多种XML格式。 最佳答案 我最
使用Ruby1.9.2运行IDE提示说需要gemruby-debug-base19x并提供安装它。但是,在尝试安装它时会显示消息Failedtoinstallgems.Followinggemswerenotinstalled:C:/ProgramFiles(x86)/JetBrains/RubyMine3.2.4/rb/gems/ruby-debug-base19x-0.11.30.pre2.gem:Errorinstallingruby-debug-base19x-0.11.30.pre2.gem:The'linecache19'nativegemrequiresinstall
在Ruby中是否有Gem或安全删除文件的方法?我想避免系统上可能不存在的外部程序。“安全删除”指的是覆盖文件内容。 最佳答案 如果您使用的是*nix,一个很好的方法是使用exec/open3/open4调用shred:`shred-fxuz#{filename}`http://www.gnu.org/s/coreutils/manual/html_node/shred-invocation.html检查这个类似的帖子:Writingafileshredderinpythonorruby?
我只想对我一直在思考的这个问题有其他意见,例如我有classuser_controller和classuserclassUserattr_accessor:name,:usernameendclassUserController//dosomethingaboutanythingaboutusersend问题是我的User类中是否应该有逻辑user=User.newuser.do_something(user1)oritshouldbeuser_controller=UserController.newuser_controller.do_something(user1,user2)我
我有:When/^(?:|I)follow"([^"]*)"(?:within"([^"]*)")?$/do|link,selector|with_scope(selector)doclick_link(link)endend我打电话的地方:Background:GivenIamanexistingadminuserWhenIfollow"CLIENTS"我的HTML是这样的:CLIENTS我一直收到这个错误:.F-.F--U-----U(::)failedsteps(::)nolinkwithtitle,idortext'CLIENTS'found(Capybara::Element