* * * * * It's more like computer security theater than actual security > In w3m, to edit a form textarea, > > -----[ C ]----- > ... > f = fopen(tmpf, "w"); > if (f == NULL) { > /* FIXME: gettextize? */ > disp_err_message("Can't open temporary file", FALSE); > return; > } > if (fi->value) > form_fputs_decode(fi->value, f); > fclose(f); > > if (exec_cmd(myEditor(Editor, tmpf, 1)->ptr)) > goto input_end; > ... > -----[ END OF LINE ]----- > > exec_cmd is some setup and teardown around a system(3) call with the user's > editor and the temporary file. This is not good for security, as it allows > w3m to execute by default anything. One tentative improvement would be to > only allow w3m to execute a wrapper script, something like > > -----[ C ]----- > #!/bin/sh > exec /usr/bin/vi -S "$@" > -----[ END OF LINE ]----- > > or some other restricted editor that cannot run arbitrary commands nor read > from ~/.ssh and send those files off via internet connections. This is > better, but why not disallow w3m from running anything at all? > > -----[ C ]----- > if (pledge( > "cpath dns fattr flock inet proc rpath stdio tty unveil wpath", > NULL) == -1) > err(1, "pledge"); > -----[ END OF LINE ]----- > > Here we need the “proc” (fork) allow so downloads still work, but “exec” is > not allowed. This makes it a bit harder for attackers to run arbitrary > programs. An attacker can still read various files, but there are also > unveil restrictions that very much reduce the access of w3m to the > filesystem. An attacker could make DNS (Domain Name Service) and internet > connections, though fixing that would require a different browser design > that better isolates the “get stuff from the internet” parts from the “try > to parse the hairball that is HTML (HyperText Markup Language)” code, > probably via imsg_init(3) on OpenBSD, or differently complicated to > download to a directory with one process and to parse it with another. That > way, a HTML security issue would have a more difficult time in getting out > to the interwebs. > “Security Hoop [1]” What I find annoying is the lack of any type of attack as an example. It's always “data from da Intarwebs bad!” without regard to how it's bad. The author just assumes that hackers out there have some magical way of executing code on their computer just by the very act of downloading a file. The assumption that some special sequence of HTML can open a network connection to some control server in Moscow or Beijing or Washington, DC (District of Columbia) and siphon off critical data is just … I don't know, insane to me. Javascript, yes, I can see that happening. But HTML? And then I recall the time that Microsoft added code to their programs to scan JPEG (Joint Photographic Experts Group) images for code and automatically execute it, and okay, I can see why maybe the cargo cult security mumbo-jumbo exists. What I would like to see how opening a text editor with the contents of an HTML