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
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'tmpdir'
|
|
5
|
+
|
|
6
|
+
RSpec.describe PWN::Plugins::BareSIP do
|
|
7
|
+
around do |example|
|
|
8
|
+
Dir.mktmpdir('baresip-audit-') do |root|
|
|
9
|
+
@root = root
|
|
10
|
+
File.write(File.join(root, 'config'), "http_listen 127.0.0.1:12345\ncall_max_calls 1\n")
|
|
11
|
+
example.run
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
before do
|
|
16
|
+
allow(PWN::Plugins::Sock).to receive(:get_random_unused_port).and_return(12_345)
|
|
17
|
+
allow(described_class).to receive(:system).and_return(true)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
['403 Forbidden', 'account: No SIP accounts found'].each do |failure|
|
|
21
|
+
it "terminates startup on fresh #{failure} alone" do
|
|
22
|
+
allow(described_class).to receive(:system) do |*args|
|
|
23
|
+
File.open(args[args.index('-Logfile') + 1], 'a') { |file| file.puts(failure) } if args.include?('-Logfile')
|
|
24
|
+
true
|
|
25
|
+
end
|
|
26
|
+
expect { described_class.start(config_root: @root, session_root: @root) }.to raise_error(/#{Regexp.escape(failure)}/)
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
[RuntimeError, Interrupt].each do |error|
|
|
31
|
+
it "stops only the launched session when startup raises #{error}" do
|
|
32
|
+
log = File.join(@root, 'screenlog.txt')
|
|
33
|
+
allow(File).to receive(:stat).and_call_original
|
|
34
|
+
allow(File).to receive(:stat).with(log).and_raise(error, 'fixture startup interruption')
|
|
35
|
+
expect { described_class.start(config_root: @root, session_root: @root, screen_session: 'fixture-session') }.to raise_error(error, 'fixture startup interruption')
|
|
36
|
+
expect(described_class).to have_received(:system).with('screen', '-S', 'fixture-session', '-X', 'quit').once
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
it 'uses the current working directory as the default session root' do
|
|
41
|
+
log = File.join(@root, 'screenlog.txt')
|
|
42
|
+
allow(described_class).to receive(:system) do |*args|
|
|
43
|
+
File.open(log, 'a') { |file| file.puts('registered successfully') } if args.include?('-Logfile')
|
|
44
|
+
true
|
|
45
|
+
end
|
|
46
|
+
Dir.chdir(@root) do
|
|
47
|
+
expect(described_class.start(config_root: @root, screenlog_path: log)[:session_root]).to eq(@root)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it 'does not wait for registration when launching screen fails' do
|
|
52
|
+
allow(described_class).to receive(:system).and_return(false)
|
|
53
|
+
expect { described_class.start(config_root: @root, session_root: @root) }.to raise_error(/Failed to launch/)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it 'bounds missing registration logs with an explicit startup deadline' do
|
|
57
|
+
expect { described_class.start(config_root: @root, session_root: @root, timeout: 0.05) }.to raise_error(Timeout::Error, /timed out/)
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'tmpdir'
|
|
5
|
+
require 'shellwords'
|
|
6
|
+
|
|
7
|
+
RSpec.describe PWN::Plugins::BinaryAnalysis, 'subprocess ownership' do
|
|
8
|
+
it '[PBR-02] kills a same-group child after the leader exits without touching another group' do
|
|
9
|
+
Dir.mktmpdir('binary-owner-') do |dir|
|
|
10
|
+
# The separate test process adopts/reaps its own orphan, never global suite children.
|
|
11
|
+
probe = <<~'RUBY'
|
|
12
|
+
require 'ffi'
|
|
13
|
+
require 'json'
|
|
14
|
+
require 'shellwords'
|
|
15
|
+
require 'pwn/plugins/binary_analysis'
|
|
16
|
+
native = Module.new do
|
|
17
|
+
extend FFI::Library
|
|
18
|
+
ffi_lib FFI::Library::LIBC
|
|
19
|
+
attach_function :prctl, [:int, :ulong, :ulong, :ulong, :ulong], :int
|
|
20
|
+
end
|
|
21
|
+
abort 'subreaper setup failed' unless native.prctl(36, 1, 0, 0, 0).zero?
|
|
22
|
+
unrelated = Process.spawn('/bin/sleep', '10', pgroup: true)
|
|
23
|
+
at_exit do
|
|
24
|
+
Process.kill('KILL', unrelated)
|
|
25
|
+
Process.waitpid(unrelated)
|
|
26
|
+
Process.waitpid(-1) while true
|
|
27
|
+
rescue Errno::ECHILD
|
|
28
|
+
nil
|
|
29
|
+
end
|
|
30
|
+
marker, pidfile = ARGV
|
|
31
|
+
command = "(/bin/sleep 1; printf late > #{Shellwords.escape(marker)}) & printf '%s' $! > #{Shellwords.escape(pidfile)}; exit 7"
|
|
32
|
+
started = Process.clock_gettime(Process::CLOCK_MONOTONIC)
|
|
33
|
+
begin
|
|
34
|
+
PWN::Plugins::BinaryAnalysis.run(argv: ['/bin/sh', '-c', command], timeout: 0.3)
|
|
35
|
+
error = nil
|
|
36
|
+
rescue StandardError => e
|
|
37
|
+
error = e.class.name
|
|
38
|
+
end
|
|
39
|
+
elapsed = Process.clock_gettime(Process::CLOCK_MONOTONIC) - started
|
|
40
|
+
_, status = Process.wait2(Integer(File.read(pidfile)))
|
|
41
|
+
puts JSON.generate(error: error, signal: status.termsig, elapsed: elapsed, late: File.exist?(marker), unrelated: Process.kill(0, unrelated))
|
|
42
|
+
|
|
43
|
+
RUBY
|
|
44
|
+
out, err, status = Open3.capture3(RbConfig.ruby, '-I', File.expand_path('../../../../lib', __dir__), '-e', probe, File.join(dir, 'late'), File.join(dir, 'pid'))
|
|
45
|
+
expect(status.success?).to be(true), err
|
|
46
|
+
row = JSON.parse(out)
|
|
47
|
+
expect(row).to include('error' => 'Timeout::Error', 'signal' => 9, 'late' => false, 'unrelated' => 1)
|
|
48
|
+
expect(row['elapsed']).to be_between(0.25, 0.9)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it 'preserves successful output, failed status and output-limit errors' do
|
|
53
|
+
expect(described_class.run(argv: ['/bin/sh', '-c', 'printf success'], timeout: 1)).to eq('success')
|
|
54
|
+
expect { described_class.run(argv: ['/bin/sh', '-c', 'printf failure; exit 7'], timeout: 1) }.to raise_error(RuntimeError, /backend exited 7: failure/)
|
|
55
|
+
expect { described_class.run(argv: ['/bin/sh', '-c', 'printf excessive; sleep 1'], limit: 3, timeout: 1) }.to raise_error(RuntimeError, /output limit/)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'rest-client'
|
|
5
|
+
|
|
6
|
+
RSpec.describe PWN::Plugins::BlackDuckBinaryAnalysis, 'upload flags regression' do
|
|
7
|
+
before do
|
|
8
|
+
allow(PWN::Plugins::TransparentBrowser).to receive(:open).and_return(browser: RestClient)
|
|
9
|
+
allow(PWN::Plugins::TTYSpinner).to receive_messages(start: nil, stop: nil)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
[{}, { scan_infoleak: true, code_analysis: false, scan_code_familiarity: true }].each do |flags|
|
|
13
|
+
it "forwards the documented scan flags for #{flags.inspect}" do
|
|
14
|
+
Tempfile.create('bdba-audit') do |file|
|
|
15
|
+
file.write('offline fixture')
|
|
16
|
+
file.flush
|
|
17
|
+
expect(RestClient::Request).to receive(:execute) do |request|
|
|
18
|
+
expect(request[:headers]).to include({ scan_infoleak: true, code_analysis: true, scan_code_familiarity: false }.merge(flags))
|
|
19
|
+
'{}'
|
|
20
|
+
end
|
|
21
|
+
described_class.upload_file(file: file.path, token: 'fixture-token', **flags)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'rest-client'
|
|
5
|
+
require 'tmpdir'
|
|
6
|
+
|
|
7
|
+
RSpec.describe PWN::Plugins::BurpSuite, 'review HAR authority regressions' do
|
|
8
|
+
let(:burp) { { rest_browser: RestClient, mitm_rest_api: 'burp.invalid' } }
|
|
9
|
+
|
|
10
|
+
def capture_rest(entries)
|
|
11
|
+
allow(RestClient::Request).to receive(:execute) do |request|
|
|
12
|
+
expect(request[:url]).to eq('http://burp.invalid/sitemap')
|
|
13
|
+
expect(request[:method]).to eq(:post)
|
|
14
|
+
entries << JSON.parse(request.fetch(:payload), symbolize_names: true)
|
|
15
|
+
RestClient::Response.create('{}', Net::HTTPResponse.new('1.1', '200', 'OK'),
|
|
16
|
+
RestClient::Request.new(method: :post, url: 'http://burp.invalid/sitemap'))
|
|
17
|
+
end
|
|
18
|
+
allow(RestClient).to receive(:get) do |url, _headers|
|
|
19
|
+
expect(url).to match(%r{\Ahttp://burp\.invalid/(sitemap|proxy/history)\?})
|
|
20
|
+
JSON.generate(entries)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
['https://example.invalid:8443', 'https://[2001:db8::1]:8443', 'https://example.invalid', 'http://example.invalid:8080'].each do |server|
|
|
25
|
+
%i[get_sitemap get_proxy_history].each do |exporter|
|
|
26
|
+
it "PSR-L08 retains #{server} through actual import and #{exporter} HAR export" do
|
|
27
|
+
Dir.mktmpdir('burp-har-roundtrip') do |dir|
|
|
28
|
+
path = File.join(dir, 'api.json')
|
|
29
|
+
File.write(path, JSON.generate(openapi: '3.0.3', servers: [{ url: server }],
|
|
30
|
+
paths: { '/probe' => { get: { responses: { '200' => { description: 'OK' } } } } }))
|
|
31
|
+
entries = []
|
|
32
|
+
capture_rest(entries)
|
|
33
|
+
result = described_class.import_openapi_to_sitemap(burp_obj: burp, openapi_spec: path)
|
|
34
|
+
expect(result).to eq(entries)
|
|
35
|
+
expect(result.length).to eq(1)
|
|
36
|
+
exported = described_class.public_send(exporter, burp_obj: burp, return_as: :har)
|
|
37
|
+
expect(exported.dig(:log, :entries, 0, :request, :url)).to eq("#{server}/probe")
|
|
38
|
+
expect(Base64.strict_decode64(entries.first[:request])).to include("Host: #{server.split('://').last}\r\n")
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
%i[get_sitemap get_proxy_history].each do |exporter|
|
|
45
|
+
[
|
|
46
|
+
['example.invalid', 8443, 'example.invalid:8443'],
|
|
47
|
+
['[2001:db8::1]', 8443, '[2001:db8::1]:8443'],
|
|
48
|
+
['example.invalid:9443', 8443, 'example.invalid:9443'],
|
|
49
|
+
['example.invalid', nil, 'example.invalid']
|
|
50
|
+
].each do |host, service_port, expected|
|
|
51
|
+
it "PSR-L08 preserves captured authority #{host}/#{service_port.inspect} via #{exporter}" do
|
|
52
|
+
entries = [{ request: Base64.strict_encode64("GET /probe?q=1 HTTP/1.1\r\nHost: #{host}\r\n\r\n"),
|
|
53
|
+
http_service: { host: 'example.invalid', port: service_port, protocol: 'https' } }]
|
|
54
|
+
capture_rest(entries)
|
|
55
|
+
exported = described_class.public_send(exporter, burp_obj: burp, return_as: :har)
|
|
56
|
+
expect(exported.dig(:log, :entries, 0, :request, :url)).to eq("https://#{expected}/probe?q=1")
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
end
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'rest-client'
|
|
5
|
+
require 'tmpdir'
|
|
6
|
+
|
|
7
|
+
RSpec.describe PWN::Plugins::BurpSuite, 'review import delivery regressions' do
|
|
8
|
+
def response(body, code = 200)
|
|
9
|
+
RestClient::Response.create(body, Net::HTTPResponse.new('1.1', code.to_s, 'Fixture'),
|
|
10
|
+
RestClient::Request.new(method: :post, url: 'http://burp.invalid/sitemap'))
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def with_spec
|
|
14
|
+
Dir.mktmpdir('burp-import-review') do |dir|
|
|
15
|
+
path = File.join(dir, 'api.json')
|
|
16
|
+
paths = %w[/one /two /three].to_h { |endpoint| [endpoint, { get: { responses: { '200' => { description: 'OK' } } } }] }
|
|
17
|
+
File.write(path, JSON.generate(openapi: '3.0.3', servers: [{ url: 'https://example.invalid' }], paths: paths))
|
|
18
|
+
yield path, { rest_browser: RestClient, mitm_rest_api: 'burp.invalid' }
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
[1, 2].each do |failure_at|
|
|
23
|
+
it "PSR-L07 propagates insertion failure at entry #{failure_at} without returning generated entries as successful" do
|
|
24
|
+
with_spec do |path, burp|
|
|
25
|
+
calls = []
|
|
26
|
+
error = RestClient::BadRequest.new(response('{"error":"rejected"}', 400))
|
|
27
|
+
allow(RestClient::Request).to receive(:execute) do |request|
|
|
28
|
+
expect(request[:url]).to eq('http://burp.invalid/sitemap')
|
|
29
|
+
expect(request[:method]).to eq(:post)
|
|
30
|
+
calls << JSON.parse(request[:payload], symbolize_names: true)
|
|
31
|
+
raise error if calls.length == failure_at
|
|
32
|
+
|
|
33
|
+
response('{}')
|
|
34
|
+
end
|
|
35
|
+
expect do
|
|
36
|
+
described_class.import_openapi_to_sitemap(burp_obj: burp, openapi_spec: path)
|
|
37
|
+
end.to(raise_error { |raised| expect(raised).to equal(error) })
|
|
38
|
+
expect(calls.length).to eq(failure_at)
|
|
39
|
+
expect(calls.map { |entry| Base64.strict_decode64(entry[:request]).lines.first.strip })
|
|
40
|
+
.to eq(['GET /one HTTP/1.1', 'GET /two HTTP/1.1'].first(failure_at))
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it 'preserves the successful array return and actual sitemap readback without changing cwd' do
|
|
46
|
+
with_spec do |path, burp|
|
|
47
|
+
entries = []
|
|
48
|
+
allow(RestClient::Request).to receive(:execute) do |request|
|
|
49
|
+
expect(request[:url]).to eq('http://burp.invalid/sitemap')
|
|
50
|
+
entries << JSON.parse(request[:payload], symbolize_names: true)
|
|
51
|
+
response('{}')
|
|
52
|
+
end
|
|
53
|
+
allow(RestClient).to receive(:get).with('http://burp.invalid/sitemap?limit=200&offset=0&highlight=NONE', anything) { JSON.generate(entries) }
|
|
54
|
+
cwd = Dir.pwd
|
|
55
|
+
result = described_class.import_openapi_to_sitemap(burp_obj: burp, openapi_spec: path)
|
|
56
|
+
expect(result).to eq(entries)
|
|
57
|
+
expect(result.length).to eq(3)
|
|
58
|
+
expect(described_class.get_sitemap(burp_obj: burp)).to eq(result)
|
|
59
|
+
expect(Dir.pwd).to eq(cwd)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'rest-client'
|
|
5
|
+
|
|
6
|
+
RSpec.describe PWN::Plugins::BurpSuite, 'namespace audit regressions' do
|
|
7
|
+
let(:browser) { double('offline Burp REST browser') }
|
|
8
|
+
let(:burp) { { rest_browser: browser, mitm_rest_api: 'burp.invalid' } }
|
|
9
|
+
|
|
10
|
+
before { allow(described_class).to receive(:stop) }
|
|
11
|
+
|
|
12
|
+
%i[get_sitemap get_proxy_history].each do |method|
|
|
13
|
+
it "returns a HAR object from #{method}" do
|
|
14
|
+
entry = { request: Base64.strict_encode64("GET /items HTTP/1.1\r\nHost: example.invalid\r\n\r\n"), http_service: { protocol: 'https' } }
|
|
15
|
+
allow(browser).to receive(:get).and_return([entry].to_json)
|
|
16
|
+
result = described_class.public_send(method, burp_obj: burp, return_as: :har)
|
|
17
|
+
expect(result).to be_a(Hash)
|
|
18
|
+
expect(result.dig(:log, :entries).length).to eq(1)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "preserves HTTPS in HAR from #{method}" do
|
|
22
|
+
entry = { request: Base64.strict_encode64("GET /items HTTP/1.1\r\nHost: example.invalid\r\n\r\n"), http_service: { protocol: 'https' } }
|
|
23
|
+
allow(browser).to receive(:get).and_return([entry].to_json)
|
|
24
|
+
result = described_class.public_send(method, burp_obj: burp, return_as: :har)
|
|
25
|
+
expect(result.dig(:log, :entries, 0, :request, :url)).to eq('https://example.invalid/items')
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it 'honors enabled false when updating an enabled proxy listener' do
|
|
30
|
+
allow(browser).to receive(:get).and_return([{ id: '0', enabled: true, port: 8080, bindAddress: '127.0.0.1' }].to_json)
|
|
31
|
+
expect(browser).to receive(:put) do |_url, body, _headers|
|
|
32
|
+
expect(JSON.parse(body)['enabled']).to be(false)
|
|
33
|
+
body
|
|
34
|
+
end
|
|
35
|
+
described_class.update_proxy_listener(burp_obj: burp, enabled: false)
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe PWN::Plugins::BusPirate do
|
|
6
|
+
it 'preserves a serial acquisition failure instead of masking it with an undefined local' do
|
|
7
|
+
allow(PWN::Plugins::Serial).to receive(:connect).and_raise(IOError, 'fixture acquisition failed')
|
|
8
|
+
expect { described_class.connect(block_dev: '/fixture/missing') }.to raise_error(IOError, 'fixture acquisition failed')
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'rejects an unavailable explicit screen device without opening the default device' do
|
|
12
|
+
allow(File).to receive(:exist?).and_call_original
|
|
13
|
+
allow(File).to receive(:exist?).with('/fixture/missing').and_return(false)
|
|
14
|
+
allow(File).to receive(:exist?).with('/usr/bin/screen').and_return(true)
|
|
15
|
+
allow(described_class).to receive(:system)
|
|
16
|
+
expect { described_class.connect_via_screen(block_dev: '/fixture/missing') }.to raise_error(ArgumentError, /block device/)
|
|
17
|
+
expect(described_class).not_to have_received(:system)
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'tempfile'
|
|
5
|
+
|
|
6
|
+
RSpec.describe PWN::Plugins::FileFu, 'namespace audit regressions' do
|
|
7
|
+
[3, 4].each do |length|
|
|
8
|
+
it "truncates the file when removing #{length} bytes from a three-byte file" do
|
|
9
|
+
Tempfile.create('file-fu-audit') do |file|
|
|
10
|
+
file.write('abc')
|
|
11
|
+
file.flush
|
|
12
|
+
described_class.shift_file_up(path: file.path, bytes: length)
|
|
13
|
+
expect(File.binread(file.path)).to eq('')
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
end
|
|
@@ -18,7 +18,7 @@ RSpec.describe PWN::Plugins::Findings do
|
|
|
18
18
|
let(:finding) do
|
|
19
19
|
{ title: 'Fixture exposure', cwe: 'CWE-200', cvss_vector: 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:N',
|
|
20
20
|
cvss_score: 5.3, affected_asset: 'asset-fixture', evidence_paths: [@evidence],
|
|
21
|
-
poc: '
|
|
21
|
+
poc: 'printf fixture', attack_chain_refs: [], remediation: 'Restrict fixture access.', confidence: 0.9,
|
|
22
22
|
engagement_id: 'fixture' }
|
|
23
23
|
end
|
|
24
24
|
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe PWN::Plugins::GDBMI, 'stop record regression' do
|
|
6
|
+
it 'does not report a signal when the inferior exits normally' do
|
|
7
|
+
allow(described_class).to receive(:mi).and_return("^done\n*stopped,reason=\"exited-normally\"\n(gdb)\n")
|
|
8
|
+
result = described_class.run_to_crash(session: 'offline')
|
|
9
|
+
expect(result).to include(signal: nil, exploitability: 'none')
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
it 'uses the signal and PC from the execution stop instead of inventing SIGSEGV' do
|
|
13
|
+
allow(described_class).to receive(:mi) do |opts|
|
|
14
|
+
case opts[:cmd]
|
|
15
|
+
when '-exec-run'
|
|
16
|
+
"^running\n*stopped,reason=\"signal-received\",signal-name=\"SIGABRT\",frame={addr=\"0x1000\"}\n(gdb)\n"
|
|
17
|
+
when '-data-list-register-values x'
|
|
18
|
+
"^done,register-values=[]\n(gdb)\n"
|
|
19
|
+
when '-stack-list-frames'
|
|
20
|
+
"^done,stack=[frame={level=\"0\",addr=\"0x1000\",func=\"abort\"}]\n(gdb)\n"
|
|
21
|
+
else
|
|
22
|
+
"^error,msg=\"not available\"\n(gdb)\n"
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
result = described_class.run_to_crash(session: 'offline')
|
|
26
|
+
expect(result).to include(signal: 'SIGABRT', pc: '0x1000', exploitability: 'abort')
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'timeout'
|
|
5
|
+
|
|
6
|
+
RSpec.describe PWN::Plugins::GDBMI, 'review execution outcome regressions' do
|
|
7
|
+
def with_mi_peer(execution)
|
|
8
|
+
request_r, request_w = IO.pipe
|
|
9
|
+
response_r, response_w = IO.pipe
|
|
10
|
+
commands = []
|
|
11
|
+
peer = Thread.new do
|
|
12
|
+
response_w.write("(gdb)\n")
|
|
13
|
+
while (line = request_r.gets)
|
|
14
|
+
command = line.strip
|
|
15
|
+
commands << command
|
|
16
|
+
break if command == '-gdb-exit'
|
|
17
|
+
|
|
18
|
+
response_w.write(command == '-exec-run' ? "#{execution}\n(gdb)\n" : "^done\n(gdb)\n")
|
|
19
|
+
end
|
|
20
|
+
ensure
|
|
21
|
+
response_w.close unless response_w.closed?
|
|
22
|
+
request_r.close unless request_r.closed?
|
|
23
|
+
end
|
|
24
|
+
allow(Open3).to receive(:popen2).and_return([request_w, response_r, peer])
|
|
25
|
+
allow(PWN::Plugins::PreflightChecker).to receive(:bin?).with(name: 'gdb').and_return(true)
|
|
26
|
+
Timeout.timeout(2) { yield commands }
|
|
27
|
+
expect(peer.join(1)).to eq(peer)
|
|
28
|
+
expect(commands.last).to eq('-gdb-exit')
|
|
29
|
+
expect(request_w).to be_closed
|
|
30
|
+
expect(response_r).to be_closed
|
|
31
|
+
ensure
|
|
32
|
+
request_w&.close unless request_w&.closed?
|
|
33
|
+
peer&.join(1)
|
|
34
|
+
peer&.kill&.join if peer&.alive?
|
|
35
|
+
[request_r, response_r, response_w].compact.each { |io| io.close unless io.closed? }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
['^error,msg="fixture could not execute"', "^running\n^error,msg=\"fixture could not execute\""].each do |execution|
|
|
39
|
+
it "PSR-L05 propagates failed execution including actionable MI details #{execution.inspect}" do
|
|
40
|
+
with_mi_peer(execution) do |commands|
|
|
41
|
+
expect { described_class.run_to_crash(binary: '/fixture/offline') }
|
|
42
|
+
.to raise_error(IOError, /fixture could not execute/)
|
|
43
|
+
expect(commands).not_to include('-data-list-register-values x')
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
['^running', "^running\n*stopped,reason=\"breakpoint-hit\",frame={addr=\"0x1000\"}",
|
|
49
|
+
"^running\n*stopped,reason=\"signal-received\""].each do |execution|
|
|
50
|
+
it "PSR-L05 classifies an unconfirmed outcome as unknown #{execution.inspect}" do
|
|
51
|
+
with_mi_peer(execution) do
|
|
52
|
+
result = described_class.run_to_crash(binary: '/fixture/offline')
|
|
53
|
+
expect(result).to include(signal: nil, exploitability: 'unknown')
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
%w[exited-normally exited].each do |reason|
|
|
59
|
+
it "preserves confirmed #{reason} as a no-crash outcome" do
|
|
60
|
+
with_mi_peer("^running\n*stopped,reason=\"#{reason}\"") do
|
|
61
|
+
result = described_class.run_to_crash(binary: '/fixture/offline')
|
|
62
|
+
expect(result).to include(signal: nil, exploitability: 'none', interpreter: 'mi3')
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it 'preserves the crash hash for an actual parsed signal stop' do
|
|
68
|
+
with_mi_peer("^running\n*stopped,reason=\"signal-received\",signal-name=\"SIGABRT\",frame={addr=\"0x1000\"}") do
|
|
69
|
+
result = described_class.run_to_crash(binary: '/fixture/offline')
|
|
70
|
+
expect(result).to include(signal: 'SIGABRT', pc: '0x1000', exploitability: 'abort')
|
|
71
|
+
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'tmpdir'
|
|
5
|
+
require 'shellwords'
|
|
6
|
+
|
|
7
|
+
RSpec.describe PWN::Plugins::Github, 'literal gh boundary' do
|
|
8
|
+
around do |example|
|
|
9
|
+
Dir.mktmpdir('gh-argv-') do |dir|
|
|
10
|
+
@dir = dir
|
|
11
|
+
@old_path = ENV.fetch('PATH', '')
|
|
12
|
+
# A space in the executable path also must not become shell syntax.
|
|
13
|
+
bin = File.join(dir, 'fake tools')
|
|
14
|
+
FileUtils.mkdir_p(bin)
|
|
15
|
+
File.write(File.join(bin, 'gh'), <<~RUBY)
|
|
16
|
+
#!#{RbConfig.ruby}
|
|
17
|
+
require 'json'
|
|
18
|
+
puts JSON.generate(argv: ARGV, token: ENV['GH_TOKEN'], prompt: ENV['GH_PROMPT_DISABLED'], color: ENV['NO_COLOR'])
|
|
19
|
+
warn 'fixture stderr'
|
|
20
|
+
exit 7
|
|
21
|
+
RUBY
|
|
22
|
+
File.chmod(0o700, File.join(bin, 'gh'))
|
|
23
|
+
ENV['PATH'] = "#{bin}:#{@old_path}"
|
|
24
|
+
example.run
|
|
25
|
+
ensure
|
|
26
|
+
ENV['PATH'] = @old_path
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it '[PBR-15] runs the exact executable with literal string arguments and preserves status' do
|
|
31
|
+
marker = File.join(@dir, 'marker')
|
|
32
|
+
cmd = "api 'repos/example/a b' ; printf bad > #{marker} $(printf expansion) $HOME *.rb"
|
|
33
|
+
row = described_class.gh(cmd: cmd, token: 'synthetic-token')
|
|
34
|
+
expect(File.exist?(marker)).to be(false)
|
|
35
|
+
expect(row).to include(exit: 7, stderr: "fixture stderr\n")
|
|
36
|
+
expect(JSON.parse(row[:stdout])).to eq('argv' => Shellwords.split(cmd), 'token' => 'synthetic-token', 'prompt' => '1', 'color' => '1')
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
it '[PBR-15] accepts argv without changing empty strings, quotes or metacharacters' do
|
|
40
|
+
argv = ['api', 'repos/example/a b', '', "quote'\"", '$HOME', '$(printf bad)', ';', '*']
|
|
41
|
+
row = described_class.gh(cmd: argv, token: 'synthetic-token')
|
|
42
|
+
expect(JSON.parse(row[:stdout])['argv']).to eq(argv)
|
|
43
|
+
expect(row[:exit]).to eq(7)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it '[PBR-15] rejects malformed quoting before starting the executable' do
|
|
47
|
+
expect { described_class.gh(cmd: "api 'unclosed", token: 'synthetic-token') }.to raise_error(ArgumentError)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
require 'tmpdir'
|
|
5
|
+
|
|
6
|
+
RSpec.describe PWN::Plugins::GoogleWorkspace, 'PR-GATE-01 explicit OAuth revocation' do
|
|
7
|
+
before do
|
|
8
|
+
@home = Dir.mktmpdir('pwn-provider-oauth-')
|
|
9
|
+
allow(Dir).to receive(:home).and_return(@home)
|
|
10
|
+
@path = File.join(@home, 'vault')
|
|
11
|
+
@decryptor = File.join(@home, 'decryptor')
|
|
12
|
+
stub_const('PWN::Plugins::GoogleWorkspace::PENDING_FILE', File.join(@home, 'pending'))
|
|
13
|
+
@oauth = { bearer_token: 'fixture-access', refresh_token: 'fixture-refresh', expires_at: 42,
|
|
14
|
+
client_id: 'fixture-client', client_secret: 'fixture-secret', scope: 'fixture-scope' }
|
|
15
|
+
@config = { unrelated: 'keep', plugins: { google_workspace: { oauth: @oauth.dup, other: 'keep' } } }
|
|
16
|
+
stub_const('PWN::Env', Marshal.load(Marshal.dump(@config)).merge(driver_opts: { pwn_env_path: @path, pwn_dec_path: @decryptor }))
|
|
17
|
+
allow(ENV).to receive(:fetch).and_call_original
|
|
18
|
+
allow(ENV).to receive(:fetch).with('PWN_DECRYPTOR_KEY', nil).and_return(nil)
|
|
19
|
+
allow(ENV).to receive(:fetch).with('PWN_DECRYPTOR_IV', nil).and_return(nil)
|
|
20
|
+
@device = double('synthetic hardware boundary')
|
|
21
|
+
stub_const('PWN::Plugins::YubiKey', @device)
|
|
22
|
+
allow(@device).to receive(:challenge_response) do |opts|
|
|
23
|
+
expect(opts).to include(slot: 2, serial: '123456')
|
|
24
|
+
OpenSSL::HMAC.digest('SHA1', 'synthetic-fixture-secret', opts.fetch(:challenge))
|
|
25
|
+
end
|
|
26
|
+
expect(PWN::Plugins::AuthenticationHelper).not_to receive(:mask_password)
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
after { FileUtils.remove_entry(@home) }
|
|
30
|
+
|
|
31
|
+
%i[legacy hardware].each do |format|
|
|
32
|
+
context "with #{format} ciphertext" do
|
|
33
|
+
before do
|
|
34
|
+
@access = if format == :legacy
|
|
35
|
+
{ key: Base64.strict_encode64('k' * 32), iv: Base64.strict_encode64('i' * 16) }
|
|
36
|
+
else
|
|
37
|
+
{ yubikey: { slot: 2, serial: '123456' } }
|
|
38
|
+
end
|
|
39
|
+
File.write(@decryptor, YAML.dump(@access)) if format == :legacy
|
|
40
|
+
File.binwrite(@path, PWN::Plugins::Vault.encrypt_data(@access.merge(data: YAML.dump(@config))))
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
[{}, { refresh_token: nil, expires_at: nil, client_secret: nil }].each do |fields|
|
|
44
|
+
it "retains existing values for #{fields.empty? ? 'omitted' : 'nil'} OAuth fields" do
|
|
45
|
+
expect(described_class.send(:persist_oauth_to_vault, oauth: fields.merge(bearer_token: 'fixture-rotated'))).to be(true)
|
|
46
|
+
persisted = PWN::Plugins::Vault.dump(@access.merge(file: @path))
|
|
47
|
+
expect(persisted.dig(:plugins, :google_workspace, :oauth)).to eq(@oauth.merge(bearer_token: 'fixture-rotated'))
|
|
48
|
+
expect(File.binread(@path)).not_to include('fixture-rotated', 'fixture-refresh', 'fixture-secret')
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it 'revokes persisted tokens through the public entrypoint without clearing client metadata' do
|
|
53
|
+
expect(RestClient).to receive(:post).with(described_class::REVOKE_URI, { token: 'fixture-refresh' }, content_type: 'application/x-www-form-urlencoded').and_return('')
|
|
54
|
+
expect(PWN::Plugins::Vault).not_to receive(:decrypt)
|
|
55
|
+
expect(PWN::Plugins::Vault).not_to receive(:encrypt)
|
|
56
|
+
expect(File).not_to receive(:write)
|
|
57
|
+
expect(Tempfile).to receive(:create).and_wrap_original do |create, *args, &block|
|
|
58
|
+
create.call(*args) do |temp|
|
|
59
|
+
expect(temp).to receive(:write).and_wrap_original do |write, bytes|
|
|
60
|
+
plaintext = PWN::Plugins::Vault.decrypt_data(@access.merge(data: bytes))
|
|
61
|
+
expect(YAML.safe_load(plaintext, permitted_classes: [Symbol], symbolize_names: true).dig(:plugins, :google_workspace, :oauth)).to eq(@oauth.merge(bearer_token: '', refresh_token: nil, expires_at: nil))
|
|
62
|
+
expect(bytes).not_to include('fixture-access', 'fixture-refresh', 'fixture-secret')
|
|
63
|
+
write.call(bytes)
|
|
64
|
+
end
|
|
65
|
+
block.call(temp)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
expect(described_class.revoke).to be(true)
|
|
69
|
+
expect(PWN::Env.dig(:plugins, :google_workspace, :oauth)).to eq(@oauth.merge(bearer_token: nil, refresh_token: nil, expires_at: nil))
|
|
70
|
+
persisted = PWN::Plugins::Vault.dump(@access.merge(file: @path))
|
|
71
|
+
expect(persisted.dig(:plugins, :google_workspace, :oauth)).to eq(@oauth.merge(bearer_token: '', refresh_token: nil, expires_at: nil))
|
|
72
|
+
expect(persisted[:unrelated]).to eq('keep')
|
|
73
|
+
expect(persisted.dig(:plugins, :google_workspace, :other)).to eq('keep')
|
|
74
|
+
expect(File.stat(@path).mode & 0o777).to eq(0o600)
|
|
75
|
+
expect(Dir.children(@home)).to match_array(format == :legacy ? %w[vault decryptor] : ['vault'])
|
|
76
|
+
expect(described_class.authenticated?).to be(false)
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|