← PHP / Laravel 목차

PHP-081 / 고급

임시 파일 생성 시 uniqid()만 사용

A02:2021 Cryptographic Failures · CWE-340 Generation of Predictable Numbers or Identifiers

왜 문제가 될까요?

uniqid() 는 시간 기반이라 추측 가능하다.

이렇게 수정하세요

php
$downloadKey = bin2hex(random_bytes(16));

더 읽기