pwn 0.5.795 → 0.5.796
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/bin/pwn_autoinc_version +4 -5
- data/bin/pwn_web_cache_deception +40 -29
- data/documentation/AWS.md +15 -5
- data/documentation/Diagrams.md +1 -1
- data/documentation/Home.md +2 -2
- data/documentation/How-PWN-Works.md +1 -1
- data/documentation/What-is-PWN.md +1 -1
- data/documentation/diagrams/aws-cloud-security.svg +1 -1
- data/documentation/diagrams/dot/aws-cloud-security.dot +1 -1
- data/documentation/diagrams/dot/network-infra-testing.dot +1 -1
- data/documentation/diagrams/network-infra-testing.svg +1 -1
- data/etc/default_cron/session_cleanup.rb +84 -51
- data/lib/pwn/ai/agent/assembly.rb +0 -2
- data/lib/pwn/ai/agent/btc.rb +0 -2
- data/lib/pwn/ai/agent/burp_suite.rb +0 -2
- data/lib/pwn/ai/agent/curriculum.rb +2 -2
- data/lib/pwn/ai/agent/dispatch.rb +3 -0
- data/lib/pwn/ai/agent/engagement.rb +96 -41
- data/lib/pwn/ai/agent/extrospection/osint/bridges.rb +2 -0
- data/lib/pwn/ai/agent/extrospection.rb +50 -13
- data/lib/pwn/ai/agent/gqrx.rb +0 -2
- data/lib/pwn/ai/agent/hacker_one.rb +0 -2
- data/lib/pwn/ai/agent/learning.rb +45 -13
- data/lib/pwn/ai/agent/loop.rb +12 -11
- data/lib/pwn/ai/agent/metrics.rb +1 -1
- data/lib/pwn/ai/agent/mission.rb +6 -3
- data/lib/pwn/ai/agent/policy.rb +1 -1
- data/lib/pwn/ai/agent/policy_evaluation.rb +2 -2
- data/lib/pwn/ai/agent/reflect.rb +1 -0
- data/lib/pwn/ai/agent/request_runtime.rb +1 -1
- data/lib/pwn/ai/agent/reward.rb +155 -53
- data/lib/pwn/ai/agent/sast.rb +0 -2
- data/lib/pwn/ai/agent/task_dag.rb +5 -3
- data/lib/pwn/ai/agent/task_summarizer.rb +21 -11
- data/lib/pwn/ai/agent/tool_guard.rb +19 -0
- data/lib/pwn/ai/agent/tools/ruby_eval.rb +1 -1
- data/lib/pwn/ai/agent/tools/verify.rb +7 -3
- data/lib/pwn/ai/agent/transparent_browser.rb +0 -2
- data/lib/pwn/ai/agent/turn_finalizer.rb +3 -0
- data/lib/pwn/ai/anthropic.rb +3 -3
- data/lib/pwn/ai/context.rb +2 -1
- data/lib/pwn/ai/gemini.rb +7 -5
- data/lib/pwn/ai/grok.rb +37 -18
- data/lib/pwn/ai/mcp.rb +17 -5
- data/lib/pwn/ai/ollama.rb +76 -35
- data/lib/pwn/ai/open_ai.rb +7 -19
- data/lib/pwn/ai/open_web_ui.rb +76 -40
- data/lib/pwn/aws/cloud_search_domain.rb +6 -0
- data/lib/pwn/aws/iam.rb +2 -2
- data/lib/pwn/aws/workspaces.rb +2 -2
- data/lib/pwn/aws.rb +0 -5
- data/lib/pwn/bounty/lifecycle_authz_replay.rb +1 -1
- data/lib/pwn/config.rb +17 -10
- data/lib/pwn/corpus.rb +33 -5
- data/lib/pwn/cron.rb +60 -17
- data/lib/pwn/driver.rb +2 -3
- data/lib/pwn/engagement.rb +28 -10
- data/lib/pwn/ffi/capstone.rb +3 -2
- data/lib/pwn/ffi/fftw.rb +8 -6
- data/lib/pwn/ffi/keystone.rb +3 -2
- data/lib/pwn/ffi/soapy_sdr.rb +10 -6
- data/lib/pwn/json_text.rb +25 -13
- data/lib/pwn/memory_index.rb +6 -4
- data/lib/pwn/module_skills.rb +3 -1
- data/lib/pwn/plugins/aflplusplus.rb +1 -0
- data/lib/pwn/plugins/ai_sandbox.rb +42 -10
- data/lib/pwn/plugins/android.rb +429 -466
- data/lib/pwn/plugins/artifact_registry.rb +12 -2
- data/lib/pwn/plugins/assembly.rb +9 -42
- data/lib/pwn/plugins/authentication_helper.rb +4 -3
- data/lib/pwn/plugins/baresip.rb +70 -28
- data/lib/pwn/plugins/binary_analysis.rb +14 -5
- data/lib/pwn/plugins/binary_parser.rb +42 -7
- data/lib/pwn/plugins/black_duck_binary_analysis.rb +3 -3
- data/lib/pwn/plugins/burp_suite.rb +15 -12
- data/lib/pwn/plugins/bus_pirate.rb +3 -7
- data/lib/pwn/plugins/char.rb +9 -3
- data/lib/pwn/plugins/credit_card.rb +7 -0
- data/lib/pwn/plugins/dao_ldap.rb +2 -2
- data/lib/pwn/plugins/dao_mongo.rb +1 -1
- data/lib/pwn/plugins/debugger.rb +1 -1
- data/lib/pwn/plugins/defect_dojo.rb +7 -3
- data/lib/pwn/plugins/detect_os.rb +1 -1
- data/lib/pwn/plugins/detonate.rb +9 -19
- data/lib/pwn/plugins/exploit_db.rb +1 -1
- data/lib/pwn/plugins/file_fu.rb +4 -1
- data/lib/pwn/plugins/findings.rb +76 -2
- data/lib/pwn/plugins/fuzz.rb +12 -3
- data/lib/pwn/plugins/gdb.rb +7 -2
- data/lib/pwn/plugins/gdbmi.rb +10 -6
- data/lib/pwn/plugins/git.rb +18 -13
- data/lib/pwn/plugins/github.rb +11 -6
- data/lib/pwn/plugins/google_workspace.rb +11 -3
- data/lib/pwn/plugins/hacker_one.rb +5 -1
- data/lib/pwn/plugins/httpx.rb +24 -8
- data/lib/pwn/plugins/ip_info.rb +11 -8
- data/lib/pwn/plugins/irc.rb +73 -45
- data/lib/pwn/plugins/jenkins.rb +2 -2
- data/lib/pwn/plugins/jira_data_center.rb +13 -6
- data/lib/pwn/plugins/jobs.rb +62 -4
- data/lib/pwn/plugins/log.rb +1 -1
- data/lib/pwn/plugins/monkey_patch.rb +1 -1
- data/lib/pwn/plugins/msr206.rb +157 -182
- data/lib/pwn/plugins/nessus_cloud.rb +2 -2
- data/lib/pwn/plugins/nexpose_vuln_scan.rb +44 -33
- data/lib/pwn/plugins/nuclei.rb +24 -8
- data/lib/pwn/plugins/ocr.rb +3 -1
- data/lib/pwn/plugins/open_api.rb +0 -4
- data/lib/pwn/plugins/openvas.rb +31 -43
- data/lib/pwn/plugins/packet.rb +40 -25
- data/lib/pwn/plugins/pony.rb +2 -2
- data/lib/pwn/plugins/preflight_checker.rb +1 -1
- data/lib/pwn/plugins/process_tube.rb +17 -2
- data/lib/pwn/plugins/ps.rb +6 -1
- data/lib/pwn/plugins/repl/ai.rb +1 -0
- data/lib/pwn/plugins/repl/ai_console.rb +12 -5
- data/lib/pwn/plugins/repl/mesh.rb +10 -2
- data/lib/pwn/plugins/sbom.rb +59 -27
- data/lib/pwn/plugins/scannable_codes.rb +3 -1
- data/lib/pwn/plugins/serial.rb +102 -44
- data/lib/pwn/plugins/shodan.rb +4 -10
- data/lib/pwn/plugins/sock.rb +16 -11
- data/lib/pwn/plugins/ssn.rb +3 -1
- data/lib/pwn/plugins/transparent_browser.rb +43 -3
- data/lib/pwn/plugins/vault.rb +92 -30
- data/lib/pwn/plugins/vin.rb +2 -1
- data/lib/pwn/plugins/vsphere.rb +2 -1
- data/lib/pwn/plugins/xxd.rb +3 -5
- data/lib/pwn/plugins/yubikey/security_domain/scp.rb +4 -0
- data/lib/pwn/plugins/yubikey/transport.rb +42 -11
- data/lib/pwn/plugins/yubikey.rb +21 -6
- data/lib/pwn/plugins/zaproxy.rb +3 -4
- data/lib/pwn/reports/ai_red_team.rb +4 -4
- data/lib/pwn/reports/pdf.rb +9 -5
- data/lib/pwn/reports/sast.rb +4 -4
- data/lib/pwn/sast/keystore.rb +2 -2
- data/lib/pwn/sast/logger.rb +1 -1
- data/lib/pwn/sast/php_type_juggling.rb +3 -6
- data/lib/pwn/sast/pom_version.rb +12 -6
- data/lib/pwn/sast/port.rb +1 -1
- data/lib/pwn/sast/sql.rb +3 -7
- data/lib/pwn/sast/test_case_engine.rb +62 -16
- data/lib/pwn/sast/type_script_type_juggling.rb +3 -6
- data/lib/pwn/sdr/decoder/base.rb +8 -0
- data/lib/pwn/sdr/decoder/lora.rb +1 -1
- data/lib/pwn/sdr/flipper_zero.rb +4 -7
- data/lib/pwn/sdr/gqrx.rb +35 -16
- data/lib/pwn/sdr/son_micro_rfid.rb +44 -26
- data/lib/pwn/sdr.rb +1 -1
- data/lib/pwn/session_trace.rb +7 -2
- data/lib/pwn/sessions.rb +307 -39
- data/lib/pwn/setup.rb +4 -3
- data/lib/pwn/version.rb +1 -1
- data/lib/pwn/www/app_cobalt_io.rb +14 -2
- data/lib/pwn/www/bing.rb +13 -1
- data/lib/pwn/www/bug_crowd.rb +14 -2
- data/lib/pwn/www/checkip.rb +13 -1
- data/lib/pwn/www/coinbase_pro.rb +14 -2
- data/lib/pwn/www/duckduckgo.rb +13 -1
- data/lib/pwn/www/facebook.rb +14 -2
- data/lib/pwn/www/github.rb +14 -2
- data/lib/pwn/www/google.rb +13 -1
- data/lib/pwn/www/hacker_one.rb +117 -33
- data/lib/pwn/www/linkedin.rb +14 -2
- data/lib/pwn/www/pandora.rb +14 -2
- data/lib/pwn/www/pastebin.rb +13 -1
- data/lib/pwn/www/paypal.rb +16 -4
- data/lib/pwn/www/synack.rb +14 -2
- data/lib/pwn/www/torch.rb +17 -3
- data/lib/pwn/www/trading_view.rb +14 -2
- data/lib/pwn/www/twitter.rb +14 -2
- data/lib/pwn/www/uber.rb +14 -2
- data/lib/pwn/www/upwork.rb +14 -2
- data/lib/pwn/www/wayback_machine.rb +16 -2
- data/lib/pwn/www/youtube.rb +13 -1
- data/pwn.gemspec +4 -0
- data/spec/integration/authentication_helper_oath_spec.rb +1 -1
- data/spec/integration/autoinc_lifecycle_supplement_spec.rb +47 -0
- data/spec/integration/gemspec_deleted_files_spec.rb +43 -0
- data/spec/integration/spec_curriculum_isolation_spec.rb +41 -0
- data/spec/integration/verify_acceptance_eui_regression_spec.rb +162 -0
- data/spec/integration/web_cache_lifecycle_closure_spec.rb +89 -0
- data/spec/integration/web_cache_lifecycle_supplement_spec.rb +70 -0
- data/spec/lib/pwn/ai/agent/analysis_errors_regression_spec.rb +33 -0
- data/spec/lib/pwn/ai/agent/curriculum_cooldown_regression_spec.rb +19 -0
- data/spec/lib/pwn/ai/agent/curriculum_spec.rb +2 -0
- data/spec/lib/pwn/ai/agent/engagement_boundary_regression_spec.rb +42 -0
- data/spec/lib/pwn/ai/agent/engagement_dispatch_review_spec.rb +82 -0
- data/spec/lib/pwn/ai/agent/engagement_roe_regression_spec.rb +25 -0
- data/spec/lib/pwn/ai/agent/engagement_scope_regression_spec.rb +37 -0
- data/spec/lib/pwn/ai/agent/extrospection/osint/bridges_spec.rb +4 -0
- data/spec/lib/pwn/ai/agent/extrospection_input_regression_spec.rb +31 -0
- data/spec/lib/pwn/ai/agent/extrospection_review_spec.rb +61 -0
- data/spec/lib/pwn/ai/agent/extrospection_serial_review_spec.rb +42 -0
- data/spec/lib/pwn/ai/agent/extrospection_spec.rb +9 -0
- data/spec/lib/pwn/ai/agent/extrospection_verification_regression_spec.rb +39 -0
- data/spec/lib/pwn/ai/agent/learning_last_answer_regression_spec.rb +32 -0
- data/spec/lib/pwn/ai/agent/learning_lifecycle_closure_spec.rb +84 -0
- data/spec/lib/pwn/ai/agent/learning_prune_regression_spec.rb +17 -0
- data/spec/lib/pwn/ai/agent/learning_spec.rb +2 -1
- data/spec/lib/pwn/ai/agent/loop_execution_audit_spec.rb +30 -0
- data/spec/lib/pwn/ai/agent/metrics_usage_regression_spec.rb +20 -0
- data/spec/lib/pwn/ai/agent/mission_execution_audit_spec.rb +27 -0
- data/spec/lib/pwn/ai/agent/mission_namespace_spec.rb +210 -18
- data/spec/lib/pwn/ai/agent/policy_confidence_regression_spec.rb +16 -0
- data/spec/lib/pwn/ai/agent/policy_evaluation_spec.rb +1 -1
- data/spec/lib/pwn/ai/agent/policy_evaluation_tmp_regression_spec.rb +36 -0
- data/spec/lib/pwn/ai/agent/reflect_model_regression_spec.rb +15 -0
- data/spec/lib/pwn/ai/agent/request_runtime_execution_audit_spec.rb +43 -0
- data/spec/lib/pwn/ai/agent/reward_binding_review_spec.rb +129 -0
- data/spec/lib/pwn/ai/agent/reward_dispatch_review_spec.rb +154 -0
- data/spec/lib/pwn/ai/agent/reward_envelope_regression_spec.rb +45 -0
- data/spec/lib/pwn/ai/agent/reward_turn_regression_spec.rb +40 -0
- data/spec/lib/pwn/ai/agent/swarm_spec.rb +2 -2
- data/spec/lib/pwn/ai/agent/task_dag_execution_audit_spec.rb +45 -0
- data/spec/lib/pwn/ai/agent/task_summarizer_failure_regression_spec.rb +26 -0
- data/spec/lib/pwn/ai/agent/tools/verify_execution_audit_spec.rb +33 -0
- data/spec/lib/pwn/ai/context_range_audit_spec.rb +24 -0
- data/spec/lib/pwn/ai/gemini_roundtrip_audit_spec.rb +33 -0
- data/spec/lib/pwn/ai/grok_reasoning_effort_spec.rb +43 -0
- data/spec/lib/pwn/ai/mcp_session_audit_spec.rb +36 -0
- data/spec/lib/pwn/ai/ollama_spec.rb +6 -11
- data/spec/lib/pwn/ai/open_web_ui_spec.rb +6 -11
- data/spec/lib/pwn/ai/provider_history_audit_spec.rb +44 -0
- data/spec/lib/pwn/ai/provider_operations_audit_spec.rb +53 -0
- data/spec/lib/pwn/ai/provider_review_history_stream_regression_spec.rb +143 -0
- data/spec/lib/pwn/ai/provider_review_tls_regression_spec.rb +62 -0
- data/spec/lib/pwn/ai/provider_stream_audit_spec.rb +49 -0
- data/spec/lib/pwn/aws/iam_decoding_regression_spec.rb +23 -0
- data/spec/lib/pwn/aws/services_runtime_regression_spec.rb +51 -0
- data/spec/lib/pwn/aws_spec.rb +6 -0
- data/spec/lib/pwn/banner_operational_audit_spec.rb +105 -0
- data/spec/lib/pwn/bounty/lifecycle_authz_replay_spec.rb +17 -0
- data/spec/lib/pwn/config_redaction_regression_spec.rb +24 -0
- data/spec/lib/pwn/config_skills_regression_spec.rb +38 -0
- data/spec/lib/pwn/corpus_core_review_regression_spec.rb +96 -0
- data/spec/lib/pwn/corpus_spec.rb +13 -0
- data/spec/lib/pwn/cron_core_review_regression_spec.rb +95 -0
- data/spec/lib/pwn/cron_execution_spec.rb +75 -0
- data/spec/lib/pwn/driver_core_review_regression_spec.rb +38 -0
- data/spec/lib/pwn/driver_spec.rb +13 -0
- data/spec/lib/pwn/engagement_core_review_regression_spec.rb +88 -0
- data/spec/lib/pwn/engagement_storage_regression_spec.rb +44 -0
- data/spec/lib/pwn/ffi/capstone_spec.rb +19 -0
- data/spec/lib/pwn/ffi/fftw_spec.rb +19 -0
- data/spec/lib/pwn/ffi/keystone_spec.rb +13 -0
- data/spec/lib/pwn/ffi/soapy_sdr_spec.rb +13 -0
- data/spec/lib/pwn/json_text_spec.rb +25 -0
- data/spec/lib/pwn/memory_index_spec.rb +23 -0
- data/spec/lib/pwn/module_skills_parsing_regression_spec.rb +34 -0
- data/spec/lib/pwn/plugins/ai_sandbox_boundary_review_spec.rb +57 -0
- data/spec/lib/pwn/plugins/ai_sandbox_spec.rb +10 -18
- data/spec/lib/pwn/plugins/android_review_fixes_spec.rb +121 -0
- data/spec/lib/pwn/plugins/android_transport_audit_spec.rb +64 -0
- data/spec/lib/pwn/plugins/api_import_namespace_audit_spec.rb +49 -0
- data/spec/lib/pwn/plugins/artifact_registry_namespace_audit_spec.rb +20 -0
- data/spec/lib/pwn/plugins/artifact_registry_review_fixes_spec.rb +63 -0
- data/spec/lib/pwn/plugins/assembly_namespace_audit_spec.rb +16 -0
- data/spec/lib/pwn/plugins/assembly_review_fixes_spec.rb +33 -0
- data/spec/lib/pwn/plugins/authentication_helper_spec.rb +14 -0
- data/spec/lib/pwn/plugins/baresip_review_fixes_spec.rb +127 -0
- data/spec/lib/pwn/plugins/baresip_transport_audit_spec.rb +59 -0
- data/spec/lib/pwn/plugins/binary_analysis_process_review_spec.rb +57 -0
- data/spec/lib/pwn/plugins/black_duck_namespace_audit_spec.rb +25 -0
- data/spec/lib/pwn/plugins/burp_suite_har_review_fixes_spec.rb +60 -0
- data/spec/lib/pwn/plugins/burp_suite_import_review_fixes_spec.rb +62 -0
- data/spec/lib/pwn/plugins/burp_suite_namespace_audit_spec.rb +37 -0
- data/spec/lib/pwn/plugins/bus_pirate_transport_audit_spec.rb +19 -0
- data/spec/lib/pwn/plugins/file_fu_namespace_audit_spec.rb +17 -0
- data/spec/lib/pwn/plugins/findings_structured_spec.rb +1 -1
- data/spec/lib/pwn/plugins/gdbmi_namespace_audit_spec.rb +28 -0
- data/spec/lib/pwn/plugins/gdbmi_review_fixes_spec.rb +73 -0
- data/spec/lib/pwn/plugins/github_argv_review_spec.rb +49 -0
- data/spec/lib/pwn/plugins/google_workspace_provider_review_oauth_spec.rb +80 -0
- data/spec/lib/pwn/plugins/irc_review_fixes_spec.rb +92 -0
- data/spec/lib/pwn/plugins/irc_transport_audit_spec.rb +37 -0
- data/spec/lib/pwn/plugins/jenkins_namespace_audit_spec.rb +12 -0
- data/spec/lib/pwn/plugins/jira_data_center_namespace_audit_spec.rb +44 -0
- data/spec/lib/pwn/plugins/jira_data_center_review_fixes_spec.rb +81 -0
- data/spec/lib/pwn/plugins/jsonl_elf_review_fixes_spec.rb +59 -0
- data/spec/lib/pwn/plugins/log_spec.rb +36 -20
- data/spec/lib/pwn/plugins/monkey_patch_spec.rb +16 -0
- data/spec/lib/pwn/plugins/msr206_readback_review_fixes_spec.rb +119 -0
- data/spec/lib/pwn/plugins/msr206_review_fixes_spec.rb +50 -0
- data/spec/lib/pwn/plugins/msr206_transport_audit_spec.rb +64 -0
- data/spec/lib/pwn/plugins/nessus_cloud_namespace_audit_spec.rb +14 -0
- data/spec/lib/pwn/plugins/nexpose_review_fixes_spec.rb +55 -0
- data/spec/lib/pwn/plugins/open_api_namespace_audit_spec.rb +22 -0
- data/spec/lib/pwn/plugins/packet_transport_audit_spec.rb +47 -0
- data/spec/lib/pwn/plugins/plugins_b_operational_regression_spec.rb +600 -0
- data/spec/lib/pwn/plugins/pony_namespace_audit_spec.rb +17 -0
- data/spec/lib/pwn/plugins/pony_review_fixes_spec.rb +33 -0
- data/spec/lib/pwn/plugins/process_tube_namespace_audit_spec.rb +19 -0
- data/spec/lib/pwn/plugins/ps_namespace_audit_spec.rb +12 -0
- data/spec/lib/pwn/plugins/repl/ai_console_spec.rb +111 -0
- data/spec/lib/pwn/plugins/repl/ai_spec.rb +38 -0
- data/spec/lib/pwn/plugins/repl/mesh_spec.rb +52 -0
- data/spec/lib/pwn/plugins/sandbox_spec.rb +9 -7
- data/spec/lib/pwn/plugins/sbom_review_fixes_spec.rb +43 -0
- data/spec/lib/pwn/plugins/scannable_codes_namespace_audit_spec.rb +15 -0
- data/spec/lib/pwn/plugins/serial_review_fixes_spec.rb +76 -0
- data/spec/lib/pwn/plugins/serial_transport_audit_spec.rb +102 -0
- data/spec/lib/pwn/plugins/shodan_namespace_audit_spec.rb +10 -0
- data/spec/lib/pwn/plugins/sock_transport_audit_spec.rb +55 -0
- data/spec/lib/pwn/plugins/transparent_browser_navigation_review_spec.rb +21 -0
- data/spec/lib/pwn/plugins/vault_master_key_eui_regression_spec.rb +242 -0
- data/spec/lib/pwn/plugins/vault_spec.rb +58 -0
- data/spec/lib/pwn/plugins/vault_store_safety_spec.rb +1 -1
- data/spec/lib/pwn/plugins/xxd_namespace_audit_spec.rb +34 -0
- data/spec/lib/pwn/plugins/yubikey_hid_cleanup_review_fixes_spec.rb +52 -0
- data/spec/lib/pwn/plugins/yubikey_lifecycle_audit_spec.rb +65 -0
- data/spec/lib/pwn/plugins/yubikey_options_audit_spec.rb +30 -0
- data/spec/lib/pwn/plugins/yubikey_selector_audit_spec.rb +26 -0
- data/spec/lib/pwn/plugins/yubikey_spec.rb +1 -1
- data/spec/lib/pwn/plugins/zaproxy_namespace_audit_spec.rb +30 -0
- data/spec/lib/pwn/reports/empty_report_audit_spec.rb +18 -0
- data/spec/lib/pwn/reports/pdf_spec.rb +25 -0
- data/spec/lib/pwn/reports/provider_review_encoding_regression_spec.rb +45 -0
- data/spec/lib/pwn/sast/engine_runtime_regression_spec.rb +91 -0
- data/spec/lib/pwn/sast/filter_edge_regression_spec.rb +39 -0
- data/spec/lib/pwn/sast/formatter_review_fixes_spec.rb +178 -0
- data/spec/lib/pwn/sast/path_review_fixes_spec.rb +60 -0
- data/spec/lib/pwn/sast/pom_runtime_regression_spec.rb +37 -0
- data/spec/lib/pwn/sast/rules_runtime_regression_spec.rb +78 -0
- data/spec/lib/pwn/sast/sql_review_fixes_spec.rb +38 -0
- data/spec/lib/pwn/sdr/decoder/base_iq_spec.rb +21 -18
- data/spec/lib/pwn/sdr/decoder/base_review_fixes_spec.rb +49 -0
- data/spec/lib/pwn/sdr/decoder/base_validation_spec.rb +78 -0
- data/spec/lib/pwn/sdr/decoder/lora_spec.rb +9 -0
- data/spec/lib/pwn/sdr/flipper_zero_review_fixes_spec.rb +34 -0
- data/spec/lib/pwn/sdr/gqrx_operational_spec.rb +83 -0
- data/spec/lib/pwn/sdr/gqrx_review_fixes_spec.rb +22 -0
- data/spec/lib/pwn/sdr/son_micro_rfid_review_fixes_spec.rb +113 -0
- data/spec/lib/pwn/sdr/son_micro_rfid_serial_review_fixes_spec.rb +76 -0
- data/spec/lib/pwn/sdr/son_micro_rfid_spec.rb +39 -0
- data/spec/lib/pwn/sdr_spec.rb +5 -0
- data/spec/lib/pwn/session_cleanup_default_spec.rb +1 -1
- data/spec/lib/pwn/session_cleanup_lifecycle_supplement_spec.rb +39 -0
- data/spec/lib/pwn/session_cleanup_payload_spec.rb +3 -2
- data/spec/lib/pwn/session_trace_lifecycle_supplement_spec.rb +39 -0
- data/spec/lib/pwn/sessions_archive_closure_spec.rb +126 -0
- data/spec/lib/pwn/sessions_lifecycle_closure_spec.rb +373 -0
- data/spec/lib/pwn/sessions_lifecycle_supplement_spec.rb +204 -0
- data/spec/lib/pwn/setup_operational_regression_spec.rb +36 -0
- data/spec/lib/pwn/www/browser_review_fixes_spec.rb +70 -0
- data/spec/lib/pwn/www/browser_runtime_regression_spec.rb +100 -0
- data/spec/lib/pwn/www/hacker_one_runtime_regression_spec.rb +146 -0
- data/spec/lib/pwn/www/pagination_review_fixes_spec.rb +84 -0
- data/spec/support/namespace_controller_observability_fixture.rb +141 -0
- data/spec/support/sandbox.rb +8 -5
- data/third_party/pwn_rdoc.jsonl +73 -31
- metadata +137 -18
- data/etc/default_skills/pwn/aws/elastic_transcoder/SKILL.md +0 -48
- data/etc/default_skills/pwn/aws/lambda_preview/SKILL.md +0 -48
- data/etc/default_skills/pwn/aws/ops_works/SKILL.md +0 -48
- data/etc/default_skills/pwn/aws/ops_works_cm/SKILL.md +0 -48
- data/etc/default_skills/pwn/aws/sms/SKILL.md +0 -48
- data/lib/pwn/aws/elastic_transcoder.rb +0 -95
- data/lib/pwn/aws/lambda_preview.rb +0 -95
- data/lib/pwn/aws/ops_works.rb +0 -95
- data/lib/pwn/aws/ops_works_cm.rb +0 -95
- data/lib/pwn/aws/sms.rb +0 -95
- data/spec/lib/pwn/aws/elastic_transcoder_spec.rb +0 -15
- data/spec/lib/pwn/aws/lambda_preview_spec.rb +0 -15
- data/spec/lib/pwn/aws/ops_works_cm_spec.rb +0 -15
- data/spec/lib/pwn/aws/ops_works_spec.rb +0 -15
- data/spec/lib/pwn/aws/sms_spec.rb +0 -15
|
@@ -335,6 +335,8 @@ module PWN
|
|
|
335
335
|
TCPSocket.socks_server = tor_obj[:ip]
|
|
336
336
|
TCPSocket.socks_port = tor_obj[:port]
|
|
337
337
|
else
|
|
338
|
+
browser_obj[:previous_proxy] = RestClient.proxy
|
|
339
|
+
browser_obj[:proxy] = proxy
|
|
338
340
|
browser_obj[:browser].proxy = proxy
|
|
339
341
|
end
|
|
340
342
|
end
|
|
@@ -371,13 +373,17 @@ module PWN
|
|
|
371
373
|
# if it doesn't work, try the first window handle. In chrome they
|
|
372
374
|
# get reversed sometimes ¯\_(ツ)_/¯
|
|
373
375
|
target_window_handle = browser_obj[:browser].driver.window_handles.last
|
|
376
|
+
navigation_attempts = 0
|
|
374
377
|
begin
|
|
378
|
+
navigation_attempts += 1
|
|
375
379
|
browser_obj[:browser].driver.switch_to.window(target_window_handle)
|
|
376
380
|
|
|
377
381
|
url = 'about:about'
|
|
378
382
|
url = 'chrome://chrome-urls' if chrome_types.include?(browser_type)
|
|
379
383
|
browser_obj[:browser].goto(url)
|
|
380
384
|
rescue Selenium::WebDriver::Error::WebDriverError
|
|
385
|
+
raise if navigation_attempts >= 2
|
|
386
|
+
|
|
381
387
|
target_window_handle = browser_obj[:browser].driver.window_handles.first
|
|
382
388
|
retry
|
|
383
389
|
end
|
|
@@ -396,10 +402,22 @@ module PWN
|
|
|
396
402
|
apply_driver_timeouts!(browser_obj: browser_obj)
|
|
397
403
|
browser_obj
|
|
398
404
|
rescue StandardError => e
|
|
405
|
+
release_partial_browser(browser_obj: browser_obj)
|
|
399
406
|
puts e.backtrace
|
|
400
407
|
raise e
|
|
401
408
|
end
|
|
402
409
|
|
|
410
|
+
private_class_method def self.release_partial_browser(opts = {})
|
|
411
|
+
browser_obj = opts[:browser_obj]
|
|
412
|
+
browser = browser_obj.is_a?(Hash) ? browser_obj[:browser] : nil
|
|
413
|
+
return :absent unless browser && browser != RestClient && browser.respond_to?(:close)
|
|
414
|
+
|
|
415
|
+
browser.close
|
|
416
|
+
:closed
|
|
417
|
+
rescue StandardError
|
|
418
|
+
:close_failed
|
|
419
|
+
end
|
|
420
|
+
|
|
403
421
|
# Supported Method Parameters::
|
|
404
422
|
# browser_obj = PWN::Plugins::TransparentBrowser.dump_links(
|
|
405
423
|
# browser_obj: browser_obj1
|
|
@@ -523,6 +541,8 @@ module PWN
|
|
|
523
541
|
rescue Timeout::Error, Timeout::ExitException
|
|
524
542
|
console_resp
|
|
525
543
|
rescue Selenium::WebDriver::Error::JavascriptError
|
|
544
|
+
raise if script == js
|
|
545
|
+
|
|
526
546
|
script = js
|
|
527
547
|
retry
|
|
528
548
|
end
|
|
@@ -929,6 +949,9 @@ module PWN
|
|
|
929
949
|
keyword = opts[:keyword]
|
|
930
950
|
|
|
931
951
|
tabs_arr_hash = list_tabs(browser_obj: browser_obj)
|
|
952
|
+
return tabs_arr_hash if index && tabs_arr_hash.none? { |tab| tab[:index] == index }
|
|
953
|
+
return tabs_arr_hash if keyword && tabs_arr_hash.none? { |tab| tab[:title].include?(keyword) || tab[:url].include?(keyword) }
|
|
954
|
+
|
|
932
955
|
browser_ready_to_close = true if tabs_arr_hash.length == 1
|
|
933
956
|
|
|
934
957
|
if browser_ready_to_close
|
|
@@ -1138,7 +1161,7 @@ module PWN
|
|
|
1138
1161
|
page_state = runtime_resp['result']['result']['value']
|
|
1139
1162
|
JSON.parse(page_state, symbolize_names: true)
|
|
1140
1163
|
rescue JSON::ParserError => e
|
|
1141
|
-
raise "Failed to parse state JSON: #{e.message}
|
|
1164
|
+
raise "Failed to parse state JSON: #{e.message}"
|
|
1142
1165
|
rescue StandardError => e
|
|
1143
1166
|
raise e
|
|
1144
1167
|
end
|
|
@@ -1555,6 +1578,7 @@ module PWN
|
|
|
1555
1578
|
tor_obj = browser_obj[:tor_obj]
|
|
1556
1579
|
|
|
1557
1580
|
PWN::Plugins::Tor.stop(tor_obj: browser_obj[:tor_obj]) if tor_obj
|
|
1581
|
+
RestClient.proxy = browser_obj[:previous_proxy] if browser == RestClient && browser_obj.key?(:previous_proxy)
|
|
1558
1582
|
|
|
1559
1583
|
# Close the browser unless browser.nil? (thus the &)
|
|
1560
1584
|
browser&.close unless browser == RestClient
|
|
@@ -1743,8 +1767,9 @@ module PWN
|
|
|
1743
1767
|
end
|
|
1744
1768
|
entries = Array(@intercepted) if entries.empty?
|
|
1745
1769
|
url = opts[:url].to_s
|
|
1770
|
+
browser = browser_handle(opts)
|
|
1746
1771
|
html = html_body(opts)
|
|
1747
|
-
if entries.empty? && !url.empty?
|
|
1772
|
+
if entries.empty? && !url.empty? && browser.respond_to?(:goto)
|
|
1748
1773
|
entries = [{
|
|
1749
1774
|
'startedDateTime' => Time.now.utc.iso8601,
|
|
1750
1775
|
'request' => { 'method' => 'GET', 'url' => url, 'headers' => [] },
|
|
@@ -1783,6 +1808,18 @@ module PWN
|
|
|
1783
1808
|
pack = evidence!(opts) unless pack.is_a?(Hash)
|
|
1784
1809
|
url = opts[:url].to_s
|
|
1785
1810
|
arts = [pack[:screenshot], pack[:har], pack[:dom]].select { |path| File.file?(path.to_s) }
|
|
1811
|
+
browser = browser_handle(opts)
|
|
1812
|
+
observed = browser.respond_to?(:goto) || opts[:screenshot] || opts[:har]
|
|
1813
|
+
unless observed
|
|
1814
|
+
return {
|
|
1815
|
+
title: opts[:title].to_s,
|
|
1816
|
+
severity: 'info',
|
|
1817
|
+
poc_artifacts: arts,
|
|
1818
|
+
evidence: 'captures unavailable; screenshot and HAR were not observed navigation',
|
|
1819
|
+
recorded: false
|
|
1820
|
+
}
|
|
1821
|
+
end
|
|
1822
|
+
|
|
1786
1823
|
evidence = "pixel=#{pack[:screenshot]} har=#{pack[:har]} url=#{url} screenshot PNG and HAR log prove the navigation"
|
|
1787
1824
|
PWN::Plugins::Findings.record(
|
|
1788
1825
|
title: opts[:title].to_s,
|
|
@@ -1909,7 +1946,10 @@ module PWN
|
|
|
1909
1946
|
const index = rows.length + 1;
|
|
1910
1947
|
el.setAttribute('data-pwn-jev', String(index));
|
|
1911
1948
|
const name = (el.getAttribute('aria-label') || el.innerText || el.getAttribute('placeholder') || el.getAttribute('name') || '').replace(/\s+/g, ' ').trim().slice(0, 80);
|
|
1912
|
-
const
|
|
1949
|
+
const type = String(el.type || el.getAttribute('type') || '').toLowerCase();
|
|
1950
|
+
const autocomplete = String(el.getAttribute('autocomplete') || '').toLowerCase();
|
|
1951
|
+
const secret = type === 'password' || type === 'hidden' || /password|passwd|secret|token|otp|cvv|cvc|cc-number|cc-csc/.test(name + ' ' + autocomplete);
|
|
1952
|
+
const row = { index: index, role: el.getAttribute('role') || el.tagName.toLowerCase(), name: name, value: secret ? '' : String(el.value || '').slice(0, 80) };
|
|
1913
1953
|
if (el.tagName === 'SELECT') row.options = [...el.options].slice(0, 12).map((option, n) => ({ index: n, text: option.text.slice(0, 40) }));
|
|
1914
1954
|
rows.push(row);
|
|
1915
1955
|
});
|
data/lib/pwn/plugins/vault.rb
CHANGED
|
@@ -17,6 +17,8 @@ module PWN
|
|
|
17
17
|
CREDENTIAL_KDF_ITERATIONS = 600_000
|
|
18
18
|
YUBIKEY_KDF = 'yubikey-hmac-sha1-hkdf-sha256'
|
|
19
19
|
YUBIKEY_HEADER = "PWN-YUBIKEY-VAULT:1\n"
|
|
20
|
+
class MasterKeyError < IOError; end
|
|
21
|
+
private_constant :MasterKeyError
|
|
20
22
|
|
|
21
23
|
# Returns an authenticated envelope; the caller persists only this value.
|
|
22
24
|
# keyring is an injected OS-keyring reader responding to call(key_id).
|
|
@@ -481,31 +483,36 @@ module PWN
|
|
|
481
483
|
eng = engagement_id(opts)
|
|
482
484
|
label = opts[:label].to_s
|
|
483
485
|
label = "#{opts[:host] || 'loot'}:#{opts[:username] || 'user'}:#{SecureRandom.hex(4)}" if label.empty?
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
486
|
+
path = box_path(engagement: eng)
|
|
487
|
+
FileUtils.mkdir_p(File.dirname(path), mode: 0o700)
|
|
488
|
+
record = with_vault_lock(file: path) do
|
|
489
|
+
records = load_records(engagement: eng)
|
|
490
|
+
selector = opts[:yubikey]
|
|
491
|
+
prior = records.find { |row| row[:label] == label }
|
|
492
|
+
envelope = prior && prior[:secret]
|
|
493
|
+
if selector.nil? && envelope.is_a?(Hash) && (envelope[:kdf] || envelope['kdf']) == YUBIKEY_KDF
|
|
494
|
+
metadata = envelope[:yubikey] || envelope['yubikey']
|
|
495
|
+
selector = metadata.transform_keys(&:to_sym).slice(:slot, :serial)
|
|
496
|
+
end
|
|
497
|
+
row = {
|
|
498
|
+
id: SecureRandom.hex(6),
|
|
499
|
+
label: label,
|
|
500
|
+
kind: (opts[:kind] || 'password').to_s,
|
|
501
|
+
engagement: eng,
|
|
502
|
+
host: opts[:host].to_s,
|
|
503
|
+
service: opts[:service].to_s,
|
|
504
|
+
username: opts[:username].to_s,
|
|
505
|
+
secret: encrypt_secret(secret: secret, yubikey: selector),
|
|
506
|
+
source: (opts[:source] || 'manual').to_s,
|
|
507
|
+
where: (opts[:where] || opts[:path]).to_s,
|
|
508
|
+
finding_id: (opts[:finding_id] || opts[:finding]).to_s,
|
|
509
|
+
at: Time.now.utc.iso8601
|
|
510
|
+
}
|
|
511
|
+
records.reject! { |item| item[:label] == label }
|
|
512
|
+
records << row
|
|
513
|
+
save_records(engagement: eng, records: records)
|
|
514
|
+
row
|
|
491
515
|
end
|
|
492
|
-
record = {
|
|
493
|
-
id: SecureRandom.hex(6),
|
|
494
|
-
label: label,
|
|
495
|
-
kind: (opts[:kind] || 'password').to_s,
|
|
496
|
-
engagement: eng,
|
|
497
|
-
host: opts[:host].to_s,
|
|
498
|
-
service: opts[:service].to_s,
|
|
499
|
-
username: opts[:username].to_s,
|
|
500
|
-
secret: encrypt_secret(secret: secret, yubikey: selector),
|
|
501
|
-
source: (opts[:source] || 'manual').to_s,
|
|
502
|
-
where: (opts[:where] || opts[:path]).to_s,
|
|
503
|
-
finding_id: (opts[:finding_id] || opts[:finding]).to_s,
|
|
504
|
-
at: Time.now.utc.iso8601
|
|
505
|
-
}
|
|
506
|
-
records.reject! { |row| row[:label] == label }
|
|
507
|
-
records << record
|
|
508
|
-
save_records(engagement: eng, records: records)
|
|
509
516
|
note_mission_loot(handle: record[:id], host: opts[:host])
|
|
510
517
|
record.except(:secret).merge(stored: true)
|
|
511
518
|
end
|
|
@@ -617,13 +624,66 @@ module PWN
|
|
|
617
624
|
end
|
|
618
625
|
|
|
619
626
|
private_class_method def self.master_key(opts = {})
|
|
620
|
-
_n = opts[:n]
|
|
621
627
|
path = key_path
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
628
|
+
with_vault_lock(file: path) do
|
|
629
|
+
stat = begin
|
|
630
|
+
File.lstat(path)
|
|
631
|
+
rescue Errno::ENOENT
|
|
632
|
+
nil
|
|
633
|
+
end
|
|
634
|
+
unless stat
|
|
635
|
+
raise MasterKeyError unless opts[:create] == true
|
|
636
|
+
|
|
637
|
+
software_loot = load_all_records.any? do |row|
|
|
638
|
+
envelope = row[:secret] || row
|
|
639
|
+
!envelope.key?(:kdf) && !envelope.key?('kdf')
|
|
640
|
+
end
|
|
641
|
+
raise MasterKeyError if software_loot
|
|
642
|
+
|
|
643
|
+
create_master_key(path: path)
|
|
644
|
+
end
|
|
645
|
+
read_master_key(path: path)
|
|
646
|
+
end
|
|
647
|
+
rescue StandardError
|
|
648
|
+
raise MasterKeyError, 'Invalid or unavailable software vault master key: restore an owned, single-link, 0600 regular file containing the original 32-byte key', cause: nil
|
|
649
|
+
end
|
|
650
|
+
|
|
651
|
+
private_class_method def self.create_master_key(opts = {})
|
|
652
|
+
path = opts.fetch(:path)
|
|
653
|
+
# Tempfile opens with 0600 from the outset. Link publishes a complete
|
|
654
|
+
# key without replacing any existing path; ensure also handles Interrupt.
|
|
655
|
+
Tempfile.create(['.pwn-vault-key-', '.tmp'], File.dirname(path)) do |key|
|
|
656
|
+
key.binmode
|
|
657
|
+
key.write(OpenSSL::Random.random_bytes(32))
|
|
658
|
+
key.flush
|
|
659
|
+
validate_master_key!(stat: key.stat)
|
|
660
|
+
key.fsync
|
|
661
|
+
File.link(key.path, path)
|
|
662
|
+
File.open(File.dirname(path), File::RDONLY, &:fsync)
|
|
663
|
+
end
|
|
664
|
+
end
|
|
665
|
+
|
|
666
|
+
private_class_method def self.validate_master_key!(opts = {})
|
|
667
|
+
stat = opts.fetch(:stat)
|
|
668
|
+
raise MasterKeyError unless stat.file? && stat.uid == Process.uid && stat.nlink == 1 && (stat.mode & 0o7777) == 0o600 && stat.size == 32
|
|
669
|
+
|
|
670
|
+
stat
|
|
671
|
+
end
|
|
672
|
+
|
|
673
|
+
private_class_method def self.read_master_key(opts = {})
|
|
674
|
+
path = opts.fetch(:path)
|
|
675
|
+
expected = validate_master_key!(stat: File.lstat(path))
|
|
676
|
+
File.open(path, File::RDONLY | File::NOFOLLOW | File::NONBLOCK) do |key|
|
|
677
|
+
actual = validate_master_key!(stat: key.stat)
|
|
678
|
+
raise MasterKeyError unless [expected.dev, expected.ino] == [actual.dev, actual.ino]
|
|
679
|
+
|
|
680
|
+
bytes = key.read(33)
|
|
681
|
+
validate_master_key!(stat: key.stat)
|
|
682
|
+
current = validate_master_key!(stat: File.lstat(path))
|
|
683
|
+
raise MasterKeyError unless bytes&.bytesize == 32 && [current.dev, current.ino] == [actual.dev, actual.ino]
|
|
684
|
+
|
|
685
|
+
bytes
|
|
625
686
|
end
|
|
626
|
-
File.binread(path)
|
|
627
687
|
end
|
|
628
688
|
|
|
629
689
|
private_class_method def self.encrypt_secret(opts = {})
|
|
@@ -631,7 +691,7 @@ module PWN
|
|
|
631
691
|
|
|
632
692
|
cipher = OpenSSL::Cipher.new('aes-256-gcm')
|
|
633
693
|
cipher.encrypt
|
|
634
|
-
cipher.key = master_key
|
|
694
|
+
cipher.key = master_key(create: true)
|
|
635
695
|
iv = cipher.random_iv
|
|
636
696
|
cipher.auth_data = 'pwn-vault'
|
|
637
697
|
ct = cipher.update(opts[:secret].to_s) + cipher.final
|
|
@@ -657,6 +717,8 @@ module PWN
|
|
|
657
717
|
cipher.auth_tag = Base64.strict_decode64(row[:tag] || row['tag'].to_s)
|
|
658
718
|
cipher.auth_data = 'pwn-vault'
|
|
659
719
|
cipher.update(Base64.strict_decode64(row[:ct] || row['ct'].to_s)) + cipher.final
|
|
720
|
+
rescue MasterKeyError
|
|
721
|
+
raise
|
|
660
722
|
rescue StandardError
|
|
661
723
|
raise if hardware || opts[:yubikey]
|
|
662
724
|
|
data/lib/pwn/plugins/vin.rb
CHANGED
|
@@ -42,7 +42,7 @@ module PWN
|
|
|
42
42
|
method: http_method,
|
|
43
43
|
url: "#{base_url}#{rest_call}",
|
|
44
44
|
headers: headers,
|
|
45
|
-
verify_ssl:
|
|
45
|
+
verify_ssl: true,
|
|
46
46
|
timeout: 5400
|
|
47
47
|
)
|
|
48
48
|
else
|
|
@@ -58,6 +58,7 @@ module PWN
|
|
|
58
58
|
puts "HTTP RESPONSE HEADERS:\n#{e.response.headers}"
|
|
59
59
|
puts "HTTP RESPONSE BODY:\n#{e.response.body.inspect}\n\n\n"
|
|
60
60
|
end
|
|
61
|
+
raise e
|
|
61
62
|
rescue StandardError => e
|
|
62
63
|
puts e.backtrace.join("\n")
|
|
63
64
|
raise e
|
data/lib/pwn/plugins/vsphere.rb
CHANGED
data/lib/pwn/plugins/xxd.rb
CHANGED
|
@@ -184,7 +184,7 @@ module PWN
|
|
|
184
184
|
if hexdump.is_a?(Hash)
|
|
185
185
|
hexdump = hexdump.map do |k, v|
|
|
186
186
|
format(
|
|
187
|
-
"%<s1>s: %<s2
|
|
187
|
+
"%<s1>s: %<s2>-40s %<s3>s\n",
|
|
188
188
|
s1: k,
|
|
189
189
|
s2: v[:hex].each_slice(2).map(&:join).join(' '),
|
|
190
190
|
s3: v[:ascii]
|
|
@@ -212,8 +212,7 @@ module PWN
|
|
|
212
212
|
chunk_file = "#{file}.#{start_chunk_addr}-#{end_chunk_addr}"
|
|
213
213
|
|
|
214
214
|
binary_data = chunk.map do |line|
|
|
215
|
-
hex_line = line.split
|
|
216
|
-
hex_line = line.split[1..-2] if hex_line.length < 8
|
|
215
|
+
hex_line = line[10, 40].to_s.split
|
|
217
216
|
hex_line.map do |hex|
|
|
218
217
|
[hex].pack('H*')
|
|
219
218
|
end.join
|
|
@@ -223,8 +222,7 @@ module PWN
|
|
|
223
222
|
end
|
|
224
223
|
else
|
|
225
224
|
binary_data = hexdump.lines.map do |line|
|
|
226
|
-
hex_line = line.split
|
|
227
|
-
hex_line = line.split[1..-2] if hex_line.length < 8
|
|
225
|
+
hex_line = line[10, 40].to_s.split
|
|
228
226
|
hex_line.map do |hex|
|
|
229
227
|
[hex].pack('H*')
|
|
230
228
|
end.join
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'openssl'
|
|
4
|
+
require 'English'
|
|
4
5
|
require 'securerandom'
|
|
5
6
|
require_relative '../protocol'
|
|
6
7
|
|
|
@@ -429,12 +430,15 @@ module PWN
|
|
|
429
430
|
def invalidate
|
|
430
431
|
return if @closed
|
|
431
432
|
|
|
433
|
+
primary = $ERROR_INFO
|
|
432
434
|
@closed = true
|
|
433
435
|
@ready = false
|
|
434
436
|
# Best effort only: Ruby/OpenSSL/GC may retain copies. No locked
|
|
435
437
|
# memory or guaranteed zeroization is claimed.
|
|
436
438
|
[@enc, @mac, @rmac, @dek, @chain].compact.each { |value| value.replace("\0".b * value.bytesize) unless value.frozen? }
|
|
437
439
|
@connection.close
|
|
440
|
+
rescue StandardError
|
|
441
|
+
raise unless primary
|
|
438
442
|
end
|
|
439
443
|
end
|
|
440
444
|
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
# rubocop:disable Lint/RescueException -- Native resource ownership must survive Interrupt/SystemExit; errors are re-raised or forwarded, never logged.
|
|
4
4
|
|
|
5
5
|
require 'securerandom'
|
|
6
|
+
require 'English'
|
|
6
7
|
|
|
7
8
|
module PWN
|
|
8
9
|
module Plugins
|
|
@@ -151,13 +152,23 @@ module PWN
|
|
|
151
152
|
end
|
|
152
153
|
current = entry[:next]
|
|
153
154
|
end
|
|
155
|
+
completed = true
|
|
154
156
|
found
|
|
155
157
|
ensure
|
|
158
|
+
primary_error = completed ? nil : $ERROR_INFO
|
|
159
|
+
cleanup_error = nil
|
|
156
160
|
begin
|
|
157
161
|
@native.library.hid_free_enumeration(pointer) if pointer && !pointer.null?
|
|
162
|
+
rescue Exception => e
|
|
163
|
+
cleanup_error = e
|
|
158
164
|
ensure
|
|
159
|
-
|
|
165
|
+
begin
|
|
166
|
+
@native.release if owned
|
|
167
|
+
rescue Exception => e
|
|
168
|
+
cleanup_error ||= e
|
|
169
|
+
end
|
|
160
170
|
end
|
|
171
|
+
raise cleanup_error if cleanup_error && !primary_error
|
|
161
172
|
end
|
|
162
173
|
|
|
163
174
|
private
|
|
@@ -200,9 +211,14 @@ module PWN
|
|
|
200
211
|
@owned = true
|
|
201
212
|
@handle = @native.library.hid_open_path(path)
|
|
202
213
|
raise CommandError, 'Cannot open selected HID device; check permissions and competing clients' if @handle.null?
|
|
203
|
-
rescue Exception
|
|
204
|
-
|
|
205
|
-
|
|
214
|
+
rescue Exception => e
|
|
215
|
+
begin
|
|
216
|
+
close
|
|
217
|
+
rescue Exception
|
|
218
|
+
# Acquisition failed; release errors must not hide that failure.
|
|
219
|
+
nil
|
|
220
|
+
end
|
|
221
|
+
raise e
|
|
206
222
|
end
|
|
207
223
|
|
|
208
224
|
def write_packet(bytes)
|
|
@@ -288,7 +304,12 @@ module PWN
|
|
|
288
304
|
|
|
289
305
|
text.split("\0").map { |reader| { backend: :pcsc, protocol: :apdu, reader: reader, serial: nil } }
|
|
290
306
|
ensure
|
|
291
|
-
|
|
307
|
+
primary = $ERROR_INFO
|
|
308
|
+
begin
|
|
309
|
+
check(@native.library.SCardReleaseContext(context)) if context
|
|
310
|
+
rescue StandardError
|
|
311
|
+
raise unless primary
|
|
312
|
+
end
|
|
292
313
|
end
|
|
293
314
|
|
|
294
315
|
private
|
|
@@ -312,9 +333,14 @@ module PWN
|
|
|
312
333
|
@handle = handle.read(native.handle_type)
|
|
313
334
|
@protocol = active.read(native.dword)
|
|
314
335
|
raise ResponseError, 'PC/SC negotiated neither T=0 nor T=1' unless native.pci.key?(@protocol)
|
|
315
|
-
rescue Exception
|
|
316
|
-
|
|
317
|
-
|
|
336
|
+
rescue Exception => e
|
|
337
|
+
begin
|
|
338
|
+
close
|
|
339
|
+
rescue Exception
|
|
340
|
+
# Acquisition failed; release errors must not hide that failure.
|
|
341
|
+
nil
|
|
342
|
+
end
|
|
343
|
+
raise e
|
|
318
344
|
end
|
|
319
345
|
|
|
320
346
|
def metadata
|
|
@@ -691,9 +717,14 @@ module PWN
|
|
|
691
717
|
end
|
|
692
718
|
begin
|
|
693
719
|
task.await
|
|
694
|
-
rescue Exception
|
|
695
|
-
|
|
696
|
-
|
|
720
|
+
rescue Exception => e
|
|
721
|
+
begin
|
|
722
|
+
close
|
|
723
|
+
rescue Exception
|
|
724
|
+
# Keep the operation failure, including cancellation, authoritative.
|
|
725
|
+
nil
|
|
726
|
+
end
|
|
727
|
+
raise e
|
|
697
728
|
ensure
|
|
698
729
|
@state.synchronize { @active = false }
|
|
699
730
|
end
|
data/lib/pwn/plugins/yubikey.rb
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require 'io/console'
|
|
4
4
|
require 'fcntl'
|
|
5
|
+
require 'English'
|
|
5
6
|
require 'timeout'
|
|
6
7
|
|
|
7
8
|
module PWN
|
|
@@ -176,7 +177,7 @@ module PWN
|
|
|
176
177
|
'otp' => %i[key password access_code new_access_code private_id public_id generate generate_key generate_private_id secret_sink touch totp digits counter identifier key_encoding keyboard_layout length prefix ndef_type config_output enter no_enter serial_public_id delete_access_code use_numeric_keypad serial_usb_visible pacing verification_challenge challenge timestamp],
|
|
177
178
|
'config' => %i[lock_code new_lock_code secret_sink reconnect enable disable enable_all disable_all touch_eject no_touch_eject autoeject_timeout chalresp_timeout restrict clear generate reboot list mode],
|
|
178
179
|
'oath' => %i[password new_password access_key new_access_key timestamp encrypted_cache remember use_cache secret secret_base32 uri credentials pskc pskc_password pskc_key oath_type algorithm digits period counter issuer touch generate overwrite],
|
|
179
|
-
'hsmauth' => %i[management_key new_management_key new_management_password credential_password new_credential_password password derivation_password key_enc key_mac private_key key_password public_key touch generate],
|
|
180
|
+
'hsmauth' => %i[management_key management_password auth_method new_management_key new_management_password credential_password new_credential_password password derivation_password key_enc key_mac private_key key_password public_key touch generate],
|
|
180
181
|
'piv' => %i[pin new_pin puk new_puk management_key new_management_key management_algorithm algorithm input password certificate_serial extensions fips_restrictions secret_sink generate protect touch pin_policy touch_policy use_protected_key temporary_pin request_temporary_pin block_retries subject valid_days hash_algorithm not_before not_after compress update_chuid no_update_chuid verify format public_key_source],
|
|
181
182
|
'fido' => %i[pin new_pin u2f uv rp_ids min_length on_keepalive cancelled on_sample max_records max_samples capture_timeout_ms],
|
|
182
183
|
'openpgp' => %i[pin new_pin admin_pin new_admin_pin reset_code new_reset_code use_admin key key_password certificate],
|
|
@@ -531,7 +532,11 @@ module PWN
|
|
|
531
532
|
#{self}.openpgp(args: 'optional - argv after the family name')
|
|
532
533
|
|
|
533
534
|
# Dispatch an hsmauth leaf through the native HSM Auth application.
|
|
534
|
-
#{self}.hsmauth(
|
|
535
|
+
#{self}.hsmauth(
|
|
536
|
+
args: 'optional - argv after the family name',
|
|
537
|
+
management_password: 'optional - explicit in-memory HSM Auth management password instead of management_key',
|
|
538
|
+
auth_method: 'optional - credential or management Symbol selecting password-change authentication'
|
|
539
|
+
)
|
|
535
540
|
|
|
536
541
|
# Dispatch a security_domain leaf through the native Security Domain application.
|
|
537
542
|
#{self}.security_domain(args: 'optional - argv after the family name')
|
|
@@ -701,6 +706,13 @@ module PWN
|
|
|
701
706
|
@owned = @connection.nil?
|
|
702
707
|
@selection = opts.slice(*SELECTOR_OPTIONS).merge(application: opts[:application])
|
|
703
708
|
@deadline = deadline
|
|
709
|
+
selectors = @selection.slice(:serial, :reader, :device_path).compact
|
|
710
|
+
return if @owned || selectors.empty?
|
|
711
|
+
|
|
712
|
+
descriptor = @connection.respond_to?(:descriptor) ? @connection.descriptor : nil
|
|
713
|
+
return if descriptor.is_a?(Hash) && selectors.all? { |name, value| descriptor[name] == value }
|
|
714
|
+
|
|
715
|
+
raise ArgumentError, 'Explicit selector does not match the supplied connection descriptor'
|
|
704
716
|
end
|
|
705
717
|
|
|
706
718
|
def acquire
|
|
@@ -767,11 +779,14 @@ module PWN
|
|
|
767
779
|
rescue IOError, SystemCallError
|
|
768
780
|
raise CommandError, 'Native YubiKey I/O failed; inspect device state before retrying', cause: nil
|
|
769
781
|
ensure
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
782
|
+
primary = $ERROR_INFO
|
|
783
|
+
cleanup_error = nil
|
|
784
|
+
[[wrapped, :close], [lease, :release]].each do |handle, method|
|
|
785
|
+
handle.public_send(method) if handle
|
|
786
|
+
rescue StandardError => e
|
|
787
|
+
cleanup_error ||= e
|
|
774
788
|
end
|
|
789
|
+
raise cleanup_error if cleanup_error && !primary
|
|
775
790
|
end
|
|
776
791
|
|
|
777
792
|
private_class_method def self.read_only?(opts = {})
|
data/lib/pwn/plugins/zaproxy.rb
CHANGED
|
@@ -66,7 +66,7 @@ module PWN
|
|
|
66
66
|
|
|
67
67
|
response
|
|
68
68
|
rescue StandardError, SystemExit, Interrupt => e
|
|
69
|
-
stop(zap_obj: zap_obj) unless zap_obj.nil?
|
|
69
|
+
stop(zap_obj: zap_obj) unless zap_obj.nil? || skip_stop
|
|
70
70
|
raise e
|
|
71
71
|
end
|
|
72
72
|
|
|
@@ -162,8 +162,7 @@ module PWN
|
|
|
162
162
|
openapi_spec = opts[:openapi_spec]
|
|
163
163
|
raise "ERROR: openapi_spec file #{openapi_spec} does not exist" unless File.exist?(openapi_spec)
|
|
164
164
|
|
|
165
|
-
|
|
166
|
-
Dir.chdir(openapi_spec_root)
|
|
165
|
+
openapi_spec = File.expand_path(openapi_spec)
|
|
167
166
|
|
|
168
167
|
additional_http_headers = opts[:additional_http_headers] ||= {}
|
|
169
168
|
raise 'ERROR: additional_http_headers must be a Hash' unless additional_http_headers.is_a?(Hash)
|
|
@@ -232,7 +231,7 @@ module PWN
|
|
|
232
231
|
end
|
|
233
232
|
|
|
234
233
|
if keyword
|
|
235
|
-
entries =
|
|
234
|
+
entries = entries.select do |site|
|
|
236
235
|
json_request = site[:request].to_json
|
|
237
236
|
json_request.include?(keyword)
|
|
238
237
|
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'json'
|
|
4
|
+
require 'uri'
|
|
4
5
|
|
|
5
6
|
module PWN
|
|
6
7
|
module Reports
|
|
@@ -18,12 +19,11 @@ module PWN
|
|
|
18
19
|
|
|
19
20
|
public_class_method def self.generate(opts = {})
|
|
20
21
|
dir_path = opts[:dir_path] ||= '.'
|
|
22
|
+
report_name = opts[:report_name] ||= File.basename(Dir.pwd)
|
|
21
23
|
results_hash = opts[:results_hash] ||= {
|
|
22
|
-
report_name:
|
|
24
|
+
report_name: report_name.to_s,
|
|
23
25
|
data: []
|
|
24
26
|
}
|
|
25
|
-
|
|
26
|
-
report_name = opts[:report_name] ||= File.basename(Dir.pwd)
|
|
27
27
|
File.write(
|
|
28
28
|
"#{dir_path}/#{report_name}.json",
|
|
29
29
|
::JSON.pretty_generate(results_hash)
|
|
@@ -64,7 +64,7 @@ module PWN
|
|
|
64
64
|
oldStart = info.start;
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
|
-
"ajax": "#{report_name}.json",
|
|
67
|
+
"ajax": #{::JSON.generate(URI.encode_www_form_component("#{report_name}.json").gsub('+', '%20'))},
|
|
68
68
|
"deferRender": false,
|
|
69
69
|
"layout": {
|
|
70
70
|
},
|
data/lib/pwn/reports/pdf.rb
CHANGED
|
@@ -31,14 +31,18 @@ module PWN
|
|
|
31
31
|
end
|
|
32
32
|
lines << ''
|
|
33
33
|
end
|
|
34
|
-
|
|
34
|
+
pages = lines.each_slice(46).to_a
|
|
35
|
+
page_ids = pages.each_index.map { |index| 4 + (index * 2) }
|
|
35
36
|
objects = [
|
|
36
37
|
'<< /Type /Catalog /Pages 2 0 R >>',
|
|
37
|
-
|
|
38
|
-
'<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents 4 0 R /Resources << /Font << /F1 5 0 R >> >> >>',
|
|
39
|
-
"<< /Length #{content.bytesize} >>\nstream\n#{content}\nendstream",
|
|
38
|
+
"<< /Type /Pages /Kids [#{page_ids.map { |id| "#{id} 0 R" }.join(' ')}] /Count #{pages.length} >>",
|
|
40
39
|
'<< /Type /Font /Subtype /Type1 /BaseFont /Helvetica >>'
|
|
41
40
|
]
|
|
41
|
+
pages.each_with_index do |page, index|
|
|
42
|
+
content = pdf_stream(lines: page)
|
|
43
|
+
objects << "<< /Type /Page /Parent 2 0 R /MediaBox [0 0 612 792] /Contents #{page_ids[index] + 1} 0 R /Resources << /Font << /F1 3 0 R >> >> >>"
|
|
44
|
+
objects << "<< /Length #{content.bytesize} >>\nstream\n#{content}\nendstream"
|
|
45
|
+
end
|
|
42
46
|
assemble_pdf(objects: objects)
|
|
43
47
|
end
|
|
44
48
|
|
|
@@ -54,7 +58,7 @@ module PWN
|
|
|
54
58
|
end
|
|
55
59
|
|
|
56
60
|
private_class_method def self.pdf_escape(opts = {})
|
|
57
|
-
opts[:text].to_s.encode('UTF-8', invalid: :replace, undef: :replace).gsub(
|
|
61
|
+
opts[:text].to_s.encode('UTF-8', invalid: :replace, undef: :replace).gsub(/[\\()]/) { |char| "\\#{char}" }
|
|
58
62
|
end
|
|
59
63
|
|
|
60
64
|
private_class_method def self.wrap_line(opts = {})
|
data/lib/pwn/reports/sast.rb
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'json'
|
|
4
|
+
require 'uri'
|
|
4
5
|
|
|
5
6
|
module PWN
|
|
6
7
|
module Reports
|
|
@@ -18,12 +19,11 @@ module PWN
|
|
|
18
19
|
|
|
19
20
|
public_class_method def self.generate(opts = {})
|
|
20
21
|
dir_path = opts[:dir_path] ||= '.'
|
|
22
|
+
report_name = opts[:report_name] ||= File.basename(Dir.pwd)
|
|
21
23
|
results_hash = opts[:results_hash] ||= {
|
|
22
|
-
report_name:
|
|
24
|
+
report_name: report_name.to_s,
|
|
23
25
|
data: []
|
|
24
26
|
}
|
|
25
|
-
|
|
26
|
-
report_name = opts[:report_name] ||= File.basename(Dir.pwd)
|
|
27
27
|
File.write(
|
|
28
28
|
"#{dir_path}/#{report_name}.json",
|
|
29
29
|
::JSON.pretty_generate(results_hash)
|
|
@@ -64,7 +64,7 @@ module PWN
|
|
|
64
64
|
oldStart = info.start;
|
|
65
65
|
}
|
|
66
66
|
},
|
|
67
|
-
"ajax": "#{report_name}.json",
|
|
67
|
+
"ajax": #{::JSON.generate(URI.encode_www_form_component("#{report_name}.json").gsub('+', '%20'))},
|
|
68
68
|
"deferRender": false,
|
|
69
69
|
"layout": {
|
|
70
70
|
},
|
data/lib/pwn/sast/keystore.rb
CHANGED
|
@@ -30,7 +30,7 @@ module PWN
|
|
|
30
30
|
git_repo_root_uri: git_repo_root_uri
|
|
31
31
|
)
|
|
32
32
|
rescue StandardError => e
|
|
33
|
-
raise e
|
|
33
|
+
raise e
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
# Used primarily to map NIST 800-53 Revision 4 Security Controls
|
|
@@ -47,7 +47,7 @@ module PWN
|
|
|
47
47
|
cwe_uri: 'https://cwe.mitre.org/data/definitions/522.html'
|
|
48
48
|
}
|
|
49
49
|
rescue StandardError => e
|
|
50
|
-
raise e
|
|
50
|
+
raise e
|
|
51
51
|
end
|
|
52
52
|
|
|
53
53
|
# Author(s):: 0day Inc. <support@0dayinc.com>
|