by snprbob86 · 14y ago · 0 comments
It's taken my years of study, but I finally "get" Lisp. Let me summarize pg's On Lisp:
"Lisp is a language for writing programs fast"
1) Write a function
2) Write a function that does something similar to #1
3) Begin to write a function that does something similar to #1 and #2
4) Abstract out the commonalities between #1 through #3
5) Encounter all kinds of new use cases for your abstraction in #4
6) Wait for #5 to become unwieldy
7) Abstract #4 even further, until you have something that resembles an interpreter
8) Wait for #7 to become a performance bottleneck
9) Write a compiler that takes inputs to #7 and turns them into #1 through #5
"Lisp is a language for writing fast programs"
I don't know Javascript so I may be wrong here, but:
* Suppose someone uses this library to create a "MariaSQL Explorer App", where you give the app connection credentials and it connects to the database and shows you the data etc.
* A malicious attacker tells a user "have a look at my database" and the user goes to the attacker's database.
* The attacker's database (or spoof of one) has a column called 'dummy": MALICIOUS_CODE(), "colname'. notice the '"' chars inside column name.
* The MALICIOUS_CODE() runs in the user's node.js app. Perhaps it sends the attacker the passwords to other databases from the app's keychain or something..
* Profit
Besides, that's just an example snippet.
In the Javascript eval case, it's definitely possible; just access the data through a variable instead of inserting it into the eval'ed code.
However, in a Lisp, eval typically works on lists, not on strings. In effect, behaving like a parametric SQL query: a quotation mark or close paren or whatever in the string would be harmless.