Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: [de-de] php kontaktformular sendet nicht
GugUser wrote:
Die Sicherheitsvorkehrungen befinden sich nicht im als “Schema” bezeichneten Script, weil ich diese aus hoffentlich verständlichen Gründen nicht zeigen will. Das Formular kann nur unter gewissen Voraussetzungen abgeschickt werden. Bis jetzt (nach etwa einem Jahr) gibt es keine negativen Erfahrungen. Hoffentlich bleibt das so!
Expect the script doesn’t escape the input, which means anyone can inject own headers. Plus it doesn’t encode the headers (you can accidently malform the headers). For example:
Name <email@example.com>
To: email1@example.com
To: email1@example.com
To: email1@example.com
To: email1@example.com
To: email1@example.com
To: email1@example.com
To: email1@example.com
To: email1@example.com
To: Name
And as far ZCR goes, your script doesn’t use secret/nonce/hash validation as ZCR does. Basically with your script, you can endlessly send the same form again and again without visiting the page, but with ZCR you can’t. You have to first create the nonce (aka reload the empty form) before you can actually send the form.
Last edited by Gocom (2010-08-02 16:28:55)
Offline
Re: [de-de] php kontaktformular sendet nicht
Die Sicherheitsvorkehrungen befinden sich nicht im als “Schema” bezeichneten Script, weil ich diese aus hoffentlich verständlichen Gründen nicht zeigen will.
Feel free to look at how I secured zem_contact_reborn. Perhaps it also gives you some ideas for encoding the headers.
Dazu muss ich anfügen, dass in der .htaccess-Datei AddDefaultCharset utf-8 steht. Mir ist nicht klar, ob das einen Einfluss auf die über das Formular verschickten eMails hat.
It doesn’t have any effect on that. The headers of an email should contain only us-ascii (7-bit). While us-ascii is a subset of utf-8, the latter has to be mime-encoded if it contains 8-bit characters.
Offline
#15 2010-08-02 17:03:30
- GugUser
- Member
- From: Quito (Ecuador)
- Registered: 2007-12-16
- Posts: 1,477
Re: [de-de] php kontaktformular sendet nicht
Zuerst: Ich schreibe hier nicht gegen zem_contact_reborn. Dazu gibt es keinen Grund. Ich kann aber nicht erkennen, wie ich das, was ich umgesetzt habe, mit zem_contact_reborn hätte realisieren können.
Oder übersehe ich da etwas? In meinem Beispiel können z. B. Inhalte von Benutzerdefinierten Feldern in die per Formular verschickte eMail integriert werden.
Selbstverständlich ist es mir wichtig, keine Sicherheitslücken zu pflegen.
Es würde mich interessieren, ob Gocoms Aussage auf einem Test basiert oder sich auf mein Script-Schema beruft. Weil, im Schema wollte ich nur das Grundprinzip zeigen. Es gibt darin keine Sicherheitsvorkehrungen, das ist mir klar. Im von mir angewendeten kompletten Script aber schon. Stimmt auf die reale Anwendung gesehen die folgende Aussage?
Basically with your script, you can endlessly send the same form again and again without visiting the page, but with ZCR you can’t.
Wie lässt sich das überprüfen? Um eine solche sicherheitsrelevante Diskussion vorerst nicht öffentlich durchzuführen, schrieb ich eine eMail an Gocom, die bis zum obigen Zitat und bis jetzt aber nicht beantwortet wurde.
Ich wollte auf keinen Fall einen bezüglich Sicherheit bedenklichen Kode veröffentlichen. Im Kode des Anfangsbeitrages kann ich ausser dem Captcha aber nichts sehen, bei dem es um Sicherheitsvorkehrungen gehen würde. Also meinte ich, es gehe im Moment vor allem um eine Frage der Implementierung.
Es wäre wohl nützlich, wenn jemand, der weiss wie, hier aufzeigen könnte, wie ein Missbrauch gemacht wird und wie dieser festgestellt werden könnte. Damit wäre auch klar, ob Sicherheitsvorkehrungen als solche funktionieren oder nicht.
Offline
Re: [de-de] php kontaktformular sendet nicht
Zuerst: Ich schreibe hier nicht gegen zem_contact_reborn. Dazu gibt es keinen Grund. Ich kann aber nicht erkennen, wie ich das, was ich umgesetzt habe, mit zem_contact_reborn hätte realisieren können.
I think you misunderstood. I’m not saying you should use ZCR. I just pointed you to the ZCR code, which is publicly available, so you could see how it deals with header encoding and protection against header injection (and compare it with your own code). Whether ZCR is suitable for what you have in mind, that’s a different topic.
Wie lässt sich das überprüfen?
If you’ll let me have a look at the code privately, I can check.
Im Kode des Anfangsbeitrages kann ich ausser dem Captcha aber nichts sehen, bei dem es um Sicherheitsvorkehrungen gehen würde. Also meinte ich, es gehe im Moment vor allem um eine Frage der Implementierung.
True, the topic wasn’t about security. I just responded to the code you posted, not knowing it was incomplete (although without having seen it completely, it’s hard to say whether it’s safe or not). The code posted in the topic start isn’t vulnerable to header injection because it doesn’t set custom mail headers and has a hard-coded recipient and subject.
Offline
Re: [de-de] php kontaktformular sendet nicht
fantasmo wrote:
Wenn ich in “action” den Code so aufrufe “<txp:site_url />files/meincode.php”, dann wird er ausgeführt… das ist schonmal gut…:-)
Aber nicht IM Kontext meiner Kontaktseite. Also es erscheint einfach eine weiße Seite, mit z.B. dem Text “Bitte fülle alle Felder” aus.
Es soll aber IM Kontaktformular auf der Kontaktseite stehen.
Perhaps you can show us the URL where you actually use the contact form to make things clearer.
When a visitor fills out the form and submits it, does the visitor then return to the same URL where the contact form is or does the form submit to a different URL? Looking at the code you posted, it’s the same URL.
Oben im Code:
$link_name = $_SERVER['PHP_SELF'];
Unten bei “action”:
action="{$link_name}"
That’s no different than what you had before. Have you tried hardcoding the URL: action="/path/to/contact_form"
?
Offline
#18 2010-08-03 13:22:30
- fantasmo
- Member
- Registered: 2010-05-05
- Posts: 40
Re: [de-de] php kontaktformular sendet nicht
When the user submits the mail it leads to my php-code-file and there shows the success message, just black text on a white page.
—> because it really links just to this php-file, but the php file of course doesn’t include the whole website with layout, design and so on (or should it?!)
I now had a few tries with zem_contact, it works good so I’m considering staying with that…though it bothers me that I couldn’t make that own contact form work.
Thank you very much for your help, you are really good.
Offline
Re: [de-de] php kontaktformular sendet nicht
Since you included the PHP code for handling the form submission on a page that’s handled by TXP (otherwise you wouldn’t use txp:php tags), you shouldn’t have to link to a separate php-code-file. Just submitting the form to the same page that also contains the form should work.
Offline
#20 2010-08-04 10:58:22
- fantasmo
- Member
- Registered: 2010-05-05
- Posts: 40
Re: [de-de] php kontaktformular sendet nicht
Ah ok so einfach?… dann hab ich das vorher etwas falsch verstanden;-)
Offline