Skip to content
KitploitKITPLOIT
도구익스플로잇블로그
Log in
제출
도구익스플로잇블로그
제출

해킹, 침투 테스트 및 사이버 보안 도구를 당신의 보안 무기고에!

Kitploit은 해킹, 사이버 보안 및 침투 테스트 도구 디렉토리입니다. 최신 프로젝트 업데이트를 발견하여 취약점을 찾고, 시스템을 분석하고, 테스트를 자동화하고, 보안을 강화하세요.

피드문의개인정보© 2026 Kitploit

도구 디렉토리

카테고리

모든 카테고리 보기
Loading categories
cve-2026-9618-Patch — PeachPay Stripe 캡처 및 무효화 AJAX 엔드포인트에 대한 강화된 PHP 대체 핸들러로, nonce 검증, 권한 검사, 엄격한 주문 및 금액 검증을 추가합니다. | Kitploit
도구/GitHubGitHub/sleepthegod/cve-2026-9618-patch
Authentication & AuthorizationDefensive ToolsStatic Code Analysis (SAST)Vulnerability AnalysisCode AnalysisWeb Security
GitHubsleepthegod/cve-2026-9618-patch

cve-2026-9618-Patch

공유

PeachPay Stripe 캡처 및 무효화 AJAX 엔드포인트에 대한 강화된 PHP 대체 핸들러로, nonce 검증, 권한 검사, 엄격한 주문 및 금액 검증을 추가합니다.

저장소 보기
429일 전아직 검토되지 않음

<?php
/**
 * Hardened PeachPay Stripe payment capture and void AJAX handlers.
 * By Taylor Christian Newsome
 * Security controls
 * - Authenticated AJAX requests only.
 * - Nonce verification.
 * - Strict order ID and amount validation.
 * - Order-specific authorization.
 * - Positive finite capture amounts.
 * - Exception handling and server-side logging.
 *
 * Requires WordPress, WooCommerce, and the PeachPay Stripe integration.
 */

defined( 'ABSPATH' ) || exit;

/**
 * Send a standardized JSON error and terminate execution.
 *
 * @param string $message Error message.
 * @param int    $status  HTTP response status.
 * @return void
 */
function peachpay_stripe_ajax_error( $message, $status = 400 ) {
	wp_send_json_error(
		array( 'message' => $message ),
		$status
	);
}

/**
 * Verify an AJAX nonce.
 *
 * @param string $action Nonce action.
 * @return void
 */
function peachpay_stripe_verify_ajax_nonce( $action ) {
	if (
		! isset( $_POST['security'] ) ||
		! is_string( $_POST['security'] )
	) {
		peachpay_stripe_ajax_error(
			'Invalid security token. Refresh the page and try again.',
			403
		);
	}

	$nonce = sanitize_text_field(
		wp_unslash( $_POST['security'] )
	);

	if ( ! wp_verify_nonce( $nonce, $action ) ) {
		peachpay_stripe_ajax_error(
			'Invalid security token. Refresh the page and try again.',
			403
		);
	}
}

/**
 * Validate and retrieve a positive order ID from POST data.
 *
 * @return int
 */
function peachpay_stripe_get_validated_order_id() {
	if (
		! isset( $_POST['order_id'] ) ||
		! is_string( $_POST['order_id'] ) &&
		! is_int( $_POST['order_id'] )
	) {
		peachpay_stripe_ajax_error(
			'A valid order_id is required.',
			400
		);
	}

	$raw_order_id = (string) wp_unslash( $_POST['order_id'] );

	// Reject arrays, decimals, signs, whitespace, and other malformed IDs.
	if (
		'' === $raw_order_id ||
		! ctype_digit( $raw_order_id ) ||
		(int) $raw_order_id < 1
	) {
		peachpay_stripe_ajax_error(
			'Invalid order_id.',
			400
		);
	}

	$order_id = absint( $raw_order_id );

	if ( $order_id < 1 ) {
		peachpay_stripe_ajax_error(
			'Invalid order_id.',
			400
		);
	}

	return $order_id;
}

/**
 * Retrieve an order and verify the current user is authorized to manage it.
 *
 * WooCommerce capability mappings can vary by version and configuration.
 * Confirm that these capabilities match the permissions used by your store.
 *
 * @param int $order_id Order ID.
 * @return WC_Order
 */
function peachpay_stripe_get_authorized_order( $order_id ) {
	if ( ! function_exists( 'wc_get_order' ) ) {
		peachpay_stripe_ajax_error(
			'WooCommerce is unavailable.',
			500
		);
	}

	$order = wc_get_order( $order_id );

	if ( ! $order ) {
		peachpay_stripe_ajax_error(
			'Order not found.',
			404
		);
	}

	if (
		! current_user_can( 'edit_shop_orders' ) ||
		! current_user_can( 'edit_shop_order', $order_id )
	) {
		peachpay_stripe_ajax_error(
			'Unauthorized to manage this order.',
			403
		);
	}

	return $order;
}

/**
 * Validate a positive decimal capture amount.
 *
 * This validates the syntax and numeric range. It does not establish the
 * Stripe payment intent's remaining capturable balance.
 *
 * @return float
 */
function peachpay_stripe_get_validated_capture_amount() {
	if (
		! isset( $_POST['amount_to_capture'] ) ||
		! is_string( $_POST['amount_to_capture'] ) &&
		! is_int( $_POST['amount_to_capture'] ) &&
		! is_float( $_POST['amount_to_capture'] )
	) {
		peachpay_stripe_ajax_error(
			'A valid amount_to_capture is required.',
			400
		);
	}

	$raw_amount = trim(
		(string) wp_unslash( $_POST['amount_to_capture'] )
	);

	// Accept ordinary decimal notation only; reject exponent notation,
	// signs, commas, currency symbols, and non-numeric input.
	if (
		'' === $raw_amount ||
		! preg_match( '/^\d+(?:\.\d+)?$/D', $raw_amount )
	) {
		peachpay_stripe_ajax_error(
			'Invalid amount to capture.',
			400
		);
	}

	// Reject excessively long values before converting to a float.
	if ( strlen( $raw_amount ) > 32 ) {
		peachpay_stripe_ajax_error(
			'Invalid amount to capture.',
			400
		);
	}

	$amount = (float) $raw_amount;

	if ( ! is_finite( $amount ) || $amount <= 0 ) {
		peachpay_stripe_ajax_error(
			'Invalid amount to capture.',
			400
		);
	}

	return $amount;
}

/**
 * Log a Stripe operation failure without exposing internal details to clients.
 *
 * @param string          $operation Operation name.
 * @param int             $order_id  Order ID.
 * @param Throwable       $exception Exception thrown.
 * @return void
 */
function peachpay_stripe_log_ajax_failure(
	$operation,
	$order_id,
	$exception
) {
	if ( function_exists( 'wc_get_logger' ) ) {
		wc_get_logger()->error(
			sprintf(
				'Stripe %s failed for order %d. Exception type: %s.',
				$operation,
				(int) $order_id,
				get_class( $exception )
			),
			array(
				'source' => 'peachpay-stripe',
			)
		);
	}
}

/**
 * Handle an authenticated AJAX request to capture a Stripe payment.
 *
 * @return void
 */
function peachpay_stripe_handle_capture_payment() {
	// 1. Verify request authenticity.
	peachpay_stripe_verify_ajax_nonce(
		'peachpay-stripe-capture-payment'
	);

	// 2. Validate the order ID and load an authorized order.
	$order_id = peachpay_stripe_get_validated_order_id();

	$order = peachpay_stripe_get_authorized_order(
		$order_id
	);

	// 3. Validate the requested capture amount.
	$raw_amount = peachpay_stripe_get_validated_capture_amount();

	// 4. Confirm the required PeachPay integration is available.
	if (
		! class_exists( 'PeachPay_Stripe' ) ||
		! is_callable( array( 'PeachPay_Stripe', 'format_amount' ) ) ||
		! is_callable( array( 'PeachPay_Stripe', 'capture_payment' ) )
	) {
		peachpay_stripe_ajax_error(
			'The Stripe payment integration is unavailable.',
			500
		);
	}

	try {
		// 5. Format the amount according to PeachPay's currency conventions.
		$amount_to_capture = PeachPay_Stripe::format_amount(
			$raw_amount,
			$order->get_currency()
		);

		if (
			! is_numeric( $amount_to_capture ) ||
			! is_finite( (float) $amount_to_capture ) ||
			(float) $amount_to_capture <= 0
		) {
			peachpay_stripe_ajax_error(
				'Invalid capture amount.',
				400
			);
		}

		/*
		 * IMPORTANT:
		 * capture_payment() must independently verify the Stripe PaymentIntent
		 * is capturable, enforce the remaining capturable balance, use the
		 * correct currency units, and handle duplicate requests safely.
		 */
		$result = PeachPay_Stripe::capture_payment(
			$order,
			$amount_to_capture
		);
	} catch ( Throwable $exception ) {
		peachpay_stripe_log_ajax_failure(
			'capture',
			$order_id,
			$exception
		);

		peachpay_stripe_ajax_error(
			'Unable to capture the payment. Please check the payment status.',
			500
		);
	}

	// Preserve the existing PeachPay response format.
	wp_send_json( $result );
}

/**
 * Handle an authenticated AJAX request to void a Stripe payment.
 *
 * @return void
 */
function peachpay_stripe_handle_void_payment() {
	// 1. Verify request authenticity.
	peachpay_stripe_verify_ajax_nonce(
		'peachpay-stripe-void-payment'
	);

	// 2. Validate the order ID and load an authorized order.
	$order_id = peachpay_stripe_get_validated_order_id();

	$order = peachpay_stripe_get_authorized_order(
		$order_id
	);

	// 3. Confirm the required PeachPay integration is available.
	if (
		! class_exists( 'PeachPay_Stripe' ) ||
		! is_callable( array( 'PeachPay_Stripe', 'void_payment' ) )
	) {
		peachpay_stripe_ajax_error(
			'The Stripe payment integration is unavailable.',
			500
		);
	}

	try {
		/*
		 * IMPORTANT:
		 * void_payment() must confirm the Stripe PaymentIntent is in a
		 * cancelable state. A payment that has already been captured cannot
		 * generally be voided; it may require a refund instead.
		 */
		$result = PeachPay_Stripe::void_payment( $order );
	} catch ( Throwable $exception ) {
		peachpay_stripe_log_ajax_failure(
			'void',
			$order_id,
			$exception
		);
도구 다운로드

인기

모두 보기 →

커뮤니티에서 가장 많이 사용되는 도구를 찾아보세요.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 궁극의 OSINT 툴킷: 조사 그래프, 신뢰도 점수 산정, 별칭 패밀리, 지도, 타임라인 및 보고서. 49개 모듈, 400개 이상 사이트, API 키 불필요.

    867
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    # GhostLock 원탭 실행 앱 (CVE-2026-43499)

    544
  • 3

    ARTEX

    baarai/artex

    LLM 멀티 에이전트 자율 침투 테스트 플랫폼으로, 플래너/워커 에이전트, 자산 및 탐색 그래프, MITM 트래픽 기록, 취약점 재테스트 기능을 제공합니다.

    385
  • 4

    redforge

    cybersecurity91/redforge

    브라우저 측 레드 팀 툴킷으로, 정찰, 페이로드 생성, 자격 증명 공격, 암호화, 인코딩 및 참여 보고를 위한 102개의 오프라인 도구를 제공합니다.

    360
  • 5

    looking-glass

    anonghosty/looking-glass

    Shadowserver 보고서를 MongoDB로 수집하고 이를 대화형 지도, 분석, 발견 사항, 권고 및 경영진 대시보드로 재생하는 CSIRT 플랫폼입니다.

    302
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    AI 네이티브 사이버보안을 위한 행동 체계—의도가 통제된 실행이 되고, 증거가 운영 메모리가 되며, 모든 운영이 다음 운영을 개선하는 곳.

    279

모든 도구 탐색

도구 컬렉션을 둘러보세요

모든 도구 보기 →