2011-12-12 2 views
0

PCI 준수를 통과해야하는 사이트가 있습니다.PHP를 사용하여 예측할 수없는 쿠키 세션 ID를 생성하는 방법

Magento 1.5.1 (Magento는 PHP 기반 시스템)을 사용하는 사이트이며 PCI 호환 오류는 예측 가능한 쿠키 세션 ID입니다.

나는 "frontend"라는 Magento의 쿠키가 임의의 UUID로 변경된다는 가정하에 있습니다. 코어를 수정하거나 확장하지 않고도이 작업을 수행 할 수 있다고 가정하지만이 작업을 수행 할 수있는 설정은 없습니다.

생각하십니까?

Heres는 취약점 설명 :

원격 웹 애플리케이션 예측 쿠키 기반 세션을 ID를 사용한다. 이상적으로 세션 ID는 임의로 생성되는 숫자이며 은 공격자가 추측 할 수 없습니다. 세션 ID가 예측 가능한 경우 공격자 이 활성 희생자를 도용 할 수 있습니다.

답변

0

이것이 도움이되는지 확신 할 수 없지만 세션 설정 방법에 대해 알고있는 것처럼 안전합니다. 나는 모든 전자 상거래 프로젝트에 직접적인 영향을 줄 수 있기 때문에 나보다 더 잘 알고있는 누군가에 의해 시정되고 싶다.

아래 코드에서 내 opensource framework (함수를 포함하는 파일로 연결되는 링크)에서 참조되는 current_domain() 함수가 있습니다. 동적 도메인 대체가 필요하지 않으면 도메인을 하드 코딩 할 수 있습니다.

<? 
ini_set('session.use_trans_sid',  false     ); 
ini_set('url_rewriter.tags',   ''      ); 
ini_set('session.use_cookies',   true     ); 
ini_set('session.use_only_cookies', true     ); 
ini_set('session.name',    sha1(current_domain() )); // current domain is a function implemented in tgsf 
ini_set('session.cookie_lifetime',  0      ); // until browser is closed. I implement this server side 

ini_set('session.hash_function',   1); // sha-1 
ini_set('session.hash_bits_per_character', 6); 

// only if host is not localhost 
ini_set('session.cookie_domain', 'www.example.com'); 

// use for localhost 
//ini_set('session.cookie_domain', null); 

ini_set('session.cookie_path', '/'); // limit as much as you can for security 
ini_set('session.cache_limiter',   'nocache'); //prevents back button displaying a page after session is dead 
ini_set('session.cookie_httponly',   true); // helps prevent xss by preventing javascript access to the session cookie (on SOME browsers, not all) 
관련 문제