After reading about language based security, it seems protocols that are defined using context-free or regular grammars are highly resistant to code injection attacks.
Are there any good security protocols that are context-free or regular ?
There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.If this question can be reworded to fit the rules in the help center, please edit the question.
This paper deeply analyzes the problem and introduces a technique called Differential Parse Tree Differential Analysis. You should probably start from there.