Advertisement

A Language-Theoretic View on Network Protocols

  • Pierre Ganty
  • Boris Köpf
  • Pedro Valero
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10482)

Abstract

Input validation is the first line of defense against malformed or malicious inputs. It is therefore critical that the validator (which is often part of the parser) is free of bugs.

To build dependable input validators, we propose using parser generators for context-free languages. In the context of network protocols, various works have pointed at context-free languages as falling short to specify precisely or concisely common idioms found in protocols. We review those assessments and perform a rigorous, language-theoretic analysis of several common protocol idioms. We then demonstrate the practical value of our findings by developing a modular, robust, and efficient input validator for HTTP relying on context-free grammars and regular expressions.

Notes

Acknowledgments

We thank Juan Caballero for feedback on an early version of this paper. This work was supported by Ramón y Cajal grant RYC-2014-16766, Spanish projects TIN2015-70713-R DEDETIS, TIN2015-71819-P RISCO, TIN2012-39391-C04-01 StrongSoft, and Madrid regional project S2013/ICE-2731 N-GREENS.

References

  1. 1.
    Internet Protocol. RFC 791 (Proposed Standard), September 1981Google Scholar
  2. 2.
    Bangert, J., Zeldovich, N.: Nail: a practical tool for parsing and generating data formats. In: 11th USENIX Symposium on Operating Systems Design and Implementation (2014)Google Scholar
  3. 3.
    Bernardy, J.-P., Jansson, P.: Certified context-free parsing: a formalisation of valiant’s algorithm in agda. Logical Methods Comput. Sci. 12(2) (2016)Google Scholar
  4. 4.
    Borisov, N., Brumley, D., Wang, H.J., Dunagan, J., Joshi, P., Guo, C.: Generic application-level protocol analyzer and its language. In: NDSS 2007 (2007)Google Scholar
  5. 5.
    Brough, T.: Groups with poly-context-free word problem. Groups Complexity Cryptol. 6(1) (2014)Google Scholar
  6. 6.
    Crocker, P.D. (ed.): Brandenburg InternetWorking. Augmented BNF for Syntax Specifications: ABNF. RFC 5234 (Proposed Standard), January 2008Google Scholar
  7. 7.
    Davidson, D., Smith, R., Doyle, N., Jha, S.: Protocol normalization using attribute grammars. In: Backes, M., Ning, P. (eds.) ESORICS 2009. LNCS, vol. 5789, pp. 216–231. Springer, Heidelberg (2009). doi: 10.1007/978-3-642-04444-1_14 CrossRefGoogle Scholar
  8. 8.
    Faronov, V.: HTTPolice (2017). https://github.com/vfaronov/httpolice
  9. 9.
    Fielding, R., Reschke, J.: Hypertext Transfer Protocol (HTTP/1.1): Message Syntax and Routing. RFC 7230 (Proposed Standard), June 2014Google Scholar
  10. 10.
    Filmus, Y.: Lower bounds for context-free grammars. Inf. Process. Lett. 111(18) (2011)Google Scholar
  11. 11.
    Firsov, D., Uustalu, T.: Certified CYK parsing of context-free languages. J. Logical Algebraic Methods Program. 83(5–6) (2014)Google Scholar
  12. 12.
    Freed, N., Borenstein, N.: Multipurpose internet mail extensions (MIME). RFC 1341 (Proposed Standard), November 1996Google Scholar
  13. 13.
    Graham-Cumming, J.: Inside shellshock: How hackers are using it to exploit systems. https://blog.cloudflare.com/inside-shellshock/
  14. 14.
  15. 15.
    Latteux, M.: Intersections de langages algébriques bornés. Acta Informatica 11(3) (1979)Google Scholar
  16. 16.
    Li, Z., Xia, G., Gao, H., Tang, Y., Chen, Y., Liu, B., Jiang, J., Lv, Y.: NetShield: massive semantics-based vulnerability signature matching for high-speed networks. In: ACM SIGCOMM 2010 (2010)Google Scholar
  17. 17.
    Liu, L.Y., Weiner, P.: An infinite hierarchy of intersections of context-free languages. Math. Syst. Theory 7(2) (1973)Google Scholar
  18. 18.
    Meiners, C.R., Norige, E., Liu, A.X., Torng, E.: Flowsifter: a counting automata approach to layer 7 field extraction for deep flow inspection. In: IEEE INFOCOM 2012 (2012)Google Scholar
  19. 19.
    Microsoft releases security advisory 2953095. https://technet.microsoft.com/library/security/2953095
  20. 20.
    Mockapetris, P.: Domain Names - Implementation and Specification. RFC 1035 (Proposed Standard), November 1987Google Scholar
  21. 21.
    Pang, R., Paxson, V., Sommer, R., Peterson, L.L.: Binpac: a Yacc for writing application protocol parsers. In: ACM SIGCOMM IMC 2006 (2006)Google Scholar
  22. 22.
    Postel, J.: User Datagram Protocol. RFC 768 (Proposed Standard), August 1980Google Scholar
  23. 23.
    Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, A., Peterson, J., Sparks, R., Handley, M., Schooler, E.: SIP: Session Initiation Protocol. RFC 3261 (Proposed Standard), June 2002Google Scholar
  24. 24.
    Valero, P.: HTTPValidator, April 2017. https://github.com/pevalme/HTTPValidator
  25. 25.
    Ganty, P., Köpf, B., Valero, P.: A Language-theoretic View on Network Protocols (2016). (long version). Pre-print arXiv: https://arxiv.org/abs/1610.07198

Copyright information

© Springer International Publishing AG 2017

Authors and Affiliations

  1. 1.IMDEA Software InstituteMadridSpain
  2. 2.Universidad Politécnica de MadridMadridSpain

Personalised recommendations