{"action":"opened","issue":{"url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/10644","repository_url":"https://api.github.com/repos/rapid7/metasploit-framework","labels_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/10644/labels{/name}","comments_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/10644/comments","events_url":"https://api.github.com/repos/rapid7/metasploit-framework/issues/10644/events","html_url":"https://github.com/rapid7/metasploit-framework/issues/10644","id":360510595,"node_id":"MDU6SXNzdWUzNjA1MTA1OTU=","number":10644,"title":"Add is_writable? to Msf::Post::File mixin","user":{"login":"bcoles","id":434827,"node_id":"MDQ6VXNlcjQzNDgyNw==","avatar_url":"https://avatars2.githubusercontent.com/u/434827?v=4","gravatar_id":"","url":"https://api.github.com/users/bcoles","html_url":"https://github.com/bcoles","followers_url":"https://api.github.com/users/bcoles/followers","following_url":"https://api.github.com/users/bcoles/following{/other_user}","gists_url":"https://api.github.com/users/bcoles/gists{/gist_id}","starred_url":"https://api.github.com/users/bcoles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bcoles/subscriptions","organizations_url":"https://api.github.com/users/bcoles/orgs","repos_url":"https://api.github.com/users/bcoles/repos","events_url":"https://api.github.com/users/bcoles/events{/privacy}","received_events_url":"https://api.github.com/users/bcoles/received_events","type":"User","site_admin":false},"labels":[{"id":213102939,"node_id":"MDU6TGFiZWwyMTMxMDI5Mzk=","url":"https://api.github.com/repos/rapid7/metasploit-framework/labels/enhancement","name":"enhancement","color":"5319e7","default":true},{"id":103436071,"node_id":"MDU6TGFiZWwxMDM0MzYwNzE=","url":"https://api.github.com/repos/rapid7/metasploit-framework/labels/library","name":"library","color":"fad8c7","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-09-15T05:48:32Z","updated_at":"2018-09-15T05:48:32Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Add `writable?` to `Msf::Post::File` mixin.\r\n\r\nNumerous post modules and local exploit modules verify whether a file or directory are writable before proceeding, or to verify whether an operation was successful. This is good.\r\n\r\nEvery module re-implements the same code. This is bad.\r\n\r\nMSF already has a `Msf::Post::File` mixin for dealing with file operations. This is good.\r\n\r\nThe mixin does not contain functionality to check if a path is writable. This is bad.\r\n\r\nIt would be nice if this was a method in (`lib/msf/core/post/file.rb`) for consistency.\r\n\r\n```\r\n# grep -rn \"test -w\" modules/\r\nmodules/exploits/linux/local/bpf_sign_extension_priv_esc.rb:179:    unless cmd_exec(\"test -w '#{base_dir}' && echo true\").include? 'true'\r\nmodules/exploits/linux/local/af_packet_packet_set_ring_priv_esc.rb:173:    unless cmd_exec(\"test -w '#{base_dir}' && echo true\").include? 'true'\r\nmodules/exploits/linux/local/juju_run_agent_priv_esc.rb:106:    unless cmd_exec(\"test -w '#{base_dir}' && echo true\").include? 'true'\r\nmodules/exploits/linux/local/rds_priv_esc.rb:155:    unless cmd_exec(\"test -w '#{base_dir}' && echo true\").include? 'true'\r\nmodules/exploits/linux/local/glibc_realpath_priv_esc.rb:166:    unless cmd_exec(\"test -w '#{base_dir}' && echo true\").include? 'true'\r\nmodules/exploits/linux/local/sock_sendpage.rb:141:    unless cmd_exec(\"test -w '#{base_dir}' && echo true\").include? 'true'\r\nmodules/exploits/linux/local/libuser_roothelper_priv_esc.rb:162:    unless cmd_exec(\"test -w '#{base_dir}' && echo true\").include? 'true'\r\nmodules/exploits/linux/local/af_packet_chocobo_root_priv_esc.rb:173:    unless cmd_exec(\"test -w '#{base_dir}' && echo true\").include? 'true'\r\nmodules/exploits/linux/local/rc_local_persistence.rb:39:    unless cmd_exec(\"test -w '/etc/rc.local' && echo true\").include? 'true'\r\nmodules/exploits/linux/local/ufo_privilege_escalation.rb:170:    unless cmd_exec(\"test -w '#{base_dir}' && echo true\").include? 'true'\r\nmodules/exploits/linux/local/recvmmsg_priv_esc.rb:150:    unless cmd_exec(\"test -w '#{base_dir}' && echo true\").include? 'true'\r\nmodules/exploits/linux/local/bpf_priv_esc.rb:140:    unless cmd_exec(\"test -w '#{base_dir}' && echo true\").include? 'true'\r\nmodules/exploits/osx/local/rootpipe.rb:81:    unless cmd_exec(\"test -w '#{base_dir}' && echo true\").include? 'true'\r\nmodules/exploits/osx/local/setuid_tunnelblick.rb:90:    unless cmd_exec(\"test -w '#{base_dir}' && echo true\").include? 'true'\r\nmodules/exploits/osx/local/setuid_viscosity.rb:92:    unless cmd_exec(\"test -w '#{base_dir}' && echo true\").include? 'true'\r\nmodules/exploits/osx/local/rsh_libmalloc.rb:61:    unless cmd_exec(\"test -w '#{base_dir}' && echo true\").include? 'true'\r\nmodules/exploits/osx/local/dyld_print_to_file_root.rb:68:    unless cmd_exec(\"test -w '#{base_dir}' && echo true\").include? 'true'\r\nmodules/exploits/osx/local/vmware_bash_function_root.rb:90:    unless cmd_exec(\"test -w '#{base_dir}' && echo true\").include? 'true'\r\nmodules/exploits/osx/local/tpwn.rb:64:    unless cmd_exec(\"test -w '#{base_dir}' && echo true\").include? 'true'\r\nmodules/exploits/osx/local/rootpipe_entitlements.rb:77:    unless cmd_exec(\"test -w '#{base_dir}' && echo true\").include? 'true'\r\nmodules/post/multi/recon/sudo_commands.rb:47:    cmd_exec(\"test -w '#{path}' && echo true\").include? 'true'\r\nmodules/post/linux/gather/mimipenguin.rb:181:    unless cmd_exec(\"test -w '#{base_dir}' && echo true\").include? 'true'\r\n```\r\n"}}
{"actor":{"display_login":"bcoles"}}