The challenge involves an recruitment page for "They Fray" and allows anyone to submit a testimonial. The webstack utilizes GoLang with chi/templ and is deployed via Air, which allows for live reloading of golang applications. Testimonials is a GRPC Microservice and stored/retrieved as files. Exploitation occours because the Testimonial microservice is exposed to end-users, which provides the ability to overwrite the golang files on the webservice. Due to air live reloading files, it is possible to inject arbituary code.
Dans /grpc.go il y a la fonction SubmitTestimonial qui permet dβenregistrer dans /public/testimonials/ les formulaires reΓ§us. Il faut noter que le nom du fichier est dβailleurs le nom du customer
Dans /client/client.go on sβaperΓ§oit que lβon a une restriction lorsque lβon soumet un formulaire, le nom du customer ne peut pas contenir nβimporte quel caractΓ¨re
$ grpcurl -plaintext -import-path ./pb -proto ptypes.proto 94.237.53.3:31132 list
RickyService
$ grpcurl -plaintext -import-path ./pb -proto ptypes.proto 94.237.53.3:31132 describe RickyService
RickyService is a service:
service RickyService {
rpc SubmitTestimonial ( .TestimonialSubmission ) returns ( .GenericReply );
}
On peut maintenant appeler la fonction SubmitTestimonial avec notre payload
Pour Γ§a, on va le faire en Go en reprenant le dossier /ptb/ pour se connecter au serveur GPRC.
Concernant le payload, il faut simplement copier-coller /view/home/index.templ et remplacer fsys := os.DirFS("public/testimonials") par **fsys := os.DirFS("/")** ce qui permettra de lire tous les fichiers Γ la racine